Codelab Exercise 2: Implementing Tic-Tac-Toe (a.k.a. “kryds og bolle” )
Make this game work.
The toolbox
You will need to use the following:
- HTML
- CSS grid or flexbox could be smart
- JavaScript
- Arrays
- Functions
- Variables
- Conditional statements
- Loops
- DOM selectors
- DOM manipulation
- Event handling
- Event bubbling / delegation
- Strategic thinking. Try to break the problem down into smaller parts.
The rules
- No AI support. Don’t use chatGPT, Github Co-Pilot and other fancy stuff to solve this. You need to do it yourself.
- Try not to copy what others have done on the web
- The game should be able to detect a winner
- The game should be able to detect a draw
- The game should be able to restart
Tic Tac Toe is one of the most used games for teaching programming. And there is a reason for that. It’s a simple game, but it can be implemented in many ways. And it’s a good exercise for you to practice your programming skills - and learning Javascript and SPA development at the same time.
Have fun, and don’t give up.