Advance Pig Game Development Using Module & Revealing Module Pattern
- The game has 2 players, playing in rounds.
- Players are not allowed to skip turn.
- In each turn, a player rolls a dice as many times as he whishes. Each result get added to his ROUND Score
- BUT, if the player rolls 1, all his ROUND Score gets lost. After which, it's the next player's turn
- The player can choose to 'Hold', which means that his ROUND score gets added to his GLOBAL Score. After that, it's the next player's turn
- The first player to reach 50 points on GLOBAL score wins the game.
Play Game @ Saheed Odulaja
- 1). Now you can set a new winning point or leave the default at 50.
- 2). You can only set winning point before game starts (before score gets sent to Global Score).
- 3). In addition to loosing current score with turn when a player rolls 1, a player now also loses whenever he rolls same number consecutively (e.g. 2&2, 3&3, 4&4, 5&5, with 6&6).
- 1). Playing against computer.
- 2). Choosing your preferred players name.
- 3). Saving players win in ratio with computers win to local storage in other to track play progress.
- Game Play With Computer Enabled.
- Players Can Decide To Play Alone Or Play With Computer Just With A Click Of A Button (Default Play Is Manual Play).
- Players Can Now Set A New End Game Number. You Only Have To Set It Once (But can Change It At Any Time);
- Players Winning Ratio Is Calculated And Dispayed On Game Load And On Game Win/Lose.
- Players Can Now Set Their Prefered Name.
Coding Excercise By Saheed Odulaja
The Advance Pig Game Is Re-Written By Saheed Odulaja As A JavaScript Coding Exercise Using JavaScript Module & Revealing Module Pattern. Feel Free To Fork This Repository Has There Is Room For Improvement :). Original Design By Haarry Beckwith at codepen.io