therewillbecode / poker-maison

🂺 A Multiplayer Poker App Crafted with Haskell and React
309 stars 34 forks source link

Remove action buttons from game UI which represent invalid actions #1

Closed therewillbecode closed 4 years ago

therewillbecode commented 5 years ago

The game view in the UI presented to a player when sat at the table has a panel of buttons representing game actions.

Currently only two sets of buttons are shown for players depending whether they are sat in a game or not.

What we want is to only show buttons with actions which are valid for the given game state.

Here is an example. if a player has raised before you, then you will still be presented with a check button. As a check action isn't possible during a round after a previous player has raised in the game of poker. This button shouldn't be shown to the player in such a situation.

The front end has a Redux store which contains the game state as a JS object. So the task would be to add action validation functions and alter the game action panel React component so that only buttons with valid actions according to the rules of poker are shown to players.

To help you determine which actions are valid depending on certain game states then look at the ActionValidation.hs file on the back end. Essentially you would need to rewrite most of this logic in Javascript and put this validation logic in the selectors.js file on the front end.