Commit Graph

135 Commits

Author SHA1 Message Date
Aryadev Chavali
f98b151c61 zipcartesian: iterator that does a cartesian product on two iterators
Essentially just encodes the flatmap of two iterators being tupled
together.  Different to just a standard zip.

Unfortunately we do need the second iterator to implement Clone as we
clone it for each item of the first iterator to generate the flat_map.

Type tetris masturbation has reached a new high here.
2026-04-14 22:52:35 +01:00
Aryadev Chavali
d8e8682ce7 helper: split out ExactSizeArr into its own module 2026-04-14 22:52:35 +01:00
Aryadev Chavali
414e523ba4 *: move from /*** */ doc-comments to /// 2026-04-14 22:52:35 +01:00
Aryadev Chavali
2d0e98c7f4 card: excessively simple card iterator 2026-04-14 22:52:35 +01:00
Aryadev Chavali
f1a26592ec big-c: update 2026-04-14 22:52:35 +01:00
Aryadev Chavali
364738eb94 modes:triple: finish ordering and footstools for Triples 2026-04-14 22:52:35 +01:00
Aryadev Chavali
b6d22a03ef card:tests: cleanliness 2026-04-14 22:52:35 +01:00
Aryadev Chavali
6e94f05443 modes:pair: use impl_cmp_eq_on_ord macro for ordering. 2026-04-14 22:52:35 +01:00
Aryadev Chavali
76f180d4c6 helper: macro to generate Eq,PartialEq,PartialOrd impls for an Ord type. 2026-04-14 22:52:35 +01:00
Aryadev Chavali
ddfb137fb1 card:tests: use Card::is_joker 2026-04-14 22:52:35 +01:00
Aryadev Chavali
6a4860643f modes:triple: better Triple::new
Using Card::rank we can do something similar to Pair::new.
2026-04-14 22:52:35 +01:00
Aryadev Chavali
d993f72958 modes:pair: refactor using new functions
- Better modelling for Pair::new using Card::rank optional.
- Ordering uses ~Ordering::then_with~ which maps to our previous
  pattern (cleaner)
