Skip to content

Instantly share code, notes, and snippets.

@joel-oe-lacey
Last active December 16, 2019 20:56
Show Gist options
  • Save joel-oe-lacey/7907562446c15e4620fb4e36fce222bd to your computer and use it in GitHub Desktop.
Save joel-oe-lacey/7907562446c15e4620fb4e36fce222bd to your computer and use it in GitHub Desktop.
Wheel of Fortune Class Structure
Leaderboard class?
Game
players (instanciation of player class)
rounds (instaciation of Round for each round up to 4, handles bonus round)
puzzles (group of puzzle instanciations)
Puzzle
category
displayLetters (method to call on each guess to show letters
letter has to be hidden or not hidden, letter class?
Player
score (default 0)
name
Score/Account
Add to
Subtract from
Wheel
isBonus
placards (has 24 to choose from)
generateWheel
Round
determineWinner method (checks player scores)
isBonus
choose puzzle method (trigger at start of round)
guesses property (tracks puzzle guesses)
User Story Approach - Iteration 1
Handle user name input
script.js should handle input storage, and event triggering.
Display instructions
handled in scripts, show page
Wheel creation
making wheel
static/randomize cards
spinning wheel
add animation to wheel
return random element
Starting a game
User clicks start game button in instructions
call startGame method on game class
instanciate new users
Instanciate new round
Call loadPuzzles
Display game
Instanciating new round
selectPuzzle (chooses a puzzle from the game puzzles randomly)
set default values (constAvailable, vowelAvailable)
loadPuzzles method on game class
Playing Game - Iteration 2
Player class
solvePuzzle
take input guess, if guess is correct grand total is increased by current score
guess incorrectly turn is over
spinWheel
call spinWheel method on wheel class
if bankrupt clear round score, else
choose letter (call evaluateLetter on puzzle class)
take the return from evaluateLetter, multiply from spinWheel return (dollar amount) to calc amount to add to score
}
buyVowel
decrement by 100 from total score, call displayVowel on puzzle class
remove vowel from availableArray
Puzzle class
add correctLetters array property
evaluateLetter method
call handleGuess on the round class
return number of matches for letter
move letters in the puzzleClass
which will update the DOM to show correct guessed letters
displayVowel
show vowel at positions
Round class
handleGuess method (moves letter from available to guessed)
Bonus Round & Round Time - Iteration 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment