Skip to content

heathermortensen/SkunkGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This repo houses a repeated dice rolling game called Skunk. It is programmed in Java.

Skunk is a dice rolling game where each player can roll a pair of dice as many times as they like per round.

How To Play Skunk

  • The # of players must be > 1.
  • The player with the most points after 5 rounds wins.
  • Alternatively, a player can win by being the first to reach 100 points.
  • If players tie, the first player looses by default.
  • If a player rolls a 1, they lose all points in that round.
  • If a player rolls snake eyes, they lose all accumulated points in the game.

Use case

The scorecard shown here summarizes the example game above. Heather wins because she was first to reach 100 points. The scorecard shows each player's cumulative points across all of their turns rolling the dice.

Skunk Scorecard

Sample Program Output

This shows the program output for 1 round of play in a game with 2 players. During a round of skunk, each player takes their turn.

Heather is the first player.

She chooses to roll the dice 3 times and accumulates 20 total points, until she rolls a skunk in her third roll and looses all the points in her first turn.

Garth is the second player.

He rolls only once and gets 9 points. Garth's point total means that he is winning the game at the end of round 1.

Use Case

Skunk game with 3 players, where player #3 wins because he has the most points at the end of round 5.

image-20200725115334810

The data model might be imagined as a matrix with dimensions [number of players] x 5. We sum the points accumulated in every turn to give the total points for each player. The Scorecard outputs each players point totals.

2D matrix

Data Model

While we might visualize the data as a matrix, the actual implementation uses 2 arrays. An Array list of Player objects contains all the players in the game. Each player object contains an array containing the points for each of 5 turns (or rounds).

Data model

UML of the backend

This is the class diagram for game functionality, prior to adding MVC.

Class Diagram

Future Project Improvements

  • Make the pause between players shorter and create a pause after selecting "Yes" to option to roll the dice.
  • Add loop around playerTurns for 5 rounds of game. But, not yet. Otherwise, it will take forever to run the program.
  • Move Any remaining output into SkunkUI.java class. There's some scorecard outputs (NOT DONE) in the Player class and a Dice.java picture (DONE).
  • Make Scorecard output at the end of each round of turns.
  • Do I have time to add some tests? Write some for the conditions that don't execute often. Started.
  • Add MVC
  • Clean up GitHub README.md
  • Update the program output inside the readme.
  • Autogenerate a class diagram for backend using Visual Paradigm. Stored in images folder: classDiagramForSkunkGame.png
  • winner doesn't work. That function is messy - delete it.
  • format scorecard output for double and triple digits.
  • Double skunk (snake eyes) isn't clearing all rounds of player's points? It barley ever executes. Test this for all player points = 0.
  • Exit the game user input
  • Refractor the playGame() method in SkunkApp.java
  • Input validation
  • Winner must be declared for player points < 100 and tie game (DONE).
  • Missing a TestDice.java JUnit test class. Needed for snake eyes test.

About

A repeated dice rolling game

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages