NAME

Game::Shogi::Move - a shogi move as a value

SYNOPSIS

my $m = Game::Shogi::Move->of('8h2b+');
print $m->from, ' ', $m->to, ' ', $m->promote, "\n";   # 8h 2b 1

my $d = Game::Shogi::Move->of_parts(drop => 'P', to => '5e');
print $d->usi, "\n";                                    # P*5e

DESCRIPTION

A move as USI writes it, and its parts. It says nothing about whether the move is legal anywhere: that is the board's question.

CONSTRUCTORS

new

Game::Shogi::Move->new(usi => '7g7f')

Croaks when the string is not a USI move.

of

Game::Shogi::Move->of($usi)

The move, or undef when the string is not one.

of_parts

Game::Shogi::Move->of_parts(from => '7g', to => '7f', promote => 0)
Game::Shogi::Move->of_parts(drop => 'P', to => '5e')

The move from its parts, or undef.

ATTRIBUTES

usi

The move as USI writes it: 7g7f, 8h2b+, P*5e.

METHODS

from

The square a board move leaves, or undef for a drop.

to

The square the move reaches.

promote

True when a board move promotes.

drop

The piece a drop puts down, in capitals, or undef for a board move.

is_drop

True for a drop.

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)