You must program the game called MaDi which is described below.There is a board of NxN (the size N is defined by the user and mustbe a number greater than or equal to 2), where in each box there isan instruction. The first (the [0] [0]) and the last box (the [N-1][N-1]) have no instruction. Possible instructions are:
1. Don't move
2. Advance 4 places
3. Jump to the next row
4. Go back 2 places
5. It exploded! End of the game.
In order to facilitate the visualization of the matrix for theplayer, the instruction number will be displayed on the board andbelow it the list of instructions with their numbering.
Instructions:
1. Don't move
2. Advance 4 places
3. Jump to the next row
4. Go back 2 places
5. Bomb! Exploded.
The instruction that goes in each square of the board will beassigned randomly each time the game starts.
The player starts with his chip in the first position (row: 0,column: 0) and (bottom-right corner). On each turn the player rollsa die that will tell him how many spaces to advance. You advanceacross the board from left to right and from top to bottom asfollows:
On each turn the player rolls a dice that tells him how manypositions on the board to advance. After advancing, he must executewhat is indicated in the instruction of the box where he fell. Foreach turn, only execute one instruction on the board. The playerhas a maximum number of rolls of the dice, which will be asked tothe player when starting the game.
The game is lost if the dice are thrown without having reached thegoal or if the product of rolling the dice advances to a squarewith a bomb. The game is won if you reach the goal (it does nothave to be by exact count) before the roll of the dice runsout.