aboutsummaryrefslogtreecommitdiff
path: root/packages.lisp
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2025-02-15 20:05:01 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2025-02-15 20:08:32 +0000
commita56355da7d678ff61c0ad7b266742c91ab883ebb (patch)
tree74a6f801f96b321dd34dfc10a5825483f82134c0 /packages.lisp
parent0c04a32251d46664a755221b8f37edc87dc7d267 (diff)
downloadcantedraw-a56355da7d678ff61c0ad7b266742c91ab883ebb.tar.gz
cantedraw-a56355da7d678ff61c0ad7b266742c91ab883ebb.tar.bz2
cantedraw-a56355da7d678ff61c0ad7b266742c91ab883ebb.zip
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.
Diffstat (limited to 'packages.lisp')
-rw-r--r--packages.lisp9
1 files changed, 4 insertions, 5 deletions
diff --git a/packages.lisp b/packages.lisp
index 72fc8af..756b272 100644
--- a/packages.lisp
+++ b/packages.lisp
@@ -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)