Skip to content

Instantly share code, notes, and snippets.

Maze escape 🏃

Given a two-dimensional array (the maze) and an array of steps, implement a solution to verify whether or not the player escaped the labyrinth.

  • The solution should output "Escaped" if the player reaches the maze's exit.
  • The solution should output "Dead" if the player hits a wall or goes outside the maze border.
  • The solution should output "Lost forever" if the player does not reach the maze's exit after taking all their steps.

The two-dimensional data structure that represents the maze looks like this: