CANCELLED: Game state should track previous and current player for Gist forking/editing logic #20
Closed
5 of 6 tasks
Labels
Milestone
Closing issue #3 revealed a new bug in the logic of how the app handles forking/editing Gists: right now most of the game logic depends on the state of the current and next player, but the logic for forking/editing Gists should actually depend on the state of the previous and current players! The real condition here is this: who owns the current version of the Gist? If the current player owns the current Gist, they should edit it; if not, they should fork it.
Turn change and Gist editing scenarios:
First player needs to edit Gist when turn ends if first player is still connected at end of turn, regardless of any other players joining and/or disconnecting!
If first player disconnects before end of first turn, they still need to edit the Gist because the server will end the turn early, and it makes sense to save the first player's progress instead of misattributing their work to the next player.
Game ends if first player disconnects before end of first turn and no other players are present when the turn ends.
Tasks for this issue:
previousPlayer
andcurrentPlayer
both pointing to the first player (the server tracks this!)previousPlayerIndex
to server's game stateturnChange
data to include previous player datapreviousPlayerId
to client's game statehandleTurnChange
andhandleUpdateState
Note: after fixing this, the next related bug to fix (issue #21) is to then have the server handle forking/editing Gists on behalf of any user that disconnected before the end of their turn.
The text was updated successfully, but these errors were encountered: