What is the formal name of this problem?

197 Views Asked by At

I'm doing an assignment and I'm having trouble with this question, could anyone give me the formal name of the problem described so I can research it better?

The task is to move a player along a path of n squares starting a square 1 and moving forward each step. At any point you can do one of three things.

Push a blue button moving the player forward 2 squares. If the player has fewer than 2 squares left on the path, then this button terminates the game and the player wins.

Push a yellow button moving the player forward 3 squares. If the player has fewer than 3 squares left on the path, then this button terminates the game and the player wins.

Push a green button moving the player forward 5 squares. If the player has fewer than 5 squares left on the path, then this button terminates the game and the player wins.

Squares are painted either white or red. Square 1 is white. If a player lands on a red square then the player loses the game.

Out input for the algorithm we must provide is an array A of length n. The value of A[i] tells us whether the i'th square is painted red or white.

The output is the smallest number of moves needed to complete the game.

If anyone could give me the name of the problem so I could research it more I would be very grateful. Also if you have any input how this could be solved using dynamic programming that would be very helpful.