Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

9. Understand the phenomenon of code switching and interlanguage.

Answered: 1 week ago