ChutesAndLadders - CSUF CPSC 131 Fall 2016 Project 2...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
CSUF CPSC 131 Fall 2016 Project 2 Requirements Chutes and Ladders Game Introduction In this project, you simulate the play of a popular children’s game: Chutes and Ladders as shown in the picture below. 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The Chutes and Ladders game is played on a 100 square game board. Each square on the board is numbered 1 through 100. There can be as many players as desired but for the project, each of your team members will be a player in a game. Each player starts off the board at a figurative square 0. Each player rolls a single die with 1 through 6 face values and advances to the number of spaces shown on the die. For example, if the player is at position 2 and rolls a 5, the player moves to position 7. When any one of the players lands exactly on the square 100, the player wins, and the game is over. There are 2 rules to the player movement. (1) If the player lands on a slide (chutes), the player slides down. If the player lands on a ladder, the player climbs up. See the picture for the square where a slide or a ladder is, and the table below. Landing Square New Square Ladders 1 38 4 14 9 31 21 42 28 84 36 44 51 67 71 91 80 100 Chutes 16 6 47 26 49 11 56 53 62 19 64 60 87 24 93 73 95 75 98 78 For example, if the player lands on square 1, the player advances to square 38. If the player lands on square 98, the player slides down to square 78. 2
Image of page 2
(2) The player must land exactly on square numbered 100 to win. If the player rolls a die that would advance to a square beyond square 100, the player stays put at its place. For example, the player at square 97, the player must roll exactly a 3 to win. A roll between 4 and 6 would make the player stay put at the current square, and the player loses a turn. Source Code Files Like project #1, the provided classes are “skeleton” that you will need to fill in the blank spaces. You are required to fill in the missing parts so that the code for the game is complete and runs properly. The simulation is split into the following classes: (1) Die class (Die.hpp) allows a player to roll the die, which generates a number between 1 and 6, inclusive, randomly using the math library’s rand(). Client of the Die class can get the die face value via the accessor: getFaceValue().
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern