Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CANCELLED: Game state should track previous and current player for Gist forking/editing logic #20

Closed
5 of 6 tasks
LearningNerd opened this issue Jun 28, 2017 · 1 comment

Comments

@LearningNerd
Copy link
Member

LearningNerd commented Jun 28, 2017

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:

  1. 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!

  2. 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.

  3. 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:

  • Initialize the game with previousPlayer and currentPlayer both pointing to the first player (the server tracks this!)
  • Add previousPlayerIndex to server's game state
  • Update server's turnChange data to include previous player data
  • Add previousPlayerId to client's game state
  • Update previous player data along with other client-side state variables inside handleTurnChange and handleUpdateState
  • Update events list and flowchart to reflect these new changes.

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.

@LearningNerd LearningNerd changed the title Game state should track previous and current editor for Gist forking/editing logic Game state should track previous and current player for Gist forking/editing logic Jun 28, 2017
@LearningNerd
Copy link
Member Author

Replaced this with issue #26 ("Game state should track Gist owner for forking/editing logic"), because that's a much better solution!

@LearningNerd LearningNerd changed the title Game state should track previous and current player for Gist forking/editing logic CANCELLED: Game state should track previous and current player for Gist forking/editing logic Jun 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant