You must program the game called MaDi which is described below. There is a board of...

50.1K

Verified Solution

Question

Programming

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.

Answer & Explanation Solved by verified expert
3.8 Ratings (480 Votes)
import numpy as np import random def rolldie return randint1 7 n intinputInput the size of the boardgreater than 2 while n 2    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students