Skip to content

Instantly share code, notes, and snippets.

@dylhof
Created December 4, 2018 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dylhof/f61b742e5928492f745a02850c253c9d to your computer and use it in GitHub Desktop.
Save dylhof/f61b742e5928492f745a02850c253c9d to your computer and use it in GitHub Desktop.
https://github.com/dylhof/wheel-of-fortune
Things that need to happen in wheel of fortune
1. Start Game (splash screen)
- players enter their names
- click Start Game
- Players are created
- Game is started - (game class)
-puzzles are selected
- Game page is created
2. Normal Round Starts:
-All round scores are reset to $0
-Wheels are selected - (wheel class)(NOTE: We may want this at Start of Game)
-Puzzle board generates
-Player Turn:
-3 choices
1. Spin =>
a. one of 6 elements is chosen
-if $ => added to your current round score and you get to choose consonant
-if 'loose a turn' => Goes immediately to next player's turn
-if ' bankrupt ' => resets your current round score and goes to next player's turn
2. Buy Vowel =>
a. subtract $100 from current round score
b. choose Vowel
-checks if it is in puzzle
if yes => display all occurences of vowel in puzzle and continue current player's turn
if no => display message that tells them they are wrong and move to next player's turn
3. Solve Puzzle =>
a. display text box and submit button
-checks if it matches the puzzle
if yes => current player's round score is added to their grand total and next round starts
if no => display message that tells them they are wrong and move to the next player's turn
3. Bonus Round Starts:
- Check for the highest Grand Total and choose winner
- Only one player is in bonus round
- Reveal up to 6 consonants
- Player can choose 1 vowel
- Player can choose 3 consonants
- Then they can guess
a. if correct => They spin the bonusWheel and add that to Grand Total
b. if incorrect => End of game
Classes:
Game:
Properties:
number of rounds: 4
current round: defaults to 0
players: ['dylan', 'shannon', 'brittany']
puzzles: [{}, {}, {}, {}, {}]
winner for game: 'shannon'
Methods:
startNewRound() => calls - resetRoundScore()
- instantiates new wheel object
-calls generateWheelElements()
- generatePuzzleBoard()
- increment current round value
generatePuzzleBoard() => match round number to puzzles index
display winner()
Player:
Properties:
name: ''
round score: number
grand total: number
is turn: boolean (default false)
Methods:
add $ to round score()
subtract $ from round score()
add round score to grand total()
resetRoundScore()
Wheel:
Properties:
number of elements: 6
elements: generateWheelElements()
Methods:
spin() => chooses a random element and display a message depending on outcome
generateWheelElements() => returns [numbers and strings]
Child Class for Wheel
BonusWheel
Properties:
number of elements: 6
elements: generateBonusWheelElelements()
Methods:
spin()
generateBonusWheelElements() => will weed out the 'bankrupt' and 'loose a turn' elements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment