Skip to content

MrNovado/xstate-tic-tac-toe

Repository files navigation

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages