Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are asked to implement Chutes and ladder game, but with specific rules. You MUST use functions to implement your code. Game rules: 1-
You are asked to implement Chutes and ladder game, but with specific rules. You MUST use functions to implement your code. Game rules: 1- We will use two dices, each will be generated randomly (1-6 included). 2- In this game, we will have two Al players. 3- At each round, each player will roll the dices once. 4- Target is whoever reaches 100 or above first win. 5- Chutes rules: a. If a player stands on "14" needs to move back to "2" b. If a player stands on "99" needs to move back to "50" 6- Ladder rules: a. If a player stands on "8" needs to move to "34" b. If a player stands on "20"needs to move to "90"] Implementation: 1- Display a message to the user, with the name and the rules of the game Welcome to snack and ladder We have two players, Both are AI players First one to reach 100 or above is the winner 2- Display the board game to the screen as well. (you can create your own design, below is a sample, the board should end at 100) Lets play: 1 I I 1 1 1 11 75 16 | I T 21 I I I 46 I 26 I 1 51 I 31 | I 36 I 1 41 I I I I 71 56 | 1 61 | 1 66 I 1 21 71 12 1 I 17 I 1 22 II 27 I I 32 1 1 42 1 1 37 1 1 1 I 47 52 1 I 57 | 1 62 1 I 67 1 1 72 1 A 3 T I 8 I 13 18 1 23 I 43 48 1 28 I | 53 33 | | 38 1 1 63 68 73 I I T 58 | I I I 1 T I 1 | T 1 1 1 1 9 I I 1 14 T 1 19 I T 24 | I 1 included). "See if you need to pass parameters" 29 1 34 1 39 44 49 54 I 1 59 | I 64 | I 69 1 71 I 5 I 10 15 20 25 30 35 45 50 60 I 40 I 65 1 I 75 1 1 55 1 I I I 1 70 1 3- rand_dice() function: This function will be used to roll the dice randomly (1-6 both 4- roll_chutes() function: This function will be used to update the value of player depending on the rules of chutes. "See if you need to pass parameters" 5- roll ladder() function: This function will be used to update the value of player depending on the rules of ladder. "See if you need to pass parameters" 6- players() function: This function will be used to call the above functions, where you need to roll the dices, check if you need to update the values depending on chutes or ladder? "See if you need to pass parameters" 7- play() function: This function is your important one, as you need to define your players and start the game rounds and announce the winner (player reaches 100 or above first) 8- Below is a sample output: Let's start Round: 1 Player 1 turn: Rolling the dice You got dicel: 1 Total moves: 4 Round: 1 Player 2 turn: Rolling the dice You got dicel: 3, dice 2: 5 **YOU ARE LUCKY** Total moves: 34 I 1 | | 211 I 1 I I 1 1 1 1 1 11 1 1 1 1 nr 16 II 21 | 1 1, dice 2: 3 61 T 1 | | 1 11 T 1 16 | 1 21 26 | I 31 | I 16 36 | I 41 1 T 1 7 1 1 12 I 1 17 I T T 22 I 77 T 1 1 17 211 7 I I 12 T I 22 T I 27 | I 32 | I 37 1 42 T 17 1 I I 311 1 81 9- You will need to update the board as well, and display it after each round. It will be easier to create a function to display the board updated after each round. (Look for AI1,AI2) 13 I 20 18 | | 23 | | I 1 1 31 1 81 49 | 13 I 1 18 I 1 23 I I 28 | | 33 I 38 I 1 43 I 1 | AI1 11 I I I 14 I I 9 19 I 24 an I I AIl | | 9 I 14 T 1 19 II 24 I 1 AI2 1 29 | I I 39 I 44 I 1 1 I 5 1 10- Need to define all the above functions. 11- Need to validate user inputs. 12- Need to have the option of asking user if he/she wants to play again. 10 I 15 T 20 I 25 I 70 I 51 10 15 1 20 1 25 1 30 1 35 I I 40 45 50 I I I
Step by Step Solution
★★★★★
3.29 Rating (155 Votes )
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started