Create a program that determines, given an input of the path, whether Mario can reach the end, denoted by E
, from the start, denoted by S
.
A path will look something like this:
S = E
=====
In a path, the various symbols and what they represent are:
=
: wall/floor/ceiling. Mario cannot walk through wall , and cannot fall past a floor, or jump past a ceiling (he would hit his head)S
: air, except showing where Mario starts. This will always appear in the left-most column of the input, at ground level.E
: air, except showing where Mario wants to get. This will always appear in the right-most column of the input, at ground level.
The input will have spaces at every place where Mario could walk.
Mario can only move forward; in this example Mario cannot get to the goal
S
===
===
E
====
nor can he in this one
E
==
==
#==
==
==
==
S ==
======
However, he can reach the space denoted by #
(which will not appear in input), because he can jump up to four cells high; Mario is superhuman. As another example of his superhumanity:
S
=
=
=
=
=
= #
= =
=
=
=
= E
=======
Mario can get to the E
by falling the great distance, surviving, and walking calmly to E
. Note that he cannot reach the #
, because Mario falls straight down.
Mario can jump really high, but not very far forward by comparison.
S E
== ==
= =
Mario may attempt to jump the gap, but he will fail, and fall straight in. he cannot reach the end.
Mario can reach the goal in all of these examples:
E
=
=
=
S=
==
=
= E
S= =
== =
= =
=====
S
=
= E
====
This is code golf, so fewest bytes wins!
#
, because Mario falls straight down." If I'm viewing this correctly, wouldn't he fall straight down onto the#
? Also, are jumps defined as a maximum of 4 spaces up and maximum of 1 space right? \$\endgroup\$#
. As to the second question: I'm not OP but I'm guessing you are right. (that's what I assumed in my solution) \$\endgroup\$E
does not appear in the right-most column because the ground level extends one to the right from the rest of the map. \$\endgroup\$Mario cannot walk through wall , and cannot fall past a floor, or jump past a ceiling
\$\endgroup\$