Question: jQuery / JS / Ajax Finish an objects version of the PIG game from chapter 13. To refresh your memory about the PIG game, start
jQuery / JS / Ajax
Finish an objects version of the PIG game from chapter 13.
To refresh your memory about the PIG game, start by entering the names of the two players and clicking on the New Game button. Then, the messages below the names show whose turn it is and announce the winner.
1. Note that this application uses three JavaScript library files besides the main dice.js file.
2. Review the library_die.js file, and note that it contains a constructor function named Die with no properties and a single method that rolls a die.
3. Review the library_pig.js file, and note that it contains a constructor named Pig with three properties. This constructors prototype inherits the one method of the Die object type and provides three more methods: takeTurn(), hold(), and reset().
4. Review the library_game.js file, and note that it is an object literal with three properties and six methods. The start() and isValid() methods are already coded for you, and the remaining methods have comments indicating what they should do. Finish the code for those four methods and be sure to make them cascading methods whenever possible.
5. Review the dice.js file and note that the ready event handler and a handler for the click event of the New Game button are supplied. There are also starts for the click event handlers for the Roll and Hold buttons, which you need to finish. These handlers will use the methods of the game object in the library_game.js file.
CODES AVAILABLE HERE: https://github.com/ar94952/JavaScript/tree/master/pig
Please provide github link to your modified codes. Thank you!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
