generated from Code-Institute-Org/gitpod-full-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add variables to store and track the game, and create array to store …
…and possible wins
- Loading branch information
atchutchi
committed
May 16, 2023
1 parent
ed00073
commit 89cea70
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Variables to store player scores and current round | ||
let playerXScore = 0; | ||
let playerOScore = 0; | ||
let currentRound = 1; | ||
|
||
// Variables to keep track of the game mode and whether play is active | ||
let gameMode = null; | ||
let gameInProgress = false; | ||
|
||
// Create an array to store each cell's value. | ||
let board = ["", "", "", "", "", "", "", "", ""]; | ||
|
||
// Create an array with all viable winning combinations. | ||
const winningCombinations = [ | ||
[0, 1, 2], | ||
[3, 4, 5], | ||
[6, 7, 8], | ||
[0, 3, 6], | ||
[1, 4, 7], | ||
[2, 5, 8], | ||
[0, 4, 8], | ||
[2, 4, 6] | ||
]; |