| Crates.io | riichi-calc |
| lib.rs | riichi-calc |
| version | 0.1.0 |
| created_at | 2024-12-22 01:56:33.516468+00 |
| updated_at | 2024-12-22 01:56:33.516468+00 |
| description | Library to calculate the score of a hand in riichi mahjong |
| homepage | |
| repository | https://github.com/SakaiTaka23/riichi-calc |
| max_upload_size | |
| id | 1491615 |
| size | 288,087 |
Library to calculate the score of a hand in riichi mahjong
let input = Input::new(
pi_input, // infomation about the pi in hand
field, // information about the field
status // player's status
);
// calculation function
let result = input.calc_hand();
if result.is_err() {
panic ! ("invalid input");
}
let result = result.unwrap();
expected output
Output {
winning_hand: WinningHand {
hand: [
Janto(
Tile {
number: 9,
tile_type: Souzu,
},
),
Shuntsu(
Tile {
number: 5,
tile_type: Souzu,
},
false,
),
Shuntsu(
Tile {
number: 1,
tile_type: Manzu,
},
false,
),
Shuntsu(
Tile {
number: 5,
tile_type: Manzu,
},
false,
),
Shuntsu(
Tile {
number: 2,
tile_type: Pinzu,
},
false,
),
],
winning_tile: Tile {
number: 5,
tile_type: Souzu,
},
red_tile: 0,
},
found_result: FoundYaku(
FoundYaku {
dora: [
(
"ドラ",
1,
),
(
"裏ドラ",
1,
),
],
ii_han: [
(
"立直",
1,
),
(
"平和",
1,
),
],
ryan_han: [],
san_han: [],
roku_han: [],
},
),
score_result: ScoreResult {
points: Ron(
11600,
),
actual_points: Ron(
12200,
),
detail: ScoreDetail {
han: 4,
fu: 30,
},
},
}