-
We start the game.
-
There are two players X and O [rules]
-
Let's say we store their names.
-
X plays first [rule]
-
They mark their spot :
X _ _
display this output and validate whether the marking is in 3x3 grid when ui has a button it is easy to limit but when designing api for a program you are gonna receive info from perhaps another program so we have to limit the user to specific symbols
-
O, plays: X _ _ _ O _
-
The game continues until one of this things happen :
-
X wins or 0 wins(each row,column,diagonal has same symbol of either o or x)
-
draw the grid is full nine turns are over ie. tie
-
more moves are left
so when we think of the actions there are some emerging requirements:
- Store player names
- turn is gonna cycle between players so currentPlayer, nextPlayer
- store the board (display it to ig)
- Game orchestration (something to stimulate turn by turn game)