Rework player package to use structures and a hash table
Instead of an association list and a type contract, let's use a hash table and a structure. This is: more explicit, encapsulates state more effectively, generates much of the cruft (constructors, destructors) for me. A hash table is more efficient when considering large player bases. In particular, we'll be generating unique player IDs to make it a bit more difficult for a malicious agent to guess another player's ID and make bad requests.
This commit is contained in:
@@ -58,13 +58,12 @@
|
||||
:5d.model)
|
||||
(:export
|
||||
:player
|
||||
:players
|
||||
:error-player-nonexistent
|
||||
:error-player-broke
|
||||
:player-id :player-balance :player-hand
|
||||
:player-exists? :player-bankrupt? :player-can-bet?
|
||||
:player-pay
|
||||
:player-receive))
|
||||
:player-exists? :player-bankrupt? :player-can-pay?
|
||||
:player-debit
|
||||
:player-credit
|
||||
:player-set-cards))
|
||||
|
||||
(defpackage cantedraw.game
|
||||
(:nicknames :5d.game)
|
||||
|
||||
Reference in New Issue
Block a user