Tic-tac-toe

with RxJS

waiting

user click

valid
move?

no

update board state

update possible moves

do computer move

yes

game
finished?

yes

user
won?

yes

win screen

game over screen

no

who's
next turn?

computer

user

no

Data that should be stored in state

  • player (x,y) move
  • computer (x,y) move
  • board cell values
  • turn

A valid player move means:

  • it is the user turn
  • (x,y) input is empty

A valid computer move means:

  • it is the computer turn
  • (x,y) input is empty

deck

By Enrique Oriol

deck

  • 52