Skip to content

Advance Pig Game Development Using Module & Revealing Module Pattern

License

Notifications You must be signed in to change notification settings

Sidodus/addvance_javascript_pig_game

Repository files navigation

Advance JavaScript Pig Game

Advance Pig Game Development Using Module & Revealing Module Pattern

GAME RULES:

  • 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

UPDATE V1.5:

  • 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).

FUTURE UPDATE (done):

  • 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.

Version 2 Update

  • 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

About

Advance Pig Game Development Using Module & Revealing Module Pattern

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published