Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions Write a web page that enables the user to play the game of tic-tac-toe. This involves a 3 x 3 grid (which you can

image text in transcribed
Instructions Write a web page that enables the user to play the game of tic-tac-toe. This involves a 3 x 3 grid (which you can create using an HTML table), on which users will click the cells, then displaying a symbol representing that player's move. The symbol should be either an X or an O. The objective is to get 3 in a row of your symbol. Requirements Program Requirements 1. Your program should create a board with all the cells of the table having empty game pieces. The user's goal is to get three in a row. The program will alter either (chosen at random) and displaying, under the table, "It is X's turn" or "It is O's tur Using the DOM and the click event, write a script that allows the user to place their game piece into the cell they click. [Hint: The onclick event should be specified for each table cell.] Your program should determine when the game is over, and then prompt the user to determin whether to play again (using buttons.) The buttons "Start/Restart" and "Play Again?" should be available, with the "Play Again?" button only being available when a game is over (due to win/loss or "the cat's game" (i.e., when nobody wins but the board is full nate between X and O, starting with 3. 4. Use the Math. random method to determine if X or O plays first at the beginning of a game. 5. Your program should allow a user to quit the current game and start a new game ("Start/Restart") 6. Your program should allow the user to select one of two radio buttons: a. Player v Player b. Player v Computer 7. If the game is a "Player v Computer", the Player always gets X and the Computer always gets the O symbol, but who moves first depends on the randomization just as it would if it was Pla Player The Al isn't really all that intelligent. The Computer simply looks for an open spot on the board and randomly selects one (again, using Math.random.) Again, the spot must be open unoccupied - you must NOT write over a symbol if one already exists in a particular spot. Your program should record and display the amount of time the game has been played for 8. 9. 10 r program must work in Microsoft Edge, Mozilla Firefox, and Google Chrome. 11. Your program must be written in JavaScript. You are not allowed to use any JavaScript libraries such as jQuery 12. Your program should indicate a winning or tie condition when such a situation occurs

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

Step: 3

blur-text-image

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 Management An Organizational Perspective

Authors: Richard T. Watson

1st Edition

0471305340, 978-0471305347

More Books

Students also viewed these Databases questions

Question

=+j Explain the essential nature of repatriation.

Answered: 1 week ago