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

raise GameEnded #18

Open
Vlad-Shcherbina opened this issue Aug 10, 2015 · 0 comments
Open

raise GameEnded #18

Vlad-Shcherbina opened this issue Aug 10, 2015 · 0 comments

Comments

@Vlad-Shcherbina
Copy link
Owner

I was pretty pleased with myself at first. Look, you can end the game from any place in the code! And even attach human-readable explanation!

The problem is that there is no convenient way to process moves that happened after. Natural piece

try:
    for move in moves:
        game.make_move(move)
except GameEnded:
    ...

will not trigger 'attempt to make move in a finished game' diagnostics.

Interface used in BSG

for move in moves:
    assert not game.ended
    game.make_move(move)
assert game.ended

fits better. Admittedly, BSG had fewer termination conditions than Game.

On the other hand, which approach is more appropriate could depend on unforeseen rule clarifications. What if organizers said that moves after the game finished are ignored, while sequence of moves that does not lead to terminal state is not considered valid solution?.. Actually no, even then exception API is not too good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant