Tuesday, 3 May 2011

dice cricket

Dice Cricket Game
The Skeleton Program is a program for the two-player game of Dice Cricket. Dice Cricket is a simple game based on the sport of cricket. When playing Dice Cricket, players use two special dice called the Bowl Die1 and the Appeal Die.

The Bowl Die is a 6-sided die where, instead of the numbers 1 to 6, the sides have "0", "1", "2", "4","6", and "OUT" written on them. The player whose turn it is rolls the Bowl Die. If the result is one of the numeric values then this is added to their score (the number of runs they have got) and they continue to roll the Bowl Die until "OUT" is rolled. If the result is "OUT" then they roll the Appeal Die to see what happens next.

The Appeal Die is a 4-sided die where the numbers 1 to 4 have been replaced with different values. The values on the Appeal Die are "NOT OUT", "CAUGHT", "LBW" and "BOWLED". If when a player rolls the Appeal Die they get a result of "NOT OUT" then their turn continues and they can roll the Bowl Die again. Any other result on the Appeal Die means that they are out and their turn finishes. When player one's turn is over player two has their turn. When player two is out the two players' scores are compared and the winner is the one with the highest score.

In the Skeleton Program players can choose to play with real dice or virtual dice. If real dice are used then the two players have actually got a Bowl Die and an Appeal Die and enter the values they roll into the program. If virtual dice are used then the program simulates the rolling of the Bowl Die and Appeal Die by generating random numbers. There are 6 different values on the Bowl Die and 4 different values on the Appeal Die.

The Skeleton Program also stores the names and scores of the four highest results obtained by players playing Dice Cricket. After each game the scores of the two players are compared with the previous top scores. The winner's details, if their score is higher, will replace those of the player with the lowest top score. The loser's details, if their score is high enough, could also replace one of the previous player’s details. If the winning player’s score is the same as the lowest top score their details are not stored. If a game is drawn with a score lower than three of the top four scores then only player one’s details will be stored.

In the Skeleton Program there is a menu containing five options:
  Play game version with virtual dice
  Play game version with real dice
  Load top scores
  Display top scores
Quit
If the user chooses to load top scores from a file then the file HiScores.txt is opened and the contents placed in the array TopScores.

The Data File
Ricky,12
Sachin,45
Brian,2
Monty,1
The data file HiScores.txt will be available to you at the start of the examination.

No comments:

Post a Comment