- Practice: Pig Dice
- allows two people to play a game of Pig Dice
- rules of the game appear at top of page
- first to reach or exceed 100 wins
This project was created solely for the education of the author(s) and is not in a complete or portfolio-ready state. It should not be considered representative of professional work.
Epicodus - Intermediate JavaScript - Week 4, Lessons 24
Date created: 2021-01-27
Describe Player()
Test 1 "It will return an instance of Player whose typeof is 'object.'"
Expect typeof new Player().toEqual('object')
Test 2 "It will store a player name value as a string."
Expect newPlayer.playerName("Jon").toEqual("Jon")
Test 3 "It will store an initial key for turns taken."
Expect (newPlayer.turnsTaken).toEqual("0")
Test 4 "It will store an initial key for turn total."
Expect (newPlayer.turnScore).toEqual("0")
Test 5 "It will store an initial key for score total."
Expect (newPlayer.scoreTotal).toEqual("0")
Describe Player.prototype.rollDie()
Test 6 "It will generate an integer between 1 - 6 to simulate a six sided die."
Expect rollDie().toEqual("min: 1, max:6")
Test 7 "It will check to see if a 1 is generated. If so it will end the player's turn."
Expect rollDie("1").toEqual(newPlayer.turnScore("0"))
Test 8 "It will check to see if a 1 is generated. If so it will increment by 1 turnsTaken."
Expect rollDie("1").toEqual(newPlayer.turnsTaken++)
Test 9 "It will check to see if a 2-6 is generated. If so it will add it to the player's turn total."
Expect rollDie("!=1").toEqual(newPlayer.turnScore(++ rollDie()))
Describe winCheck()
Test 10 "It will check to see if player's scoreTotal summed with turnScore equals or exceeds 100. If so it will alert the player 'you have won!'"
Expect winCheck(scoreTotal + turnScore >= 100).toEqual(alert(${newPlayer.playerName}: You have won!
))
Describe Hold()
Test 11 "It will increase Player.scoreTotal by the value stored at Player.turnScore."
Expect hold().toEqual(newPlayer.scoreTotal += newPlayer.turnScore)
- Copy the following link to your clipboard: https://github.com/
- Open a Bash Terminal
- In your terminal window, navigate to a directory that you would like to clone the repository to
- Within your git bash terminal type in 'git clone' and then paste in the link from your clipboard by right clicking and selecting 'paste' example below:
$ git clone https://github.com/
- After the page has been cloned to your chosen directory locate the folder and open it.
- After you have the folder open that you cloned from Github.com double click the file "index.html"
- The webpage should open in the default browser set by your machines settings
This game can be played via it's gh-page
Authored by: Tyler Sinks & Jon Stump
- JavaScript
- Bootstrap
- jQuery
- display stylized dice in place of numerals during turn
- use CSS, html, and JavaScript only to accomplish above stretch goal -- not images
- a nice description of a technique to reach this stretch goal: Create dice using CSS grid
GPLv3
Tyler Sinks, Jon Stump © 2021
Tyler Sinks [email protected] Jon Stump [email protected]