aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-02-19Implement -<> operator for threading an argument through first parameterAryadev Chavali
2025-02-15Added :author and :license to system definitionAryadev 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-15Yakshaving bob the builderAryadev Chavali
2025-02-15Add nicknames for all packages (cantedraw -> 5d)Aryadev Chavali
2025-02-15Disable image compression for binary.Aryadev Chavali
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)
2025-02-15Small changesAryadev Chavali
2025-02-15Rework `$` operator to take a capture variableAryadev Chavali
In case operators require use of a variable, we should let the caller provide the symbol so we don't fall into weird package issues.
2025-02-15Added a tasks file to keep track of what to do nextAryadev Chavali
2025-02-14Implement read-and-confirm for extra step before re-dealAryadev Chavali
Found that I sometimes did a misinput which lead to losing a critical card - implemented a function which asks for confirmation (with a print out of the cards that will be redealt) before doing the redeal.
2025-02-14Rework cantedraw.main:start to run a read-redeal-print-loopAryadev Chavali
We've now got one of the major stages of the game down. I think it's worth investing in some testing functions now - we've reached just the level of complexity.
2025-02-14Implement a read -> redeal -> print loopAryadev Chavali
Like REPL stands for Read -> Evaluate -> Print -> Loop, here we implement a similar loop which reads a set of indices for cards to remove from the user, redeals those cards then loops back. This keeps happening until either: - the user does not want to redeal (empty input) - there aren't enough cards for a redeal
2025-02-14Fix problem with alexandria:shuffle not being truly randomAryadev Chavali
Due to the way random works, we need to see it on each run of the binary - thus need to make a new random state.
2025-02-14Rework read-until-valid-integers to work better for redeal inputsAryadev Chavali
A player may: - not redeal any cards - redeal all their cards Therefore the indices must be between 0,5 and there can be at most 5 inputs.
2025-02-14Rework card< comparator to make Jokers the top of the hierarchyAryadev Chavali
2025-02-14Implement a package for some game mechanicsAryadev Chavali
Currently can deal some hands and redeal some cards.
2025-02-14Implement a function to remove specific indices from a listAryadev Chavali
2025-02-14Split source code into different modules for cleanlinessAryadev Chavali
2025-02-14Update gitignore, add requirements to README, rework bob and buildAryadev Chavali
2025-02-14WIP: Making a simple re-deal program.Aryadev Chavali
Gives a hand from a shuffled deck to the user, asks them to provide indices for cards they wish to re-deal then does so.
2025-02-14Adjust Bob so we can use quickload the project to get all dependenciesAryadev Chavali
2025-02-14Refactor Joker generation in make-deck to use mapcar on a range.Aryadev Chavali
This new version is terser while still expressing what I want.
2025-02-14Leave `FORMS` as is in `$` operator.Aryadev Chavali
`$` takes a list of forms and makes a unary function which applies them via `->>`. Previous definition reversed the forms supplied s.t. `$` was closer to the applicative operator in Haskell i.e. the function (<$> f g) is f(g(x)). But this version fits closer with the lower operator (->>) being used AND allows easier lifting from `->>` (which produces a value) to `$` (which produces a function).
2025-02-14Deck and joker constructorAryadev Chavali
Joker constructor takes a rank for uniqueness - rank doesn't really change anything in terms of the "power" of a joker but helps with ensuring jokers are unique in a deck. Deck constructor takes an optional argument for the number of decks. A deck includes two jokers, so n decks include 2n jokers.
2025-02-14Fixed bug in int->rank where n >= 13 leads to errorAryadev Chavali
Because I assume n is modded already.
2025-02-14Some serialisers to make pretty outputsAryadev Chavali
I can now use this package for a console application since we can pretty print cards.
2025-02-14Implement comparator functions for ranks, suits and cards.Aryadev Chavali
2025-02-14Adjust rank->int and int->rank for ACE supremacyAryadev Chavali
Generally, ACE is the best card in Cantedraw in a card-by-card basis thus it should be the higher when comparing.
2025-02-14Implement some simple converters for custom types to/from integersAryadev Chavali
Given n in 0..51, certainly there exists r, s s.t. `n = 13s + r` where r in 0..12 and s in 0..3. `r` is the rank, and `s` is the suit. ranks are ordered Ace, 2, 3, ..., Queen, King and suits are ordered Diamond, Club, Heart, Spade. Therefore there is a 1-1 correspondence between 0..51 and any card in the deck. Jokers are a bit less straightforward; for now I'll define them as an outlier which doesn't exist in the same bounds (which is why they're the default return for suit in int->suit). Likely I'll go for -1 representing a Joker.
2025-02-14Add a package for modelling cardsAryadev Chavali
Time to do the fun non-yakshaving part. I'll start out by writing some custom types for the objects of concern: ranks, suits, cards and sets of cards.
2025-02-14Rewrote --> to take a placeholder symbol as first argumentAryadev Chavali
Instead of exporting cantedraw.lib.macro._ and making anyone who wants to use the --> macro _require_ importing that specific symbol, let's just make it so the user has to supply a placeholder name before they do anything. This means each package provides its own placeholder symbol which lowers coupling.
2025-02-14Prefix all packages with `cantedraw`Aryadev Chavali
This is mostly a sanity check in-case anyone else decides to load this system for use in their own package - don't want to conflict with their names.
2025-02-14cantedraw.lisp -> main.lispAryadev Chavali
2025-02-14Added a READMEAryadev Chavali
2025-02-14Use := instead of = so we're not re-interning a symbol in cl-loopAryadev Chavali
2025-02-14Remove dependency on deploy - use ASDF's program-op insteadAryadev Chavali
2025-02-11odraw -> cantedrawAryadev Chavali
Why name it something unique when this is what I'm going to be making at the end of it all? Just makes it more confusing for the end user.
2025-02-11Some dir-locals for your (my) convenience.Aryadev Chavali
2025-02-11Added build script for terminal useAryadev Chavali
2025-02-11Move parse-integer*Aryadev Chavali
2025-02-11main -> odrawAryadev Chavali
2025-02-11Slightly clean up the example program in mainAryadev Chavali
2025-02-11Import lib.functions in mainAryadev Chavali
2025-02-11Rework rev-map to use ->> and to make LIST `cdrs` rather than CONSAryadev Chavali
2025-02-11Rework `$` operator to work like applicative in HaskellAryadev Chavali
f $ g $ h -> f(g(h)) whereas previous implementation ($ f g h) was h(g(f)).
2025-02-11rev-map functionAryadev Chavali
Given an indicator function (A->B) and a list of items of A, return an association list associating B to the elements that map to it; essentially the inverse map of the indicator.
2025-02-11Macro (alist-val) to access the actual value of a key in an alistAryadev Chavali