Design comparison
Solution retrospective
Thinking about the solution gave me tough time especially when I have to track the selected items and if they match.
Community feedback
- @SkidragonPosted over 2 years ago
Hi Victoria, good job at making this and I had fun playing with it. I'm also working on this project and working with Xstate and spawning player instances depending on what the user chooses. Just some ideas that I'm throwing out here: Use a custom component using radio element to create the create game form buttons for accessibility purposes. Xstate.js is simplifying the game making process for me at the moment, essentially I have a game actor and spawn player actors to talk to each other. The game actor state holds the tokens, spawn the amount of players selected, keeps track of player's turn. The player actor tells the game actor that I matched these tokens correctly by storing it in its own state. Also the game actor has different phases like initializingGame -> choosingPlayer -> playerMoves -> checkWin -> choosingPlayer or gameOver. Here is the idea thus far: https://github.com/Skidragon/monorepo-portfolio/tree/memory/apps/memory
0@vikyijPosted over 2 years ago@Skidragon Hi Simon, Thanks for your feedback. I'll try implementing some of the things you noted like the radio elements for form buttons. For now I don't fully understand the game and spawn player actors you talked about but I'll go through your code on github. Cheers
0@SkidragonPosted over 2 years ago@vikyij np, looking up David Khourshid xstate on youtube can give an idea about state machines and actors to simplify the game making process and organizing the code into separate phases. It's taking me a while to get my head wrapped around it but I think if I had to use the state management from react it would have been a lot harder organizing and hoping there are no bugs when extending the game even further like using websockets to make it multiplayer online.
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord