News Ticker

Menu

CS222 Project 1 The Game of Korona és Horgony - Dice Rolling Game

Project Description:

For this project, you will be creating a program to play a dice game known in Hungary as Korona és Horgony. The rules are fairly simple. Three dice, each containing six different symbols on each face are used. A mat, also containing the same six symbols is on the table. The player makes bets by placing wagers on one or more of the six symbols. The dice are then thrown. If any of the dice show the symbol on which a bet has been placed, the banker pays the player the amount of his stake for each die  showing that symbol.


In other words, if only one of the dice shows the symbol, the player is paid even money (1:1). The player is paid 2:1 if two dice show the symbol, and 3:1 if all three dice show the symbol. If the symbol does not show up, the player loses any bets placed on that symbol. Although the symbols on the dice can be figures such as a bear, a cat, a gypsy wagon and so on, you will use the numbers 1-6, found on a typical die, for your program.

Your program should give the player an initial bankroll of $100.00. The minimum bet to place on a symbol is $5.00. For purposes of this game, there is no maximum bet, other than the amount of money available. You may assume that only integer values (dollar amounts) will be used for bets.

Specifications:

At the start of the program you will give an introductory message and then prompt the player to enter a random number seed.

You will need to design and implement several functions (explained below) in order to complete this game.

You will need to decide on appropriate variables in which to store the player's bankroll (in order to keep track of how much money the player has) and how much s/he won or lost in the most recent game. This bankroll should be kept up to date on the player's current status, which means that wins should be added and losses should be subtracted from the bankroll as the user plays the game. After each game, theprogram must report the result of the dice throw, the amount of money won or lost, and the current value of the bankroll. After each game, the program should allow the player to continue playing until she chooses to quit, or until the player runs out of money. This central program control may be done within main().

"Rolling" the dice:

A separate function will be used to "roll" the dice. This function will contain three die variables. For a roll, you will set each variable separately using a random number generator. The possible values are one through six, corresponding to the six sides of a regular die. The function will print the value of each die after it is rolled. This function will return void.

For help on using random() to generate random numbers, click here.

"Playing" the game:

A second function will be used to play a single game of Korona és Horgony. This function should be passed the current $ amount of the player's bankroll and should return the amount of money won or lost for that particular game. Within the main program, the player is asked whether s/he would like to place a bet. If so, the function is called.

Within the function, the player must choose which symbols to place bets on, and the amount of each bet (see game rules above). The player then "rolls the dice" (simulated by a call to the dice-rolling function). This should be done interactively (via a key press from the player), rather than simply having the program roll the dice immediately after the bets are placed. After the roll, this function should report the values of each of the dice (after receiving the values from the dice-rolling function). The player is then notified whether s/he won or lost money in that game overall, and the amount won or lost. The amount won or lost is used as the return value of the function. You will have to create variables to keep track of the bets placed on each of the symbols, and decide how to check to see if any symbols had winning bets. (Hint: Although it is not necessary to use arrays, you may find the project easier to program if you do. If not, it still should not be difficult to use six separate variables, one for each symbol.)

After the function returns, the bankroll is updated accordingly. The player is then asked if s/he would like to play again, and if so, the function is called again. The amount returned should be used to update the player's bankroll.

Screenshots of Working Program




What are you waiting for? Get your solution now!


Buy now

Share This:

Post Tags:

Hassnain

I'm Hassnain. A full time Java Developer. I enjoy to make modern projects. I love to create JavaFX, Java Swing GUI and write about Java Programming, OOP. Now I'm working with CS2IT. You can buy our projects from here.

  • To add an Emoticons Show Icons
  • To add code Use [pre]code here[/pre]
  • To add an Image Use [img]IMAGE-URL-HERE[/img]
  • To add Youtube video just paste a video link like http://www.youtube.com/watch?v=0x_gnfpL3RM