Briscola and TreSette games require a complete rewriting

Issue #4 open
Giacomo Alzetta
repo owner created an issue

== Briscola and TreSette rewrite proposal ==

=== Why Briscola and TreSette requires a rewriting ===

The Briscola and TreSette games, as they are written now, are not suitable to work with remote clients using simple RPC protocols, such as XMLRPC.

They should be completely rewritten, using an event-based interface, which would make a lot easier the use of these games with a RPC protocol.

=== Fundametal concepts of the rewriting ===

It should be client's responsability to request which events occurred and to, eventually, trigger some event. The game will only have the responsability to receive events, change his state and, eventually, append some event to a specific client's event-queue.

When a client asks for an event to the server, the server will pop the first event of that client's event-queue(e.g. the older event in the queue).

So, basically, the game should stop in a specific state after every event. This state should change whenever the game receive a new event. While, right now, the game contains an infinite loop in which it calls some client method. With this new interface the game should never ask the client any information.

=== Introduction of a new object: Event Judge/Examiner ===

A judge/examiner of the events should also be implemented. This object should provide a way to understand if an event is valid(e.g. a client sending an event that says that player A dropped the card X when the player A does not have that card will result as invalid.), in order to avoid invalid states of the game. Such an object should receive events from the client, but also from the server in order to update his "notion" of valid event during the game(e.g. if the player A at a certain point received card X, then the event that before was invalid, now should be valid).

The introduction of such an examiner will also make a lot easier the debugging, since we could simply introduce a mock examiner that checks if the events received from the game, or from the player, are correct.

Comments (3)

  1. Giacomo Alzetta reporter

    Partially Resolved

    With the changeset 49e44f1cad62 all the methods required for the Briscola game to be usable with events are implemented. These methods obviously require debugging and more tests, as already pointed out in issue #5. Also some features are missing(e.g. capability of playing using teams). The missing features should be implemented in the milestone 0.1.0a3. I'll continue to write tests for this game till the release of the 0.1.0 version.

    The next thing i'll do is to rewrite the TreSette game, in order to meet the requirements.

  2. Log in to comment