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

Ball off table #35

Closed
wants to merge 5 commits into from
Closed

Ball off table #35

wants to merge 5 commits into from

Conversation

absynce
Copy link
Collaborator

@absynce absynce commented Dec 27, 2023

Handle when a ball goes off the table.

Currently, we treat ball-off-table as pocketed.

New scenarios to consider:

  1. 8-ball off table on break - 8-ball is spotted. Other player has ball-in-hand behind headstring. (Future: give option to re-rack instead.)
  2. 8-ball off table after break - Player loses. 😢
  3. Non-8-ball off table on break. Ball not spotted. Other player has ball-in-hand behind headstring. (Future: give option to accept the "table in position".)
  4. Non-8-ball off table after break. Ball not spotted. Other player has ball-in-hand. (Future: give option to accept the "table in position".)

TODO:

  • Check if ball is off the table instead of considering it pocketed.
  • Handle spotting the 8-ball once Spotted balls #34 is merged.

| NextShot (Pool AwaitingPlayerShot)
| GameOver (Pool AwaitingStart) { winner : Player }


type NextPlayerAction
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the way I decided to handle different variations on PlayersFault.

Alternatively, we could have multiple top-level variants, like this:

      | PlayersFaultSpotEight (Pool AwaitingSpotEightBall)

The downside is that it would become awkward to add a PlayersFaultChooseNextAction.

| NextShot (Pool AwaitingPlayerShot)
| GameOver (Pool AwaitingStart) { winner : Player }


type NextPlayerAction
= SpotEightBall (Pool AwaitingSpotEightBall)
-- | ChooseNextAction NextPlayerAction NextPlayerAction (List NextPlayerAction)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new variant here, ChooseNextAction, is the idea I have for allowing multiple actions.

@absynce
Copy link
Collaborator Author

absynce commented Jan 5, 2024

Closing since @w0rm merged it in and handled spotting the 8-ball in #34.

@absynce absynce closed this Jan 5, 2024
@w0rm w0rm deleted the ball-off-table branch February 12, 2024 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant