| 1 | package Game::Go::Engine; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 26 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 26 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 26 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 26 | our $VERSION = '0.02'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 26 | require XSLoader; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 26 | XSLoader::load('Game::Go', $VERSION); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 26 | ▶ | use Game::Go::Rules; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 494 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 494 | my ($class, %o) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 494 | ▶ | my $size = defined $o{size} ? $o{size} : 19; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 494 | ▶ | die "Game::Go::Engine: size must be an integer from 2 to 19, not '$size'" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$size =~ /\A[0-9]+\z/ and $size >= 2 and $size <= 19
$size =~ /\A[0-9]+\z/ and $size >= 2
MC/DC66%2/3
$size =~ /\A[0-9]+\z/ and $size >= 2 and $size <= 19
$size =~ /\A[0-9]+\z/
$size >= 2
$size <= 19
Truth table75%3/4
A and B and C
A= $size =~ /\A[0-9]+\z/B= $size >= 2C= $size <= 19
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | unless $size =~ /\A[0-9]+\z/ && $size >= 2 && $size <= 19; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 492 | my $self = bless { ptr => _new_board($size), size => $size }, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 492 | ▶ | my $want = exists $o{history} ? $o{history} : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 492 | ▶ | if ($want) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 485 | $self->{hist} = _new_hist($size); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 485 | _hist_push($self->{hist}, $self->{ptr}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 492 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 22 | ▶ | sub clone { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 22 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 22 | my $new = bless { ptr => _copy_board($self->{ptr}), size => $self->{size} }, ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 22 | ▶ | $new->{hist} = _copy_hist($self->{hist}) if $self->{hist}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 22 | return $new; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 4402 | ▶ | sub _hist { $_[0]{hist} || 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_hist: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 776 | ▶ | sub size { _size_of($_[0]{ptr}) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 5 | ▶ | sub stride { _stride_of($_[0]{ptr}) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stride: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 39519 | ▶ | sub point_of { _point_of($_[0]{ptr}, $_[1], $_[2]) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
point_of: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 3996 | ▶ | sub col_of { _col_of($_[0]{ptr}, $_[1]) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
col_of: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 3996 | ▶ | sub row_of { _row_of($_[0]{ptr}, $_[1]) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
row_of: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 21325 | ▶ | sub at { _at($_[0]{ptr}, $_[1]) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
at: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 240 | ▶ | sub libs { _libs($_[0]{ptr}, $_[1]) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
libs: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 578 | ▶ | sub chain_size { _chain_size($_[0]{ptr}, $_[1]) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chain_size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 502 | ▶ | sub chain_at { [ _chain_at($_[0]{ptr}, $_[1]) ] } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chain_at: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 72 | ▶ | sub stones { _stones($_[0]{ptr}, $_[1]) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stones: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 13 | ▶ | sub pack_position { _pack($_[0]{ptr}) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pack_position: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 29 | ▶ | sub hash_hex { _hash_hex($_[0]{ptr}) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hash_hex: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 464 | ▶ | sub put { _put($_[0]{ptr}, $_[1], $_[2]); return $_[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
put: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 81 | ▶ | sub lift { _lift($_[0]{ptr}, $_[1]) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lift: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 1797 | ▶ | sub zobrist_hex { _zobrist_hex($_[1], $_[2]) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
zobrist_hex: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 89 | ▶ | sub legal { _legal($_[0]{ptr}, $_[0]->_hist, $_[1], $_[2]) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
legal: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 6 | ▶ | sub is_legal { _legal($_[0]{ptr}, $_[0]->_hist, $_[1], $_[2]) == Game::Go::Rules::OK } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_legal: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 890 | ▶ | sub legal_moves { [ _legal_moves($_[0]{ptr}, $_[0]->_hist, $_[1]) ] } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
legal_moves: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 3417 | ▶ | sub play { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
play: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 3417 | my ($self, $pt, $colour) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 3417 | my ($code, $ko, @caps) = _play($self->{ptr}, $self->_hist, $pt, $colour); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 3417 | ▶ | code => $code, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | ok => ($code == Game::Go::Rules::OK ? 1 : 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ko_point => $ko, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | caps => \@caps, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | ($code == Game::Go::Rules::OK ? () : (message => Game::Go::Rules::refusal($code))), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 313 | ▶ | sub pass { _pass($_[0]{ptr}, $_[1]); return $_[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pass: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 13 | ▶ | sub ko_point { _ko_point($_[0]{ptr}) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ko_point: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 2 | ▶ | sub ko_colour { _ko_colour($_[0]{ptr}) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ko_colour: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 28 | ▶ | sub superko { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
superko: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 28 | my ($self, $on) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 28 | ▶ | _set_superko($self->{ptr}, $on ? 1 : 0) if defined $on; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 28 | return _superko_on($self->{ptr}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 3 | ▶ | sub has_history { $_[0]{hist} ? 1 : 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_history: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 35 | ▶ | sub push_position { $_[0]{hist} ? _hist_push($_[0]{hist}, $_[0]{ptr}) : 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
push_position: called CC=2 SCAR=7.6
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 7 | ▶ | sub history_length { $_[0]{hist} ? _hist_len($_[0]{hist}) : 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
history_length: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 3 | ▶ | sub seen_position { $_[0]{hist} ? _hist_has($_[0]{hist}, $_[0]{ptr}) : 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
seen_position: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | ▶ | sub hash_after_hex { _hash_after_hex($_[0]{ptr}, $_[1], $_[2]) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hash_after_hex: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 70 | ▶ | sub alive { [ _alive($_[0]{ptr}, $_[1]) ] } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
alive: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 31 | ▶ | sub is_alive { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_alive: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 31 | my ($self, $pt) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 31 | my $colour = $self->at($pt); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 31 | ▶ | return 0 unless Game::Go::Rules::is_colour($colour); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 29 | my %alive = map { $_ => 1 } @{ $self->alive($colour) }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 29 | ▶ | return $alive{$pt} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 64 | ▶ | sub score { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
score: called CC=6 SCAR=18.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 64 | my ($self, %o) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | return { _score( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | $self->{ptr}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | $o{dead} || [], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | $o{seki} || [], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | $o{prisoners_b} || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | $o{prisoners_w} || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 64 | ▶ | defined $o{komi_tenths} ? $o{komi_tenths} : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%6/8
$o{'dead'} || []
$o{'seki'} || []
$o{'prisoners_b'} || 0
$o{'prisoners_w'} || 0
MC/DC0%0/1
$o{'dead'} || []
$o{'dead'}
MC/DC0%0/1
$o{'seki'} || []
$o{'seki'}
MC/DC100%1/1
$o{'prisoners_b'} || 0
$o{'prisoners_b'}
MC/DC100%1/1
$o{'prisoners_w'} || 0
$o{'prisoners_w'}
Truth table50%1/2
A
A= $o{'dead'}
Truth table50%1/2
A
A= $o{'seki'}
Truth table100%2/2
A
A= $o{'prisoners_b'}
Truth table100%2/2
A
A= $o{'prisoners_w'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 2 | ▶ | sub area_score { my ($self) = @_; return { _score_area($self->{ptr}) } } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
area_score: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | ▶ | sub territory_map { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
territory_map: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 1 | my ($self, %o) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 1 | ▶ | return { _territory($self->{ptr}, $o{dead} || [], $o{seki} || []) }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$o{'dead'} || []
$o{'seki'} || []
MC/DC0%0/1
$o{'dead'} || []
$o{'dead'}
MC/DC0%0/1
$o{'seki'} || []
$o{'seki'}
Truth table50%1/2
A
A= $o{'dead'}
Truth table50%1/2
A
A= $o{'seki'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub prng_next { _prng_next($_[-1]) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prng_next: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 120 | ▶ | sub playout { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
playout: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 120 | my ($self, %o) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 120 | ▶ | my ($diff, $moves) = _playout($self->{ptr}, $o{colour}, $o{seed} || 1); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$o{'seed'} || 1
MC/DC0%0/1
$o{'seed'} || 1
$o{'seed'}
Truth table50%1/2
A
A= $o{'seed'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 120 | return { diff => $diff, moves => $moves, cap => 3 * $self->size * $self->size }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 799 | ▶ | sub search { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
search: called CC=5 SCAR=18.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 799 | my ($self, %o) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | return { _search( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | $self->{ptr}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | $o{colour}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | $o{allowed} || [], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | $o{seed} || 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | $o{playouts} || 100, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 799 | ▶ | defined $o{explore} ? $o{explore} : 700, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$o{'allowed'} || []
$o{'seed'} || 1
$o{'playouts'} || 100
MC/DC0%0/1
$o{'allowed'} || []
$o{'allowed'}
MC/DC0%0/1
$o{'seed'} || 1
$o{'seed'}
MC/DC0%0/1
$o{'playouts'} || 100
$o{'playouts'}
Truth table50%1/2
A
A= $o{'allowed'}
Truth table50%1/2
A
A= $o{'seed'}
Truth table50%1/2
A
A= $o{'playouts'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 22 | ▶ | sub dead_guess { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dead_guess: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 22 | my ($self, %o) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 22 | ▶ | return [ _dead_guess($self->{ptr}, $o{seed} || 1, $o{playouts} || 50) ]; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$o{'seed'} || 1
$o{'playouts'} || 50
MC/DC0%0/1
$o{'seed'} || 1
$o{'seed'}
MC/DC0%0/1
$o{'playouts'} || 50
$o{'playouts'}
Truth table50%1/2
A
A= $o{'seed'}
Truth table50%1/2
A
A= $o{'playouts'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 514 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 514 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 514 | ▶ | _drop_board(delete $self->{ptr}) if $self->{ptr}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 514 | ▶ | _drop_hist(delete $self->{hist}) if $self->{hist}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 514 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 26 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||