MrNovado / xstate-tic-tac-toe

Tic-tac-toe using react & xstate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Abstract

Tic-tac-toe with actors using xstate.

Live Demo

Play against other player/AI, or watch a match between AIs.

~Fully typed using TypeScript.

How to

To install and run:

  • clone the repo
  • yarn
  • yarn start

NOTE: don't forget you can always switch machines in the inspector frame:

Machine

Machine is organized to operate in 3 simple phases:

  • setting-up a game (creating actors)
  • playing and taking turns
  • showing results

Actor

Actor is using Newell and Simon's expert model with rule ordering.

You can read more about it here:

Basically, actor follows a predetermined path to win.

The implementation, however, is using random sampling when it comes to selecting a move between other equally valid ones (i.e. when trying to take a free corner/side, when several are available).

About

Tic-tac-toe using react & xstate


Languages

Language:TypeScript 97.8%Language:HTML 1.7%Language:CSS 0.5%Language:Shell 0.0%