| 1 | package Game::Shogi::Notation; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use 5.014; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 7 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 7 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | ▶ | use Game::Shogi::Engine; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 7 | ▶ | use Game::Shogi::Move; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 7 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 7 | my $E = 'Game::Shogi::Engine'; | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 7 | my @FILE = (undef, qw(1 2 3 4 5 6 7 8 9)); | |||||||||||||||||||||||||||||||||||||||||
| 17 | 7 | my @RANK = (undef, qw(一 二 三 四 五 六 七 八 九)); | |||||||||||||||||||||||||||||||||||||||||
| 18 | 7 | my %NAME = ( | |||||||||||||||||||||||||||||||||||||||||
| 19 | P => '歩', L => '香', N => '桂', S => '銀', G => '金', B => '角', R => '飛', K => '玉', | ||||||||||||||||||||||||||||||||||||||||||
| 20 | '+P' => 'と', '+L' => '成香', '+N' => '成桂', '+S' => '成銀', '+B' => '馬', '+R' => '龍', | ||||||||||||||||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 7 | my %STRAIGHT = map { $_ => 1 } qw(S G +P +L +N +S); | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 183 | ▶ | sub _legal_set { my ($b) = @_; return { map { $_ => 1 } $b->legal } } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_legal_set: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 146 | ▶ | sub _rivals { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_rivals: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 146 | my ($b, $legal, $token, $to, $skip) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 146 | my @from; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 146 | for my $sq (0 .. 80) { | |||||||||||||||||||||||||||||||||||||||||
| 31 | 11826 | my $t = $b->at($sq); | |||||||||||||||||||||||||||||||||||||||||
| 32 | 11826 | ▶ | next unless defined $t && $t eq $token; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $t and $t eq $token
MC/DC100%2/2
defined $t and $t eq $token
defined $t
$t eq $token
Truth table100%3/3
A and B
A= defined $tB= $t eq $token
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 501 | my $name = $E->square_name($sq); | |||||||||||||||||||||||||||||||||||||||||
| 34 | 501 | ▶ | next if defined $skip && $name eq $skip; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $skip and $name eq $skip
MC/DC100%2/2
defined $skip and $name eq $skip
defined $skip
$name eq $skip
Truth table100%3/3
A and B
A= defined $skipB= $name eq $skip
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 360 | ▶ | push @from, $name if $legal->{"$name$to"} || $legal->{"$name$to+"}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$$legal{"$name$to"} or $$legal{"$name$to+"}
MC/DC50%1/2
$$legal{"$name$to"} or $$legal{"$name$to+"}
$$legal{"$name$to"}
$$legal{"$name$to+"}
Truth table66%2/3
A or B
A= $$legal{"$name$to"}B= $$legal{"$name$to+"}
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 146 | return @from; | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub _token_side { $_[0] =~ /[a-z]/ ? 'w' : 'b' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_token_side: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 118 | ▶ | sub hodges { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hodges: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 118 | my ($class, $b, $usi) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 44 | 118 | ▶ | my $m = Game::Shogi::Move->of($usi) or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 117 | my $legal = _legal_set($b); | |||||||||||||||||||||||||||||||||||||||||
| 46 | 117 | ▶ | return undef unless $legal->{$usi}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 116 | ▶ | return $m->drop . '*' . $m->to if $m->is_drop; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 81 | my $token = $b->at($E->square($m->from)); | |||||||||||||||||||||||||||||||||||||||||
| 50 | 81 | my $letter = uc $token; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 81 | ▶ | my $origin = _rivals($b, $legal, $token, $m->to, $m->from) ? $m->from : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 81 | ▶ | my $kind = defined $b->at($E->square($m->to)) ? 'x' : '-'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 81 | my $plain = $m->from . $m->to; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 81 | ▶ | my $status = $m->promote ? '+' : $legal->{"$plain+"} ? '=' : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 81 | return $letter . $origin . $kind . $m->to . $status; | |||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 91 | ▶ | sub _motion { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_motion: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 91 | my ($side, $from, $to) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 60 | 91 | my ($rf, $rt) = (ord(substr $from, 1) - 96, ord(substr $to, 1) - 96); | |||||||||||||||||||||||||||||||||||||||||
| 61 | 91 | ▶ | ($rf, $rt) = (-$rf, -$rt) if $side eq 'w'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 91 | ▶ | return $rt < $rf ? '上' : $rt > $rf ? '引' : '寄'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | 71 | ▶ | sub _rightness { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_rightness: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 71 | my ($side, $sq) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 71 | my $file = substr $sq, 0, 1; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 71 | ▶ | return $side eq 'b' ? -$file : $file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 24 | ▶ | sub _resolve { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_resolve: called CC=10 SCAR=23.0
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 24 | my ($side, $token, $mover, $to, @rivals) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 73 | 24 | my @all = ($mover, @rivals); | |||||||||||||||||||||||||||||||||||||||||
| 74 | 24 | my $move = _motion($side, $mover, $to); | |||||||||||||||||||||||||||||||||||||||||
| 75 | 24 | ▶ | return $move if 1 == grep { _motion($side, $_, $to) eq $move } @all; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 14 | ▶ | return '直' if $STRAIGHT{ uc $token } && $move eq '上' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$STRAIGHT{uc $token} and $move eq "\x{4e0a}" and substr($mover, 0, 1) eq substr($to, 0, 1)
$STRAIGHT{uc $token} and $move eq "\x{4e0a}"
MC/DC100%3/3
$STRAIGHT{uc $token} and $move eq "\x{4e0a}" and substr($mover, 0, 1) eq substr($to, 0, 1)
$STRAIGHT{uc $token}
$move eq "\x{4e0a}"
substr($mover, 0, 1) eq substr($to, 0, 1)
Truth table100%4/4
A and B and C
A= $STRAIGHT{uc $token}B= $move eq "\x{4e0a}"C= substr($mover, 0, 1) eq substr($to, 0, 1)
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | && substr($mover, 0, 1) eq substr($to, 0, 1); | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 12 | my $x = _rightness($side, $mover); | |||||||||||||||||||||||||||||||||||||||||
| 81 | 12 | my @x = map { _rightness($side, $_) } @all; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 12 | my ($max, $min) = ((sort { $b <=> $a } @x)[0], (sort { $a <=> $b } @x)[0]); | |||||||||||||||||||||||||||||||||||||||||
| 83 | 12 | ▶ | my $tag = $x == $max ? '右' : $x == $min ? '左' : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 12 | ▶ | if (defined $tag) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 11 | my @group = grep { _rightness($side, $_) == $x } @all; | |||||||||||||||||||||||||||||||||||||||||
| 86 | 11 | ▶ | return $tag if @group == 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 3 | ▶ | return $tag . $move if 1 == grep { _motion($side, $_, $to) eq $move } @group; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 1 | return '(' . substr($mover, 0, 1) . (ord(substr $mover, 1) - 96) . ')'; | |||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 66 | ▶ | sub japanese { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
japanese: called CC=13 SCAR=25.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 66 | my ($class, $b, $usi, %opt) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 66 | ▶ | my $m = Game::Shogi::Move->of($usi) or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 66 | my $legal = _legal_set($b); | |||||||||||||||||||||||||||||||||||||||||
| 96 | 66 | ▶ | return undef unless $legal->{$usi}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 65 | my $side = $b->side_to_move; | |||||||||||||||||||||||||||||||||||||||||
| 99 | 65 | ▶ | my $mark = $opt{marks} ? ($side eq 'b' ? '▲' : '△') : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 65 | my $to = $m->to; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 65 | ▶ | my $where = defined $opt{previous} && $opt{previous} eq $to | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $opt{"previous"} and $opt{"previous"} eq $to
MC/DC100%2/2
defined $opt{"previous"} and $opt{"previous"} eq $to
defined $opt{"previous"}
$opt{"previous"} eq $to
Truth table100%3/3
A and B
A= defined $opt{"previous"}B= $opt{"previous"} eq $to
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | ? '同' | ||||||||||||||||||||||||||||||||||||||||||
| 103 | : $FILE[ substr $to, 0, 1 ] . $RANK[ ord(substr $to, 1) - 96 ]; | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 65 | ▶ | if ($m->is_drop) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 5 | ▶ | my $token = $side eq 'w' ? lc $m->drop : $m->drop; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 5 | ▶ | my $held = _rivals($b, $legal, $token, $to) ? '打' : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 5 | return $mark . $where . $NAME{ $m->drop } . $held; | |||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 60 | my $token = $b->at($E->square($m->from)); | |||||||||||||||||||||||||||||||||||||||||
| 112 | 60 | my @rivals = _rivals($b, $legal, $token, $to, $m->from); | |||||||||||||||||||||||||||||||||||||||||
| 113 | 60 | ▶ | my $how = @rivals ? _resolve($side, $token, $m->from, $to, @rivals) : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 60 | my $plain = $m->from . $to; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 60 | ▶ | my $status = $m->promote ? '成' : $legal->{"$plain+"} ? '不成' : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 60 | return $mark . $where . $NAME{ uc $token } . $how . $status; | |||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | 8 | ▶ | sub record { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
record: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 8 | my ($class, $start, @moves) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 8 | ▶ | my $b = defined $start ? $E->new(sfen => $start) : $E->new; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 8 | my ($previous, @line); | |||||||||||||||||||||||||||||||||||||||||
| 123 | 8 | for my $i (0 .. $#moves) { | |||||||||||||||||||||||||||||||||||||||||
| 124 | 26 | my $usi = $moves[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 125 | 26 | my $fault = $b->move_fault($usi); | |||||||||||||||||||||||||||||||||||||||||
| 126 | 26 | ▶ | Carp::croak("Game::Shogi::Notation: move " . ($i + 1) . " ('" . ($usi // 'undef') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$usi // "undef"
MC/DC0%0/1
$usi // "undef"
$usi
Truth table50%1/2
A
A= $usi
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | . "') is not legal: " . $E->fault_reason($fault)) if $fault; | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 25 | ▶ | Carp::croak("Game::Shogi::Notation: move " . ($i + 1) . " comes after the game ended") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | if $b->outcome; | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 25 | push @line, { | |||||||||||||||||||||||||||||||||||||||||
| 131 | usi => $usi, | ||||||||||||||||||||||||||||||||||||||||||
| 132 | side => $b->side_to_move, | ||||||||||||||||||||||||||||||||||||||||||
| 133 | hodges => $class->hodges($b, $usi), | ||||||||||||||||||||||||||||||||||||||||||
| 134 | japanese => $class->japanese($b, $usi, previous => $previous, marks => 1), | ||||||||||||||||||||||||||||||||||||||||||
| 135 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 136 | 25 | $b->do_move($usi); | |||||||||||||||||||||||||||||||||||||||||
| 137 | 25 | $previous = Game::Shogi::Move->of($usi)->to; | |||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 7 | ▶ | start => defined $start ? $start : 'lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b - 1', | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | moves => \@line, | ||||||||||||||||||||||||||||||||||||||||||
| 142 | sfen => $b->sfen, | ||||||||||||||||||||||||||||||||||||||||||
| 143 | result => $b->outcome, | ||||||||||||||||||||||||||||||||||||||||||
| 144 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 104 | ▶ | sub replay { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replay: called CC=7 SCAR=19.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 104 | my ($class, $start, @moves) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 149 | 104 | ▶ | my $b = defined $start ? $E->new(sfen => $start) : $E->new; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | 104 | for my $i (0 .. $#moves) { | |||||||||||||||||||||||||||||||||||||||||
| 151 | 14846 | my $fault = $b->move_fault($moves[$i]); | |||||||||||||||||||||||||||||||||||||||||
| 152 | 14846 | ▶ | Carp::croak("Game::Shogi::Notation: move " . ($i + 1) . " ('" . ($moves[$i] // 'undef') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$moves[$i] // "undef"
MC/DC0%0/1
$moves[$i] // "undef"
$moves[$i]
Truth table50%1/2
A
A= $moves[$i]
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | . "') is not legal: " . $E->fault_reason($fault)) if $fault; | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 14844 | ▶ | Carp::croak("Game::Shogi::Notation: move " . ($i + 1) . " comes after the game ended") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | if $b->outcome; | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 14844 | $b->do_move($moves[$i]); | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 102 | ▶ | return wantarray ? ($b, $b->outcome) : $b; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | __END__ | ||||||||||||||||||||||||||||||||||||||||||