Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

andreaiaia/tictactoe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tictactoe

TicTacToe project for The Odin Project

Instructions

  1. Set up the HTML, CSS and Javascript files and get the Git repo all set up.
  2. 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.
  3. The main goal here is to have as little global code as possible. Try tucking everything away inside of a module or factory.
  4. Set up the HTML and write a JavaScript function that will render the contents of the gameboard array to the webpage.
  5. 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!
  6. 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!
  7. 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.

Skill acquired at the end of the project

First steps into the OOP. In this project I practise with the module pattern and with factory functions.

View in Browser

About

TicTacToe project for The Odin Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published