Open b-tsao opened 4 years ago
We also need to check possible kongs when players draw.
Instead of doing a computation for each thrown or drawn tile, we can precompute the claimable tiles when the player's hand changes.
Initially, we thought about doing a claimable check for each tile thrown. But after today's meeting, Frank brought up the idea to precompute a list of claimable tiles. This pre-computation can be done when the player's hand changes. When it's time to check for a claimable tile, we can quickly go through the list instead of doing a computation each time.
~Server will parse the hand along with the last discarded tile to retrieve possible combinations.~ EDIT: Upon design thinking, it makes more sense for client to process the hand during claim phase for available players. Reason: The server would have to process for 3 players, in addition to the processing for all on-going games, it just makes sense for individual clients to process their own hand and find available combinations, sending the index of the tiles in the player's hand for which they want to combo it with the discard (basically what the server expects the client to pass in currently, but manually).
Security wise, there should be no issue as the server knows what are in the players hand and the client sends the index of the tile position within the player's hand.
If no combinations are available, player will have an auto-skip passed in from the client once the timer is up (Issue #16)
If possible combinations are available, they should be categorized and presented to the player to pick one of the combinations or skip.