ritchie/engine/error
Errors produced by the engine.
Types
Reasons an action could be rejected.
pub type ActionError {
TsumogiriMismatch(tile.Tile, option.Option(tile.Tile))
DiscardClosedHandUnderRiichi
NoSwapCalling(tile.Tile, meld.Meld)
TileNotExist(tile.Tile)
DeclareRiichiAgain
DeclareRiichiWithoutPoints
DeclareRiichiWithOpenMeld
DeclareRiichiWhileNotReady
DiscardOnlyAfterChiiPon
CannotKanOnLastDraw
InvalidAnkanUnderRiichi(tile.Tile)
NotEnoughForAnkan(tile.Tile)
NoPonForKakan(tile.Tile)
NotEnoughKindsForNineKinds(Int)
NotInitAbortable
MustDeclareTsumoAgariOnDraw
CannotTsumoAgari
}
Constructors
-
TsumogiriMismatch(tile.Tile, option.Option(tile.Tile))Tsumogiri discard doesn’t match drawn tile
-
DiscardClosedHandUnderRiichiDiscard from closed hand while under riichi
-
Discard considered swap-calling
-
TileNotExist(tile.Tile)Tile doesn’t exist
-
DeclareRiichiAgainRedeclaring riichi when it’s already declared
-
DeclareRiichiWithoutPointsDeclaring riichi without the requisite amount of points
-
DeclareRiichiWithOpenMeldDeclaring riichi with an open hand
-
DeclareRiichiWhileNotReadyDeclaring riichi with a hand not ready after discarding
-
DiscardOnlyAfterChiiPonDiscard not after chii/pon
-
CannotKanOnLastDrawAttempting to call ankan/kakan on last draw
-
InvalidAnkanUnderRiichi(tile.Tile)Attempting invalid ankan under riichi
-
NotEnoughForAnkan(tile.Tile)Attempting ankan without enough tiles in hand
-
NoPonForKakan(tile.Tile)Attempting kakan without matching pon
-
NotEnoughKindsForNineKinds(Int)Declaring nine kinds of terminals/honors without enough of them in hand
-
NotInitAbortableAborting after first go-around
-
MustDeclareTsumoAgariOnDrawDeclaring tsumo-agari not on drawn tile
-
CannotTsumoAgariDeclaring tsumo-agari without ready hand/without yaku
Errors from the engine.
pub type EngineError {
RoundNotStarted
RoundEnded
NoActionRegistered
InvalidAction(ActionError)
InvalidReaction(ReactionError)
}
Constructors
-
RoundNotStartedNo round has been started yet
-
RoundEndedThe round has already ended
-
NoActionRegisteredNo action has been registered for the current turn
-
InvalidAction(ActionError)The action was rejected by validation
-
InvalidReaction(ReactionError)The reaction was rejected by validation
Reasons a reaction could be rejected.
pub type ReactionError {
TerminalAction
CannotReactToSelf
OpenMeldUnderRiichi
MeldOnLastDraw
NotDiscard(action.Action)
CanOnlyChiiPrevPlayer
InvalidChii(tile.Tile, tile.Tile, tile.Tile)
InvalidPon(tile.Tile, tile.Tile, tile.Tile)
InvalidDaiminkan
Furiten
CannotRonAgari
CannotRonAgariOverAnkan
}
Constructors
-
TerminalActionAction is terminal and no reactions are possible
-
CannotReactToSelfActing player cannot react to their own action
-
OpenMeldUnderRiichiCannot declare an open meld under riichi
-
MeldOnLastDrawCannot declare an open meld on the last draw
-
NotDiscard(action.Action)Can only call a discarded tile
-
CanOnlyChiiPrevPlayerChii can only be called on the previous player’s discard
-
Invalid chii with the given own tiles and called tile
-
Invalid pon with the given own tiles and called tile
-
InvalidDaiminkanInvalid daiminkan
-
FuritenCannot ron while under furiten
-
CannotRonAgariCannot ron, either not waiting, or no yaku
-
CannotRonAgariOverAnkanCannot ron over an ankan (with the exception of kokushi)