Commit Graph

146 Commits

Author SHA1 Message Date
Aryadev Chavali
439b787040 modes:pair: add doc string for Pair::new 2026-04-05 04:45:51 +01:00
Aryadev Chavali
fea8f1716d *: fix doc strings 2026-04-05 04:45:51 +01:00
Aryadev Chavali
e1db8af26c modes:pair: Added pair type
Slightly more complex pattern since we've got two cards, but still
relatively trivial.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
f5fa964e55 modes:mod: use matches! instead of assert!(match...)
Give it up for Clippy, MVP of this codebase.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
71f644043a modes:mod|single: fix issue with footstool not taking other by reference 2026-04-05 04:45:51 +01:00
Aryadev Chavali
e401819914 modes:mod: doc for test_non_reflexivity 2026-04-05 04:45:51 +01:00
Aryadev Chavali
e46ece2622 modes:singles: refactor tests using the generic non_reflexive test. 2026-04-05 04:45:51 +01:00
Aryadev Chavali
bcd38ecdc4 modes:mod: implemented a generic tester for non_reflexivity
Given two "Hands", we test that the footstool condition on those two
hands are non-reflexive.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
9c5ee74639 modes:single: tests for footstooling and invalid singles 2026-04-05 04:45:51 +01:00
Aryadev Chavali
d2075cd000 modes:single: implement Hand for Singles
Really trivial implementation.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
99bfd9ed37 card: rearrange 2026-04-05 04:45:51 +01:00
Aryadev Chavali
44d8e4eba0 modes:mod: Hand trait
Any hand from any round mode has a chance of footstooling another hand
from that same mode.  This trait (Hand) allows us to implement these
semantics (as well as any other shared semantics) for each round mode.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
9059047c79 helper: little module for helper functions 2026-04-05 04:45:51 +01:00
Aryadev Chavali
04cf388f59 card: move all_same_rank and add documentation 2026-04-05 04:45:51 +01:00
Aryadev Chavali
ca07536b37 modes: new crate representing the API for different round types
Single is our first one - trivial really.  Only thing we need to check
is that the single isn't made up of a joker.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
1c962afb8f delete my old work
The classifier was nice, but punning all my hand types into the same
variant when (really) we're just gonna be using one hand type per
round makes no sense.
2026-04-05 04:45:51 +01:00
Aryadev Chavali
69c012e47a *: young clippy back at it again 2026-04-02 02:25:48 +01:00
Aryadev Chavali
91b40ed412 classifier: refactor for new PlayingCard type 2026-04-02 02:24:23 +01:00
Aryadev Chavali
52285de6be card: refactor to lift PlayingCard as it's own type
Now that playing cards are their own type, we can map a sequence of
Cards over to their PlayingCards, which should make the classifier a
bit nicer.
2026-04-02 02:22:35 +01:00
Aryadev Chavali
e422c75e5c README update 2026-04-01 06:23:09 +01:00
Aryadev Chavali
cd09b3b922 main: a randomised poker hand generator and classifier. 2026-04-01 06:20:22 +01:00
Aryadev Chavali
e5d5e4037f classifier: it's your boy, clippy 2026-04-01 06:20:22 +01:00
Aryadev Chavali
9dc4c8241f classifier: classify_poker_hand refactor 2026-04-01 06:20:22 +01:00
Aryadev Chavali
2356d78592 card: new card constructor 2026-04-01 06:20:22 +01:00
Aryadev Chavali
b6b54300c2 classifier: cleanliness refactor of is_pair,is_triple,is_straight 2026-04-01 06:20:22 +01:00
Aryadev Chavali
591944b88e classifier:classify: use a stack allocated array for new_cards 2026-04-01 06:20:22 +01:00
Aryadev Chavali
92348bc2c3 classifier: move hand types to their own module 2026-04-01 06:20:22 +01:00
Aryadev Chavali
04c39d4bae classifier: refactor for cleanliness 2026-04-01 06:20:22 +01:00
Aryadev Chavali
14d66cf171 classifier: permit loop-around straights
Our classifier now permits straights like (A(S), 2(D), 3(C), 4(S),
5(H)).
2026-04-01 06:20:22 +01:00
Aryadev Chavali
dd0011d1f2 card|classifier: young clippy up in this mf 2026-04-01 06:20:22 +01:00
Aryadev Chavali
ee6f9c7140 classifier: extract PokerType classifier from classify_poker_hand 2026-04-01 06:20:22 +01:00
Aryadev Chavali
42a7c27c41 classifier: naming refactor 2026-04-01 06:20:22 +01:00
Aryadev Chavali
2d5193c69e classifier: todo on consecutive_ranks regarding loop-around straights 2026-04-01 06:20:22 +01:00
Aryadev Chavali
8c8e030071 classifier: display method for Hand 2026-04-01 06:20:22 +01:00
Aryadev Chavali
839bb9375c classifier: jokers in between cards can make straights 2026-04-01 06:20:22 +01:00
Aryadev Chavali
be7ea8ba24 card: implement display methods for rank, suit, card 2026-04-01 06:20:22 +01:00
Aryadev Chavali
160500d969 classifier: first stage poker hand classifier 2026-04-01 06:20:22 +01:00
Aryadev Chavali
a774e3380c classifier: WIP Hand API with classifier for all round types
Currently working on the poker hand classifier.
2026-04-01 06:20:22 +01:00
Aryadev Chavali
b66c1c7706 card: add rank and suit destructors
They're Option since card may be a joker, but this is supremely
helpful.
2026-04-01 06:20:22 +01:00
Aryadev Chavali
dfc5761246 card: make Card::PlayingCard variant struct-like for more clarity. 2026-04-01 06:20:22 +01:00
Aryadev Chavali
7009d14965 derive partialeq for rank and suit (obvious impl) 2026-04-01 06:20:22 +01:00
Aryadev Chavali
cea30e0173 rustfmt: the only rule that matters 2026-04-01 06:20:22 +01:00
Aryadev Chavali
7f2b950602 added an issue tracking document 2026-04-01 06:20:22 +01:00
Aryadev Chavali
3259448dca card: a sufficient API for cards
The mathematical result that underpins this is a bijective map between
the positive integers and a unique playing card.
2026-04-01 06:20:22 +01:00
Aryadev Chavali
f112f9ed0c cleanup gitignore 2026-04-01 06:20:22 +01:00
Aryadev Chavali
520311cf9c Hello, world! 2026-03-31 15:31:36 +01:00