So, I'm trying to create a program for solving labyrinths that will solve the labyrinth of X and O. What I would like to do is create a point class so that I can create a 2-dimensional array of points that would allow printing on the output page, as well implement a stack to be relatively simple.
The simplest algorithm of the general idea that I would like to implement in the most real program, I consider:
1) Move forward 2) Are you at a wall? 2a) If yes, turn left 3) Are you at the finish? 3a) If no, go to 1 3b) If yes, solved
But I had problems with developing a more in-depth algorithm, as well as to determine the class of my glasses. I know that for the glasses I had to set the X coordinate, and also set the Y coordinate, as well as the getters for the two. Do you think I need more methods than these two? For example, should I create a method that passes the x coordinate and y coordinate as parameters, so I can just combine them together, instead of setting x and y separately?
It will look like the labyrinth of the sample, where you start in the lower right corner and try to pass in the upper left corner, and X as walls and O as open spaces in the labyrinth:
OOOOOXO XXOXOOX OXOOXXX XXXOOXO XXXXOOX OOOOOOOXXOXXXO
source share