tkshill / Quarto

A working example of the Quarto board game using Elm and Netlify. An exploration of game development, OSS, and functional programming.
https://elmquarto.netlify.app/
MIT License
16 stars 16 forks source link

Feature Request: Have gamepiece buttons disabled when it's not the player's turn #48

Closed tkshill closed 3 years ago

tkshill commented 4 years ago

Issue Context

Here we can see that the user can click a button even when it's the computer's turn to play. This should... not be so.

Screenshot 2020-11-07 at 11 24 34

Suggested Solution

Behind the scenes, an active game exists in one of four turn states

type Player
    = Human
    | Computer

type alias Winner =
    Player

type Turn
    = ChoosingPiece
    | ChoosingCellToPlay ChosenPiece

type GameStatus
    = InPlay ActivePlayer Turn
    | Won Winner
    | Draw

Based on these types, the valid gamestatuses can be Inplay Human ChoosingPiece Inplay Computer ChoosingPiece Inplay Human ChoosingCellToPlay ChosenPiece Inplay Computer ChoosingCellToPlay ChosenPiece Won Winner Draw

Note that of these 6 options, the only time a game piece should be selectable is the first one, when a person is choosing a piece.

The view logic in Top.elm will have to be modified so the buttons are disabled except when the game is that specific turn state.

Alternatives Considered

Additional Resources


See here in the read me for how to run and install the application.

See here in contributing for the basics on forking and cloning the repository.

github-actions[bot] commented 4 years ago

Thank you for the issue! We'll take your request into consideration and will follow up soon if we decide to tackle this issue. To all contributors: any issue that is labeled Status: Available is up for grabs. To claim an issue to work on, please leave a comment. If you've claimed the issue and need help, please leave a comment letting us know and we can schedule some time to help. For full info on how to contribute, please check out our contributors guide.

dominicduffin1 commented 3 years ago

I'd like to take this on!

tkshill commented 3 years ago

All yours my friend