Skip to content

Using modules and factory functions to create a tic tac toe game. I began with the computer playing random moves. Then I used the minimax algorithm to make an unbeatable computer player.

Notifications You must be signed in to change notification settings

FriedrichtenHagen/tictactoe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TicTacToe Game

This is a tictactoe game with two levels of difficulty: easy and impossible. The impossible mode was achieved using the recursive minimax algorithm. The easy mode is random.

Here is a link to a live demo: https://friedrichtenhagen.github.io/tictactoe/

Screenshot here: the board

How it's made:

Tech used: HTML, CSS, Javascript

I started with letting the computer make random moves. This is far too easy to beat for most humans, so i researched the optimal way of playing the game. Using the minimax algorithm it is possible for the computer to recursively evaluate all future moves.

Lessons learned:

This project was a great exercise in javascript. I was able to use my existing knowledge about DOM manipulation. A module was used to keep all internal functions private. Objects for the board and the players are used to store information. Furthermore, I used the recursive minimax algorithm, which was a fun challenge.

About

Using modules and factory functions to create a tic tac toe game. I began with the computer playing random moves. Then I used the minimax algorithm to make an unbeatable computer player.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published