NAME

Game::Shogi::Result - how a game of shogi ended

SYNOPSIS

my $board = Game::Shogi::Engine->new(sfen => $sfen);
if (my $r = $board->outcome) {
    printf "%s wins: %s, after %d plies\n", $r->winner, $r->how, $r->ply;
}

DESCRIPTION

A value: who won, how, and after how many plies. Game::Shogi::Engine hands one back from outcome and resign.

ATTRIBUTES

how

mate, when the side to move is in check and has no legal move; no_move, when it has no legal move and is not in check, which is a loss in shogi and not a draw; resign; sennichite, a draw by the fourth repetition of a position; perpetual_check, a loss for the side that kept checking through it; impasse_declared, a win by the impasse declaration; or cap, a draw at the move cap.

winner

'b' or 'w', or undef for a draw.

ply

How many plies had been played: the board's move number less one.

METHODS

loser

The other side, or undef for a draw.

is_draw

True when nobody won.

AUTHOR

LNATION <email@lnation.org>

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION <email@lnation.org>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)