Assignment 4: Let's play Bunco!

Collaboration
You must work individually on this assignment. You may only discuss this assignment with the course staff.

Goals for this assignment.

  • Design, write, and test a Java program that simulates a game.
  • Practice using appropriate data structures
  • Practice using the git tool.
For this assignment, keep track and record the progress of your project by using Git. 

You will have to submit the output of the git log showing at least 3 commits along with a comment that explains your decision about when to commit your files.

Simplified version of Bunco

Bunco is a dice game. You will code a simplified version of it. Two players (user and the computer) will play at one table. Bunco consists of six rounds, numbered one to six in the order played. Players take turns rolling three dice.

Basic rules of Bunco

Points are scored by rolling the same number as the round you are in with the dice. In Round 1, the player is hoping to roll ones.

Round 1 = ones
Round 2 = twos

Round 6 = sixes

Each die that a player rolls in line with the corresponding round is worth one point and the player can continue rolling in the same Round.

For example:

  • If the player is playing Round 2 and rolls 2-3-6; the player scored one point and continues rolling in Round 2.
  • If the player rolls 2-3-2; the player scores two points and continues rolling in Round 2.
  • If a player rolls all three dice so that they match the corresponding round number (i.e. in Round 2, they roll all 2s) it is known as a “Bunco”, and the round is over (even if other players have not rolled in the round). Rolling a bunco is worth 21 points.
  • If a player rolls three ones in a different round, it is known as a “mini Bunco”. It is not a “Bunco” but it is still worth five points and the player continues rolling.
  • If the player is playing Round 2 and rolls 1-3-5, since the player did not roll any 2s, that player stops rolling and passes the turn to the other player.
  • When all players finish a round (meaning all of them have rolled on a specific Round), the round is over.

The winner of the game is the one that scores the highest total after 6 Rounds.

Design your solution

Create a game that involves 1 player (the user) against the house (the computer). You are free to design the solution. However, the solution is required to at least have:

These classes:
+ BuncoGame
+ Dice 
+ Dice cup/box
+ Player: players name assigned in the constructor. The default name will be Computer if no name is specified at the Player instantiation time.

These methods: 
+ isABunco
+ isAMiniBunco
+ playRound (will play a round for the current player)  
+ roll

In your program:

  1. Ask the player (user) for a name. The other player will be the computer.
  2. Setup/Create a BuncoGame with two players and 1 dice cup with three dice.
  3. To decide who will start the game first, each player will roll the dice, and the one with the higher running total will start Round 1.
  4. You should print out all the information related to each turn, roll, round, and game in the console.
  5. Every time the user must roll, the user should press RETURN to roll the dice and continue with the game.
  6. After finishing a game, print out the information for the current winner and the statistics showing the number of total games played so far, and the times each player won a game.
  7. Finally, the program should ask the user whether they want to play again or not.

Submission and Grading

You MUST include an Academic Honesty Statement in your client program. If you do not, your submission will be assessed a 10% penalty.

Your program must compile and run for the graders. If it does not, your submission will not be graded until the corrected file is received and you will be assessed a 20% penalty. You will need to use a token for resubmitting.

You must upload the source code and the compressed tar.gz file that contains all files related to this assignment except for the compiled classes. (see Lab 1 for instructions on how to create this file from your directory). Files that are in a .zip format will lose one point.

This assignment is worth up to 25 points based on the following:

Good practices

  • [1 point] Well documented code (use of Javadoc comments). Points will be deducted if your code is difficult to read.
  • [2 points] Use of version control system software to maintain multiple versions of software under development.
  • [1/2 point] Avoided spelling literal constants in code (“magic numbers”).

Meet Requirement specification

  • [4 points] 4 classes specified in the requirements.
  • [4 points] 4 methods specified in the requirements.
  • [2 points] Get the player name and set up the game with the computer as the other opponent.
  • [1 point] Each game starts with a roll to determine who goes first.
  • [1 point] Each round progresses using the rules described above and the game must work correctly.
  • [4 points] Your output must show the progress of the game, including round number, the dice values rolled, the score for each player at the end of the round, and who won the round. Program displays user friendly messages to communicate the game state.
  • [1 point] Whenever the player should roll, the game must pause and wait for “Enter” or “Return” to be pressed.
  • [1 point] The program must ask the player if they want to play a game in a loop until the player enters “no”
  • [3 points] Test file shows the test run of your program (at least 3 Bunco games).

Apply object-oriented design principles to the creation of Java programs

  • [1/2 point] Fields and methods’ visibility demonstrate good OOP design practices.

Extra

For your code to be considered for extra points. The game must work without errors, as detailed in the simplified version of Bunco’s requirements.
Instead of two players, update your solution to work with up to 4 players. When the game starts, your program must ask the user how many players will be participating.

  • If the answer is 1, the player will play against the computer following the simplified version of Bunco’s rules.
  • Otherwise, the program should ask for the players’ names (names must be unique).
  • Once the players’ names are set up, who will start the game is decided by rolling a dice, and the one with the higher running total will start Round 1. After that, players will continue clockwise according to the order of name insertion.
  • Once a game is over, the program should ask the user if they want to play again with the same players or new players.

This section is worth 5 extra points. (No partial points will be given).