I've hit a roadblock in my tic tac toe game project during class, and I've been struggling for the past two days to get the X's and O's to show up. The deadline for this assignment is tomorrow! Here are the task requirements:
COMPSCI20: Tic Tac Toe Assignment
Create an HTML file that includes the following elements:
- a page title and a link to a CSS file
- a header division (with an ID) containing text
- a main division (with an ID) with a 3x3 table of clickable buttons (each button having IDs and classes)
- a footer division (with an ID) containing text Title + Links Main + Table Header Footer
The CSS file should style the content as follows:
- define font, background color, text alignment, and padding for the header
- set the background color and padding for the main division
- buttons should have defined height, width, font, background color, and border properties
- customize the font, background color, text alignment, and padding for the footer
Create a JavaScript file that includes two global variables: one to store the player turn (X or O) and another to store the winner. The JS file should contain the following functions:
- a
Start()
function that initializes the player turn as X and the winner as null - a
ChooseSquare()
function that assigns the appropriate letter to the clicked button, disables it, and switches to the other player’s turn - a
CheckWin()
function that checks for each possible winning combination and displays a message in the footer if a player has won
This is the JavaScript code I have so far:
var winner;
var current;
function Start() {
current = "x";
}
... (remaining script omitted for brevity)
</html>