TicTacToe project for The Odin Project
- Set up the HTML, CSS and Javascript files and get the Git repo all set up.
- It is best to store the gameboard as an array inside of a Gameboard object, so start there! The players are also going to be stored in objects.
- The main goal here is to have as little global code as possible. Try tucking everything away inside of a module or factory.
- Set up the HTML and write a JavaScript function that will render the contents of the gameboard array to the webpage.
- Build the functions that allow players to add marks to a specific spot on the board, and then tie it to the DOM, letting players click on the gameboard to place their marker. Don’t forget the logic that keeps players from playing in spots that are already taken!
- Think carefully about where each bit of logic should reside. Each little piece of functionality should be able to fit in the game, player or gameboard objects.
- Build the logic that checks for when the game is over! Should check for 3-in-a-row and a tie.
- Clean up the interface to allow players to put in their names, include a button to start/restart the game and add a display element that congratulates the winning player!
- Optional - If you’re feeling ambitious create an AI so that a player can play against the computer!
- Start by just getting the computer to make a random legal move.
First steps into the OOP. In this project I practise with the module pattern and with factory functions.