Skip to content

Commit b77a712

Browse files
authored
Merge pull request #66 from Apricot-S/develop
v3.1.0
2 parents bf317f8 + 26dcc04 commit b77a712

File tree

5 files changed

+33
-34
lines changed

5 files changed

+33
-34
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "xiangting"
33
description = "A library for calculating the deficiency number (a.k.a. xiangting number, 向聴数)."
4-
version = "3.0.0"
4+
version = "3.1.0"
55
authors = ["Apricot S."]
66
edition = "2021"
77
license = "MIT"

src/bingpai.rs

+2-18
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,9 @@ use thiserror::Error;
88
/// 兵牌: Hand excluding melds (a.k.a. pure hand, 純手牌).
99
///
1010
/// Each element of the array represents the count of a specific tile in the hand.
11-
/// The correspondence between the index and the tile is shown in the table below.
11+
/// The correspondence between the index and the tile is the same as [`Tile`](crate::Tile).
1212
///
13-
/// | Index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
14-
/// | ----- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
15-
/// | Tile | 1m | 2m | 3m | 4m | 5m | 6m | 7m | 8m | 9m |
16-
///
17-
/// | Index | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18-
/// | ----- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
19-
/// | Tile | 1p | 2p | 3p | 4p | 5p | 6p | 7p | 8p | 9p |
20-
///
21-
/// | Index | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
22-
/// | ----- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
23-
/// | Tile | 1s | 2s | 3s | 4s | 5s | 6s | 7s | 8s | 9s |
24-
///
25-
/// | Index | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
26-
/// | ----- | --------- | ---------- | --------- | ---------- | ---------- | ---------- | -------- |
27-
/// | Tile | East (1z) | South (2z) | West (3z) | North (4z) | White (5z) | Green (6z) | Red (7z) |
28-
///
29-
/// See also [`InvalidShoupaiError`](crate::InvalidShoupaiError) for more information.
13+
/// See also [`InvalidBingpaiError`](crate::InvalidBingpaiError) for more information.
3014
///
3115
/// # Examples
3216
///

src/fulu_mianzi.rs

+1-15
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
// This file is part of https://github.com/Apricot-S/xiangting
44

55
use crate::constants::{MAX_SHUPAI_INDEX, MAX_TILE_INDEX, NUM_TILE_INDEX};
6+
use crate::tile::Tile;
67
use std::fmt;
78
use thiserror::Error;
89

9-
type Tile = u8;
10-
1110
/// Position of the claimed tile in the melded sequence.
1211
/// Used in [`FuluMianzi::Shunzi`](self::FuluMianzi::Shunzi).
1312
#[derive(Debug, Clone)]
@@ -42,11 +41,6 @@ pub enum ClaimedTilePosition {
4241
pub enum FuluMianzi {
4342
/// 順子: Sequence.
4443
///
45-
/// The first argument represents the index of the tile.
46-
/// The second argument represents the position of the claimed tile in the meld.
47-
/// The correspondence between the index and the tile is the same as
48-
/// [`Bingpai`](crate::Bingpai).
49-
///
5044
/// # Examples
5145
///
5246
/// ```
@@ -63,10 +57,6 @@ pub enum FuluMianzi {
6357
Shunzi(Tile, ClaimedTilePosition),
6458
/// 刻子: Triplet.
6559
///
66-
/// The argument represents the index of the tile.
67-
/// The correspondence between the index and the tile is the same as
68-
/// [`Bingpai`](crate::Bingpai).
69-
///
7060
/// # Examples
7161
///
7262
/// ```
@@ -77,10 +67,6 @@ pub enum FuluMianzi {
7767
Kezi(Tile),
7868
/// 槓子: Quad.
7969
///
80-
/// The argument represents the index of the tile.
81-
/// The correspondence between the index and the tile is the same as
82-
/// [`Bingpai`](crate::Bingpai).
83-
///
8470
/// # Examples
8571
///
8672
/// ```

src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ mod shisanyao;
4848
mod shoupai;
4949
#[cfg(not(feature = "build-file"))]
5050
mod standard;
51+
#[cfg(not(feature = "build-file"))]
52+
mod tile;
5153

5254
#[cfg(not(feature = "build-file"))]
5355
pub use bingpai::{Bingpai, InvalidBingpaiError};
@@ -57,6 +59,8 @@ pub use calculate::{calculate_replacement_number, calculate_replacement_number_3
5759
pub use fulu_mianzi::{ClaimedTilePosition, FuluMianzi, InvalidFuluMianziError};
5860
#[cfg(not(feature = "build-file"))]
5961
pub use shoupai::{FuluMianziList, InvalidShoupaiError};
62+
#[cfg(not(feature = "build-file"))]
63+
pub use tile::Tile;
6064

6165
#[cfg(feature = "build-map")]
6266
#[doc(hidden)]

src/tile.rs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// SPDX-FileCopyrightText: 2025 Apricot S.
2+
// SPDX-License-Identifier: MIT
3+
// This file is part of https://github.com/Apricot-S/xiangting
4+
5+
/// 牌: Tile.
6+
///
7+
/// The value represents the index of the tile.
8+
/// The correspondence between the index and the tile is shown in the table below.
9+
///
10+
/// | Index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
11+
/// | ----- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
12+
/// | Tile | 1m | 2m | 3m | 4m | 5m | 6m | 7m | 8m | 9m |
13+
///
14+
/// | Index | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
15+
/// | ----- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
16+
/// | Tile | 1p | 2p | 3p | 4p | 5p | 6p | 7p | 8p | 9p |
17+
///
18+
/// | Index | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
19+
/// | ----- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
20+
/// | Tile | 1s | 2s | 3s | 4s | 5s | 6s | 7s | 8s | 9s |
21+
///
22+
/// | Index | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
23+
/// | ----- | --------- | ---------- | --------- | ---------- | ---------- | ---------- | -------- |
24+
/// | Tile | East (1z) | South (2z) | West (3z) | North (4z) | White (5z) | Green (6z) | Red (7z) |
25+
pub type Tile = u8;

0 commit comments

Comments
 (0)