Releases: Kenny2github/mahjong
Releases · Kenny2github/mahjong
2.0.0rc3
New Stuff
Hand.discarderscontains aPlayerfor everyTileinHand.discarded
Changes
Numberno longer includesFlowerandSeasonTileand subclasses now have run-time typechecking on the number based on suitHand.playnow raises aRuntimeErrorif the hand is part of aRound
Fixes
(answerable).answercould returnNoneinstead of aHandEndingwhen running standalone fromHand- Annotated some attributes that were missing them
Hand.turncountcan no longer beNone, only 0FlowerandSeasonvalues were being set toWind.*instead of the integer values
2.0.0rc2
Fixes
- Update
__all__s in the various modules - Cleanup a little
2.0.0rc1
New Stuff
py -m mahjongnow takes a--gameargument to specify playing a whole game instead of the new default, one hand only.mahjong.melds.FLAG_FAANis a mapping from eachWuFlagto the amount of faan it's worth.Wu()now takes adiscarderargument beforeflagsrepresenting the seat of who pays the penalty for this hand being won. It is set as aWindtoWu.discarder.Wu.flagstakes the same arguments asWu.faanand computes only the situational flags. Faan calculation is still done inWu.faan.mahjong.melds.faanis a simple function that computes faan from flags, usingFLAG_FAAN.- Bonus-related
WuFlags. HandEnding.faancombinesWu.faanandPlayer.faansince it has access to both, as well as seat and prevailing winds.HandEnding.pointscalculates the points that each player owes or receives, as well as still returning the flags.mahjong.game.STOCK_TABLESare some stock faan-to-points translation tables to pass toHandEnding.points. The default isSTOCK_TABLES['random_app'].Question.SELF_DRAW_Qis now asked to confirm whether to commit to a self-draw, instead of just seizing upon it by default.- A
Handcan be instantiated on its own now:- with a
Roundsubclass if the instantiator has control over such machinery. - with a list of
Players if the instantiator has control over the machinery by means of something other than aRoundsubclass. - with
Noneif theHandis to be played standalone, in which caseHand.playis the entry point instead ofGame.play.
- with a
WuFlag.TWELVE_PIECE,GAVE_DRAGON,GAVE_KONG, and support for such penalties (including inHandEnding.points).
Changes
py -m mahjongnow plays only one hand by defaultWuFlagvalues are now hardcoded instead ofauto- Swapped
WuFlag.NINE_GATESto1 << 9andWuFlag.THIRTEEN_ORPHANSto1 << 13because it just makes sense that way - Renamed
Wu.flagstoWu.base_flags - Just use *args and **kwargs in
Wu.from_strfor the extra arguments - Separated faan calculation from flags computation. This has little effect on
Wu.faan; the most significant is that mutually exclusive flags are now actually mutually excluded, rather than just the faan being reduced to compensate. - Things that were nominally
ints but semanticallyWinds are now allWinds, except in some cases when passing them as arguments (in which case theWindconstructor is applied). Player.bonus_faannow returns both faan and flags of its ownHandEnding.gen: Generatoris nowHandEnding.hand: HandHand.roundis now OptionalHand.genandHand.playersare now set, to support playing a standalone hand- Stealing a tile from the previous player's discard is now confirmed by
Question.MELD_FROM_DISCARD_Qfor winning hands in addition to other melds - Removed internal
AnswerableABC
Fixes
Wu.base_flags(formerlyWu.flags) is now properly annotated- Thirteen Orphans are only valid if the extra tile is a duplicate of any of the other tiles, not when it's literally any tile. A set of valid Thirteen Orphans tiles will therefore equal a set of all Thirteen Orphans tiles.
_UncheckedWu.fixed_meldswas missing and caused anAttributeErrorwhen actually encountering Thirteen OrphansTile.from_strfailed to typecheck because ofsuitGame.playmight return aHandEndingon first go, though all wins should be confirmed first by now.