Question
Use a Javascript program to create a game of snake, water and gun. The user will be asked to enter S, W or G. The
Use a Javascript program to create a game of snake, water and gun. The user will be asked to enter S, W or G. The computer should be able to randomly generate S, W or G and declare a win or loss using an alert. You can use confirm and prompt whenever required. Examples of Winning cases are as follows:
a. If the user enters the snake and the computer enters the water, then the user is the winner.
b. If the user enters the water and the computer enters the gun, then the user is the winner.
c. If the user enters the gun and the computer enters the snake, then the user is the winner.
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