The Challenge
- Reach the end of the level!
- Bonus points if you hit each of the (C)oin blocks exactly 2 times.
Disallowed
- Hard coding the command sequence in any way.
- Your favorite "One character language" that happens to do exactly one thing, which is solving this golf.
How To
Your program receives the level below(without line breaks) via standard input.
It then has to print out a commands which are needed to successfully complete the level.
The Level
- S is your starting position.
- E the position you need to be in to complete the level.
- C is a coin block with 2 coins in it, you'll never have to skip one of these in order to be able to complete the level.
- Both C and _ count as ground, there's only solid ground no floating platforms.
- | is a wall, all the walls you'll need to jump up in order to complete the level are at maximum 1 wall tall, everything that's higher you can consider an abyss you can't get out of in any way.
- x are spikes, guess what happens if you touch'em. Spikes will always be one level below the ground that is surrounding them.
All levels are 4 lines height, with each of the lines 63 chars wide. That makes a total of 252 characters per level.
> ______ ____ ________ ___ <
> C ______| | | | C __| | | | ____E<
>S______ __ ____| | | |_____| |__| |___| <
> xx xx xx <
Notes: The >< are just to illustrate the borders, they are NOT included in the input to your program. Also watch out for your text editor, as mine screwed up the whitespace a number of times
The Commands
- M = Moves you 1 to the right, if there's no ground beneath you, you will fall until you hit it. You cannot move while you are falling.
- J = Jump, moves you up by 1 for the next 3 commands or until you hit a (C)oin Block. After that, you will fall until you reach the ground. You can only jump when on the ground. If an M brings you on the same level as the ground, the jump gets canceled.
- O = NOP, will make you wait/do nothing. This way you can jump holes and spikes which a only 1 block wide(You don't need this for the level above, but you'll earn extra points if you can solve levels which need this).
The Solution(With Coin Blocks)
Successive commands are stacked on top of each other.
F indicates where you will fall(remember you can't do anything while falling),
MMMF MMMF
M MMMMMMJ MMMMF M MMMMMMMMJ MMMF
M J MMMFMMMF MMMMMMJ| | | |F J MMJ| | | |F MMMMME
SMMMJMJ MJ MMMJ| | | |MMJMJ| |__| |MMJ|
xx xx xx
Resulting command sequence, 75 characters long:
MMMMJJMMJMMMMJMMMMMMJMMMMMMJMMMMMMJMMMMMMMMMJJMMJMMJMMMMMMMMJMMMMMMMMJMMMMM
Hope this yields some interesting results... and not tons of flames :O
EDIT
OK, there are way more possibilities than I initially thought of, I apologize for all the edits.
_x_x_x_
(with xs a level below)? You need to JMM(wait)JMM(wait), but how can you? – Reduplicativeyour favorite "One character language" that happens to do exactly one thing, which is solving this golf.
– GuffeyE
is always at position 63 (at the 'end' of the level), so to say? – Sheathe