This commit is contained in:
Tao Tien 2026-02-14 20:05:04 -08:00
parent 042975e561
commit 3143e5964b
3 changed files with 13 additions and 12 deletions

8
Cargo.lock generated
View file

@ -1229,7 +1229,6 @@ dependencies = [
"bitflags 2.10.0",
"color-eyre",
"ratatui",
"smol_str",
"tracing",
]
@ -3338,6 +3337,12 @@ dependencies = [
"byteorder",
]
[[package]]
name = "hashbag"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7040a10f52cba493ddb09926e15d10a9d8a28043708a405931fe4c6f19fac064"
[[package]]
name = "hashbrown"
version = "0.12.3"
@ -3715,6 +3720,7 @@ checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
name = "jiang"
version = "0.1.0"
dependencies = [
"hashbag",
"jong-types",
]

View file

@ -4,4 +4,5 @@ version = "0.1.0"
edition = "2024"
[dependencies]
hashbag = "0.1.13"
jong-types.workspace = true

View file

@ -1,11 +1,11 @@
use std::collections::HashMap;
use hashbag::HashBag;
use jong_types::*;
// pub fn check_valid() {}
pub enum Meldable {
Ron,
Chii(Tile, Tile),
Pon,
Kan,
@ -52,17 +52,11 @@ pub fn find_meldables(hand: &[Tile], dealt: Tile) -> Vec<Meldable> {
calls.push(Meldable::Chii(prev_outer, prev_inner));
}
// find ron
calls
}
fn count_shapes(hand: &[Tile]) {
let hand = if !hand.is_sorted() {
let mut hand = hand.to_vec();
hand.sort();
&hand
} else {
hand
};
pub fn check_ron(hand: &[Tile], melds: &[&[Tile]]) {
let bag: HashBag<Tile> = HashBag::from_iter(hand.iter().cloned());
}