Tytr

A code blog

👁‍🗨❤️👨🏻‍💻

Roadmap Index

3/7/2022

Tic Tac Toe: Revisited

Let's take you to the finish line based on the last article and a couple more ideas. Here we want to get the following features:

State

Let's put together a simple object to encapsulate the game state.

const state = {
    x: true, // Is it x's turn?
    board: Array(9).fill(''), // Array of 9 empty strings
};

To Be Continued...

Conclusion

Hopefully you now have a relatively full-featured version of tic tac toe up and running. I suggest you really try to internalize the progress you've made here and put in some time practicing on other small apps before moving on to learning a component framework.

Link to my full code on github



Ask me questions on twitter or email me at ty@tytr.dev