Can someone please help me with this C++ problem?
Let's Play Chutes and Ladders!
The board is shown below.
Use a map structure to store all the chutes and ladders movements
Our version of the game is played as follows:
Example Output
0 8 13 16=>6 17 28=>84 92 95=>75 86 97 102
MOVES = 10

#include <bits/stdc++.h>
using namespace std;
int main()
{
// map to store pair of ladders and chutes values
map<int,int> chutesLadders;
// making pair of ladders
chutesLadders.insert(pair<int,int>(1,38));
chutesLadders.insert(pair<int,int>(4,14));
chutesLadders.insert(pair<int,int>(9,31));
chutesLadders.insert(pair<int,int>(28,84));
chutesLadders.insert(pair<int,int>(21,42));
chutesLadders.insert(pair<int,int>(36,44));
chutesLadders.insert(pair<int,int>(51,67));
chutesLadders.insert(pair<int,int>(71,91));
chutesLadders.insert(pair<int,int>(80,100));
// making pair of chutes
chutesLadders.insert(pair<int,int>(16,6));
chutesLadders.insert(pair<int,int>(62,19));
chutesLadders.insert(pair<int,int>(87,24));
chutesLadders.insert(pair<int,int>(47,26));
chutesLadders.insert(pair<int,int>(49,11));
chutesLadders.insert(pair<int,int>(56,53));
chutesLadders.insert(pair<int,int>(64,60));
chutesLadders.insert(pair<int,int>(93,73));
chutesLadders.insert(pair<int,int>(95,75));
chutesLadders.insert(pair<int,int>(98,78));
// key is initial position and value is final position
int key=0, value=100;
// position will keep track the position of a person
// count will count the nuumber of times the dice thrown
// or moves needed to reach 100
int position=key, flag=1, count=0;
// dice1 and dice2 will have random numbers
int dice1, dice2;
// loop unitl we react at 100 or further
while(position<100) {
// dice first random value
dice1 = rand() % 6 + 1;
// dice second random value
dice2 = rand() % 6 + 1;
// current position of the person
position+=dice1+dice2;
// check if a person step on the chute or Ladder
if(chutesLadders.find(position) != chutesLadders.end()) {
cout<<position<<"=>";
position = chutesLadders[position];
cout<<position<<" ";
flag=0;
}
// will print currect position
if(flag) {
cout<<position<<" ";
}
flag=1;
// increase it's value on every count
count++;
}
cout<<" MOVES "<<count;
return 0;
}


// Hope it will be helpful, don't forget to upvote the answer, really appreciated.
Can someone please help me with this C++ problem? Let's Play Chutes and Ladders! The board...
"Chutes and Ladders" is a popular board game for children. The game consists of a board that has squares which are numbered from 1 to 100, and players have counters which start on the theoretical square 0. On each player’s turn, the player generates a random integer number from 1 to 6 (e.g. by rolling a die or spinning a wheel) and move their marker through the board that many spaces. If you land at the bottom of a ladder...
2. One the last exam, you analyzed a mini-version of the board game Chutes and Ladders. For your reference, this information is repeated on the next page. (a) Give the one-step transition matrix P for the Markov chain {Xn,n 2 0]. (This is the same question that was on the exam) (b) What is the expected length (number of spins) of a game? (c) In which square should the player expect to spend the most time? (d) In which square...
Please, I need help with program c++. This is a chutes and ladders program. The code must be a novel code to the specifications of the problem statement. Thank you very much. Assignment Overview This program will implement a variation of the game “chutes and ladders” or “snakes and ladders:” https://en.wikipedia.org/wiki/Snakes_and_Ladders#Gameplay. Just like in the original game, landing on certain squares will jump the player ahead or behind. In this case, you are trying to reach to bottom of the...
Please use C++ as a Programming language and do the
tasks specified per the Guideline above and include comments of
your work.
Please make sure that the following test cases are
working:
Example 1
For input D13 D60 D76 D12 A17 D98 A94 D70 D3 A23 A42 D45 A100 D50
A99 A22 A87 A4 A90 D88 A71 A20 D39 D83 A97 A56 D28 A9 D43 A19 D5
A11 A54 A73 D54 A9 A24 A58 D6 D80 A72 A47 A82 A12...