- Home /
Backtracking algorithm with conditions.
Hey,
I am working on a tile-based puzzle game where you steer a block through a level. The block can change color on a special tile. To complete the level the player has to color all tiles and reach the end.
The Levels are stored in 2D arrays of ints where 0 means "no tile". Above 0 the different tiles are described by their IDs (e.g. the EndTile has an ID of 3).
Now another condition is that the player has only a certain number of Moves (moving the block from one tile to another). With more complex Levels it gets more difficult to evaluate the Maximum number of moves for a level.
Is there a clever way to implement the Backtracking algorithm that considers coloring all tiles that need to be colored? Alternatively I was thinking about just simulating every possible way and evaluating the smallest Maximum of moves.
Your answer
![](https://koobas.hobune.stream/wayback/20220612230628im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to find Gameobject with given coordinates 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How to make different Rule Tiles interact with each other? 0 Answers
Loop Animation of Textures 1 Answer