Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a Javascript program that: a.) SNAKES AND LADDER Create a player object that will represent a user playing the snakes and ladders game. The
Create a Javascript program that: a.) SNAKES AND LADDER Create a player object that will represent a user playing the snakes and ladders game. The object will have the ff. properties & method position() - stores the current position of the player in the game board roll() - generates a random number base on a 6-sided dice move() - generates the move that player will take. The method will generate a number from 1-10; if even number, it will call the the snake(), if odd it will call the ladder() ladder() - moves the player on the game board based on the roll() value snake() - moves the player back on the game board based on the roll() value show() - shows the current position of the player. The method will also prompt a message whether the player has reached the end tile of the game Note: - create a constructor function to declare the object - every new instance of the player will have the position 1 on the game board - there are only 100 tiles in the game board - create 2 instances of the player that will play the game - have those player call the methods to simulate the game
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started