Overview

In a group of two students, develop a GUI based game of Dice Roller in JAVA using good software design and coding principles, practices and methodology. This is a pair programming assignment with group and individual assessment components.

Dice Roller

You are expected to develop a GUI based Dice Roller game. The simple rule of the game is to roll (where is a positive integer from 1 to 5 with the default value of 2) six-face dices for each of the two players playing the game. A game consists of (where is an odd integer lesser or equal to 5 with the default value of 3) rolls. The winner of the game is decided by the total value of the players dices for rolls. For example, assume Player A and Player B decided to roll 2 dices and play a game of 3 rolls. Face values of 2 dices belonging to Players A and B for a game of 3 rolls are as follows:

Roll# Player A Player B
1 2, 5 3, 3
2 5, 4 1, 4
3 1, 2 5, 6
Total 19 22

Because the total of Player B is higher than that of Player A after 3 rolls, Player B wins the game. The next roll will start a new game. If there is a tie after three rolls, the winner is decided by a coin toss where Player A wins if the coin lands Head otherwise Player B wins. To make the game more interesting, players place bet in each game. The winner of the game will take the bet amount for the game, i.e., the winners amount is increased by the bet amount and the losers amount is decreased by the bet amount. The game ends when players quit the game or the amount of any player reaches zero.

Two players start the game by providing the followings in the first window:

  • Both players names. Defaults are Player 1 and Player 2
  • Number of 6-face dices (with face values 1 to 6) to roll for each player (). Default is 2.
  • How many rolls per game to decide the winner of the game (). Default is 3.

The main game window displays two players name and amount of money they have. Players place bet for a game and roll dices. The bet amount can be changed at the start of the game but the change is not allowed once the first roll of the game is done. The rolling of dices is simulated by animation where images of dices are changed to different faces with a small time delay. At the end of roll, a face for each dice is selected randomly. After roll of the game, the system should determine the winner and adjust bet amount accordingly. If the game score is the same, the winner is decided by a coin flip. The coin flip option should be available only when the game score is a tie, otherwise it should be hidden.

The simple design of two screen can be something like follows:

Sample of Initialisation Window: see image.

Sample of Game Window: see image.

The above windows layouts are just samples. Please use different themes, characters and user interface designs to make your game different, unique, interesting and visually more appealing. Please feel free to add more features in the game.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.