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
Get step-by-step solutions from verified subject matter experts
