Event propagation in the Briscola game must be reviewed

Issue #8 resolved
Giacomo Alzetta
repo owner created an issue

== Event propagation in the Briscola game must be reviewed ==

The event propagation in the Briscola game(yapyclib.briscola.Briscola class) must be reviewed. As it is right now there are different methods producing events, from start_game to handle_player_dropped_card_event to end_of_trick, remove_extra_cards etc.

This has lead to the necessity of implementing a suppress_last_event method in order to cancel unwanted events produced by these submethods. This is clearly buggy and makes the implementation of the BriscolaExaminer hard.

There should be only a few methods emitting events. Actually these methods could be:

  • start_game
  • handle_turn: new method that handles the player_dropped_card event and produces the events, taking into account the turn/trick state, thus not producing unwanted events.
  • end_of_trick: needs a reimplementation in order to remove unwanted events.
  • end_of_game: this should be ok as it is right now.

This will ease the implementation of the BriscolaExaminer. Since this examiner should check each event produced by the game, it will be hard to implement it taking into account the suppress_last_event method.

Comments (1)

  1. Log in to comment