Crates.io | mahc |
lib.rs | mahc |
version | 1.8.0 |
source | src |
created_at | 2024-07-28 14:46:02.397379 |
updated_at | 2024-09-08 15:24:41.3431 |
description | cli riichi mahjong calculator, which spits out yaku and fu for a given hand |
homepage | |
repository | https://github.com/DrCheeseFace/mahc |
max_upload_size | |
id | 1318027 |
size | 1,271,565 |
CLI tool that calculates the score of a hand in riichi mahjong.
~/$ mahc -m 4 30 --ba 3
> Dealer: 12500 (4200)
non-dealer: 8600 (2300/ 4200)
note: the winning group has to go last (this is to calculate fu correctly)
~/$ mahc --tiles 777z 111z 234p 234p 11p -w 1p -p Ew -s Ew
> 7 Han/ 50 Fu
Dealer: 18000 (6000)
Non-dealer: 12000 (3000/6000)
Yaku:
Iipeikou: 1
Honitsu: 3
Yakuhai: 1
Yakuhai: 1
Yakuhai: 1
Fu:
BasePoints: 20
ClosedRon: 10
NonSimpleClosedTriplet: 8
NonSimpleClosedTriplet: 8
SingleWait: 2
# hands.txt
--tiles 1p 9p 1s 9s 1m 9m rd gd wd Ew Sw Nw WWw -w Ww -p Ew -s Ew
--tiles 11z NNw SSw WWw rrd wwd ggd -w gd -p Ew -s Ew -d Ew Ew
-m 4 30 --ba 3
~/$ mahc -f hands.txt
❯ Dealer: 96000 (32000)
Non-dealer: 64000 (16000/32000)
Yaku:
KokushiMusou Yakuman
KokushiMusou Yakuman 13 sided wait
Dealer: 144000 (48000)
Non-dealer: 96000 (24000/48000)
Yaku:
Tsuuiisou Yakuman
Daichiishin Yakuman
Shousuushii Yakuman
4 Han/ 30 Fu/ 3 Honba
Dealer: 12500 (4200)
non-dealer: 8600 (2300/4200)
in normal mode
~/$ mahc --tiles 123p 456p 789p rrrdo 99p -w 9p -p Ew -s Ew -d 9p --json
yields
{
"dora":1,
"fu":30,
"fuString":[ "BasePoints: 20", "NonSimpleOpenTriplet: 4", "SingleWait: 2"
],
"han":5,
"honba":0,
"scores":{
"dealer":{"ron":12000,"tsumo":4000},
"non-dealer":{
"ron":8000,
"tsumo":{"dealer":4000,"non-dealer":2000}
}
},
"yakuString":["Honitsu: 2","Ittsuu: 1","Yakuhai: 1"]}
and in calculator mode
~/$ mahc -m 4 30 --ba 3 --json
yields
{
"fu":30,
"han":4,
"honba":3,
"scores":{
"dealer":{ "ron":12500, "tsumo":4200 },
"non-dealer":{ "ron":8600, "tsumo":{ "dealer":4200, "non-dealer":2300 }
}
}
}
Type | Notation |
---|---|
Man (Characters) | 1m, 2m, 3m, 4m, 5m, 6m, 7m, 8m, 9m |
Pin (Circles) | 1p, 2p, 3p, 4p, 5p, 6p, 7p, 8p, 9p |
Sou (Bamboos) | 1s, 2s, 3s, 4s, 5s, 6s, 7s, 8s, 9s |
Type | Notation | MPSZ Notation |
---|---|---|
Winds | Ew, Sw, Ww, Nw | 1z, 2z, 3z, 4z |
Dragons | wd, gd, rd | 5z, 6z, 7z |
Description | Example |
---|---|
Open Sets | 234po (an open sequence of 2, 3, 4 in Pin suit) |
akadora | 0m, 0p, 0s |
cargo install mahc
mahc --version
git clone https://github.com/DrCheeseFace/mahc
cd mahc
cargo build
./target/debug/mahc --version
curl -s https://api.github.com/repos/DrCheeseFace/rusty-riichi-mahjong-calculator/releases/latest | grep "browser_download_url" | cut -d '"' -f 4 | wget -i -
unzip mahc-v1.1.0-x86_64-unknown-linux-gnu.zip -d mahc
cd mahc/x86_64-unknown-linux-gnu/release
./mahc --version
--dora
flagIf you spot a bug (which there probabably are many), put in an issue with how to reproduce it
if youd like to contribute, DO IT (send a PR)
keep in mind, we pretty far from finishing it currently. so FUCK validation (for the time being)