Skip to content

Epicodus project to practice object oriented programming

Notifications You must be signed in to change notification settings

Christinamawel/Pig-Dice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pig Dice

By Christy Welch, Katie Pundt, and Kim Brannian

A simple two-player dice game.

Technologies Used

  • HTML
  • CSS
  • Bootstrap
  • JavaScript
  • jQuery
  • Git
  • GitHub repositories

Description

A simple two-player dice game. Players take turns to roll a single dice as many times as they wish, adding all roll results to a running total, but losing their gained score for the turn if they roll a 1.

Rules of the Game

Each player rolls a die until they either roll a 1 or decide to "hold". The first player to score at least 100 points wins.

  • If the player rolls a 1, they score nothing and it becomes the next player's turn.
  • If the player rolls any other number, it is added to their turn total and the player's turn continues.
  • If a player chooses to "hold", their turn total is added to their score, and it becomes the next player's turn.

Test

  • _Describe: diceRoll() Test: It will return a random whole number between 1 - 6 Code: diceRoll() Expected Output: 1 or 2 or 3 or 4 or 5 or 6

  • _Describe: Player() Test: It will create Player {} Code: Player() Expected Output: {turnTotal: 0, scoreTotal: 0}

    Test: It will use diceRoll() roll and add it to turnTotal Code: player.roll(5) Expected Output: {turnTotal: 5, scoreTotal: 0}

    Test: It will take turnTotal and add it to scoreTotal and put turnTotal to 0 Code: player.hold() Expected Output: {turnTotal:0, scoreTotal: 5}

    Test: It will make turnTotal to 0 if it receives 1 Code: player.roll(1) Expected Output: {turnTotal: 0, scoreTotal: 5}

  • _Describe: winCheck(playerOne, PlayerTwo) Test: It will determine whether either player has turnTotal + scoreTotal: >= 100 Code: winCheck(playerOne, playerTwo) Expected Output: playerOne, playerTwo, or false

Setup/Installation Requirements

  • Navigate to https://github.com/Christinamawel/Pig-Dice
  • Click on the green "Code" button and copy the repository URL or click on the copy button
  • Open the terminal on your desktop
  • Once in the terminal, use it to navigate to your desktop folder
  • Once inside your desktop folder, use the command "git clone https://github.com/Christinamawel/Pig-Dice.git"
  • After cloning the project, navigate into it using the command "cd Pig-Dice"
  • Use the command "git remote" to confirm the creation of the new local repository
  • Open the project with the code editor of your choice

Note: when using the commands listed above, do not include the quotation marks. They are used here for readability.

Known Bugs

  • No known bugs

License

MIT License: https://opensource.org/licenses/MIT

Copyright (c) 2021 Christy Welch, Katie Pundt, and Kim Brannian

About

Epicodus project to practice object oriented programming

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published