== 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.