Skip to content

Releases: DrCheeseFace/mahc

v2.2.0

25 Jan 22:59

Choose a tag to compare

FIX get_valid_handshapes handles aka now

Previously, the get_valid_handshapes function would not work if any of the tiles were aka. This is because five and akafive are treated as completely different tiles value wise (wrongly). So heres the fix.

Full Changelog: 2.1.0...v2.2.0

v2.1.0

30 Dec 20:23

Choose a tag to compare

What's Changed

  • UPDATED LICENSE. WAS MIT, NOW BSD 3-CLAUSE !!!!!!!!!!!!!!!!!
  • fix: detect Chuuren Poutou when extra tile is 1 or 9 by @ryblogs in #35
    previously the implementation required exactly 2 triplets + 2 sequences, which only matches when the extra tile is 2-8. Hands with extra 1 or 9 decompose as 1 triplet + 3 sequences, causing false negatives.
    eg:
# Extra 1: fails
mahc --tiles 123p 456p 789p 999p 11p -w 1p -p Ew -s Ew
# -> 8 han (Chinitsu + Ittsuu)
  • Fix chuurenpoutou9sided by @ryblogs in #37
    previously the 9 sided wait was bugged like below
❯ cargo run -- --tiles 123p 456p 789p 999p 11p -w 1p -p Ew -s Ew
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/debug/mahc --tiles 123p 456p 789p 999p 11p -w 1p -p Ew -s Ew`

123p 456p 789p 999p 11p | 1p

Dealer: 96000 (32000)
Non-dealer: 64000 (16000/32000)
Yaku:
  ChuurenPoutou Yakuman: 1
  ChuurenPoutou Yakuman 9 sided wait: 1 <------ THIS IS WRONG
  • fix is_chiihou, previously was the same as is_tenhou (checking for seat_tile as dealer). now checking for non dealer seat_tile

New Contributors

Full Changelog: v1.16.2...2.1.0

v1.16.2

16 Jul 16:47

Choose a tag to compare

The bugs are back

  • tile group counts were previously not taken into consideration when analyzing possible hand shapes

before fix

❯ cargo build && ./target/debug/mahc --tiles 1m 1m 1m 1m 2m 2m 2m 2m 3m 3m 3m 3m 4m 4m  --analyse-tiles
   Compiling mahc v1.16.1 (/home/tharun/projects/C/drdoom/mahc)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.21s

Handshapes found
11m 123m 123m 234m 234m
111m 123m 222m 333m 44m
1111m 2222m 3333m 44m <- that aint right (only 4 tile groups)
123m 123m 123m 123m 44m

after fix

❯ cargo build && ./target/debug/mahc --tiles 1m 1m 1m 1m 2m 2m 2m 2m 3m 3m 3m 3m 4m 4m  --analyse-tiles
   Compiling mahc v1.16.2 (/home/tharun/projects/C/drdoom/mahc)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.54s

Handshapes found
11m 123m 123m 234m 234m
111m 123m 222m 333m 44m
123m 123m 123m 123m 44m

Full Changelog: v1.16.1...v1.16.2

dracula-flow

ion need to see the pricetag anyway

v1.16.1

12 Jul 20:25

Choose a tag to compare

we have to go deeper neo

What's Changed

  • optimized the cluck out of the analyse functionality

image

v1.16.0

22 Apr 07:05
94d44ff

Choose a tag to compare

2024 edition be like

What's Changed

image

Full Changelog: v1.15.0...v1.16.0

v1.15.0

13 Apr 16:25

Choose a tag to compare

Analyse tiles for hand shapes and bug fixes

O(n^^^^^^n)

~/$ mahc --tiles 1p 2p 3p 1p 2p 3p 1p 2p 3p rd rd rd rd Ew Ew -w Ew --analyse-tiles

> Handshapes found
  111p 222p 333p EEw rrrrd
  123p 123p 123p EEw rrrrd

~/$ mahc --tiles 1p 2p 3p 1p 2p 3p 1p 2p 3p rd rd rd rd Ew Ew -w Ew --analyse-tiles --json

> {"hands":["111p 222p 333p EEw rrrrd ","123p 123p 123p EEw rrrrd "]}

aint that neat!
This probably has alot of hidden bugs and the way we find valid hand shapes is HIGHLY unoptimized. This can be improved in the future.

TileGroup sequence validation fix

There was a case where sequences like ESWw were valid. Whoops (They have incrementing "values" in the dora sense but this can't be used when finding if a tilegroup is considered a sequence or not).

What's Changed

Full Changelog: v1.14.0...v1.15.0

v1.13.0

10 Apr 13:54
42a6602

Choose a tag to compare

Json err and Tilegroup wants more privacy

Huzzah, if the --json tag is provided, the error will also be in json format

{ "Error": "this is an err" }

TileGroup attributes no longer public. They can be accessed via the get methods

pub struct TileGroup {
    tiles: Vec<Tile>,
    isopen: bool,
    group_type: GroupType,
}

What's Changed

Full Changelog: v1.12.0...v1.13.0

v1.11.1

08 Apr 16:45

Choose a tag to compare

Fixes and Refactors

The calc module now looks like this

calc::calculate(); //Calculate the payment amounts from the han, fu, and number of honba (repeat counters).
calc::calculate_yaku_payment(); //Calculate the payment amounts from the list of yaku.
calc::get_hand_score(); //Get the score breakdown of the hand.
calc::get_yaku(); 
calc::get_yaku_and_yakuman();
calc::get_yakuman(); 
calc::validate_scoring_conditions(); //validate_scoring_conditions Checks for invalid scoring conditions

fancy I know

The yakuman Daisuushii is now a double yakuman instead of single

Self::Daisuushii => 2

Separated CalcErr and HandErr

pub enum CalcErr {
    HandErr(HandErr),
    NoHandTiles,
    NoWinTile,
    DuplicateRiichi,
    IppatsuWithoutRiichi,
    DoubleRiichiHaiteiIppatsu,
    DoubleRiichiHaiteiChankan,
    ChankanTsumo,
    RinshanKanWithoutKan,
    RinshanWithoutTsumo,
    RinshanIppatsu,
    NoHan,
    NoFu,
    NoYaku,
}

pub enum HandErr {
    InvalidGroup,
    InvalidSuit,
    InvalidShape,
    InvalidTile,
    ParseErr,
}

What's Changed

  • feat!: refactor score module and changes daisuushi to double yakuman by @DrCheeseFace in #24

Full Changelog: v1.10.1...v1.11.1

v1.10.0

07 Apr 13:47

Choose a tag to compare

Validation fixes and score condition validation

Where the pair?

is_shousuushi wasn't checking for a wind pair. now it does!

Validate me good

new calc::validate_scoring_conditions method. GO CRAZY

pub fn validate_scoring_conditions(
    hand: &Hand,
    tsumo: bool,
    riichi: bool,
    doubleriichi: bool,
    ippatsu: bool,
    haitei: bool,
    rinshan: bool,
    chankan: bool,
) -> Option<HandErr> {

What's Changed

mahjong-riichi

Full Changelog: v1.9.3...v1.10.0

v1.9.2

06 Apr 14:27

Choose a tag to compare

I forgot to move the consts into their modules ;[

Its there now atleast

from tile module

pub const EAST_VALUE: char = 'E';
pub const SOUTH_VALUE: char = 'S';
.
.
.

from suit module

pub const MAN_SUIT_CHAR: char = 'm';
pub const PIN_SUIT_CHAR: char = 'p';
pub const SOU_SUIT_CHAR: char = 's';
pub const DRAGON_SUIT_CHAR: char = 'd';
pub const WIND_SUIT_CHAR: char = 'w';
pub const Z_SUIT_CHAR: char = 'z';

from tile_group module

pub const OPEN_CHAR: char = 'o';