aboutsummaryrefslogtreecommitdiff
path: root/src/player.lisp
AgeCommit message (Collapse)Author
2025-07-10OverhaulmasterAryadev Chavali
Loads of changes, some which I wasn't sure what I was on when doing them
2025-02-22Extract error generation from `player-exists?` to ensure it's an indicatorAryadev Chavali
2025-02-15Rework player package to use structures and a hash tableAryadev Chavali
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.
2025-02-15Clean up player-{pay,receive}Aryadev Chavali
Clean up the implementation of player-pay and player-receive by: - Single-clause early-error `if` for errors - use `incf`/`decf` instead of `setf`.
2025-02-15Introduce custom errors for player handlingAryadev Chavali
Custom errors for malformed/nonexistent player IDs as well as a player not having a high enough balance for the money requested. This will allow me to encode more information in the errors, for callers to use. I'm generally of the opinion that callers should be checking error conditions before calling these functions, but per Murphy's law it would be nice to have more information in the error message.
2025-02-15Player handler packageAryadev Chavali
This package defines a player data structure, collections of players, and different interactions you can have with them: - Extracting attributes (destructors) - Checking if they're bankrupt or can bet - Modifying a collection to adjust the balance of any one player (including errors in case that isn't possible)