2026-04-14 22:52:35 +01:00
Aryadev Chavali
e85f8b69d0 card:impls: Card::{is_joker,playing_card,rank,suit} 2026-04-14 22:52:35 +01:00
Aryadev Chavali
7646327f9d modes:triple:tests: start implementing tests 2026-04-14 22:52:35 +01:00
Aryadev Chavali
77fac27369 modes:triple: make new public 2026-04-14 22:52:35 +01:00
Aryadev Chavali
d538ab1600 modes:triple: ordering done 2026-04-14 22:52:35 +01:00
Aryadev Chavali
d8235b6edd modes:triple: new file encoding a Triple with new implemented
Not a difficult function to think about: we just don't want a
situation where we have all jokers.
2026-04-14 22:52:35 +01:00
Aryadev Chavali
419f1f4eb5 big-c: update for new task (creating triples) 2026-04-14 22:52:35 +01:00
Aryadev Chavali
059cb2f828 card: clippy oh clippy, clippy my beloved. 2026-04-07 12:36:48 +01:00
Aryadev Chavali
de29cab82e cards:tests: implement tests for card API 2026-04-07 12:36:48 +01:00
Aryadev Chavali
9ee1a0228d card#️⃣ implement hashing for ranks, suits, playing cards 2026-04-07 12:36:48 +01:00
Aryadev Chavali
ec31844ee7 helper: new ExactSizedArr adaptor for ExactSizedIterators
Given an ExactSizedIterator and a compile time known size (N), we
should be able to generate stack allocated arrays of the contents of
an iterator as long as the iterator has at least the required size.
2026-04-07 12:36:48 +01:00
Aryadev Chavali
9b1db4382d modes:single:tests: refactor footstool_deck_irrelevance via a combinatory argument 2026-04-07 12:36:48 +01:00
Aryadev Chavali
a1d0d72b1e modes:single|pair:tests: some adjustments based on prev refactors 2026-04-07 12:36:48 +01:00
Aryadev Chavali
b4cd7e8ea9 card:default: implemented defaults for every card type 2026-04-07 12:36:48 +01:00
Aryadev Chavali
967374d688 card:*: small changes 2026-04-07 12:36:48 +01:00
Aryadev Chavali
29e310a470 card:mod: split implementations of methods into impls.rs 2026-04-07 12:36:48 +01:00
Aryadev Chavali
285d816707 card: split up into its own module. 2026-04-07 12:36:48 +01:00
Aryadev Chavali
0d2eed5369 card: delete 2026-04-07 12:36:48 +01:00
Aryadev Chavali
c6858dbd51 big-c: tag refactor_cards as WIP 2026-04-07 12:36:48 +01:00
Aryadev Chavali
fbbabc1ce7 big-c: organise and setup tasks 2026-04-05 04:52:17 +01:00
Aryadev Chavali
9706a39152 modes:triples: deleted
Way more work needs to be put into the internals of this codebase
before I can continue work on the classifier, so I'm going to focus on
that.  Might be time for a merge.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
4b8ac90a1d modes:pair: implement hashing for pairs
Once again trivial.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
3168ce1ef0 modes:pair:footstool: refactored for better playability
Full footstools only proc on equivalence, otherwise high cards must
proc some form of footstool to get a half footstool.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
072159399d modes:pair:tests: refactor using new Card/PlayingCard methods 2026-04-05 04:45:51 +01:00
Aryadev Chavali
f1d6b36cd9 modes:single:tests: Utilise PlayingCard::next and PlayingCard::prev 2026-04-05 04:45:51 +01:00
Aryadev Chavali
7b5a6eb255 card: implement PlayingCard|Card::{prev,next}
Returns the next or previous card based on deck ordering.  Respects
the deck of the current card (i.e. will return a card from the same
deck) but will return None on the boundaries of the deck (3(D) and
2(S)).
2026-04-05 04:45:51 +01:00
Aryadev Chavali
3b8bdc5df9 modes:single: Implemented hashing on Singles (trivial). 2026-04-05 04:45:51 +01:00
Aryadev Chavali
abf638e869 modes:single:tests: major refactor
Better exhaustive testing, addition of messages on asserts as well.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
b796156ea5 modes:single|pair: make default struct construction private
If all fields are public, users are allowed to use the default struct
constructor.  Obviously we want users to only use the static ::new
method.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
fa4d8efb78 modes:mod:tests: test_footstool revert to basic pattern
My previous impl was based on some testing for different Pair
footstool implementations.  However, I've decided to fix it to this
set of patterns:
1) any half footstool must come from a more dominant hand.
2) full footstools are symmetric and require both hands to be
   equivalent
2026-04-05 04:45:51 +01:00
Aryadev Chavali
dce4279af2 card: make_decks -> Card::iter_all, PlayingCard::iter_deck -> iter_all 2026-04-05 04:45:51 +01:00
Aryadev Chavali
e054921462 modes:single:footstool: allow half footstools to loop
3 of Diamonds can now half-footstool 2 of Spades.  We need to fix
ordering to allow 3 of Diamonds to beat 2 of Spades specifically.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
df79488cec modes:pair:tests: refactor ordering test. 2026-04-05 04:45:51 +01:00
Aryadev Chavali
8bacbfbde3 modes:pair: adjust Pair::Ord
Instead of our more complicated interpretation before where we'd care
about whether something is proper or not, here we're just using a form
of reverse lexicographical on the Pair.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
9690fb2bf3 modes:pair:tests: refactor for name change 2026-04-05 04:45:51 +01:00
Aryadev Chavali
b7e511cbe8 modes:single:tests: rename for test_footstool 2026-04-05 04:45:51 +01:00
Aryadev Chavali
c2842c02e4 modes:mod: refactor Hand
Hand now requires Ord to be implemented, and test_footstool is a bit
more precise than test_footstool_non_reflexivity.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
fa6ce21fce modes:triple: start impl for triples
implemented Triple::new
2026-04-05 04:45:51 +01:00
Aryadev Chavali
f4cab01195 modes:*: cleanup 2026-04-05 04:45:51 +01:00