Skip to content

MrNovado/xstate-tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Dec 25, 2021
5b94e13 · Dec 25, 2021

History

42 Commits
Mar 1, 2021
Dec 25, 2021
Dec 12, 2021
Dec 25, 2021
Dec 11, 2021
Mar 1, 2021
Dec 25, 2021
Feb 28, 2021
Mar 1, 2021
Dec 25, 2021
Dec 25, 2021
Feb 28, 2021
Dec 25, 2021

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