[Solved] CS143-Assignment 2 First to One Simulation

$25

File Name: CS143_Assignment_2_First_to_One_Simulation.zip
File Size: 395.64 KB

SKU: [Solved] CS143-Assignment 2 First to One Simulation Category: Tag:
5/5 - (1 vote)

This programming exercise is based on Programming Challenge 11 from the Gaddis text. You are to write the simulation for a game played by two or more players. In the game, each player starts out with some number of points. Each player takes a turn rolling a dice. The amount generated by the dice is subtracted from the players points. The first player with exactly one point remaining wins. If a players remaining points minus the amount generated by the dice results in a value less than one, then the amount is added to the players points.

At the start of the game, prompt the user for these values:

  • the number of points to start with
  • the number of players

Once these values are provided by the user, the simulation runs to completion, playing itself until one of the players wins (i.e., gets a score of one). This is a simulation. It is not supposed to be a game played interactively by the user.

As the simulation proceeds, output lines of text showing the status after each players turn, indicating:

  • what player is playing (e.g., player 0, player 1, etc.)
  • what value was generated by rolling the dice
  • points remaining for that player
  • when one of the players wins, announce the winner

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS143-Assignment 2 First to One Simulation[Solved] CS143-Assignment 2 First to One Simulation
$25