| 1 | package Game::TileMap::Pathfinding::Result; | ||
| 2 | 3 | $Game::TileMap::Pathfinding::Result::VERSION = '0.002'; | |
| 3 | 3 | ▶ | use v5.14; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | sub new | ||
| 7 | 11 | ▶ | { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 8 | 11 | return bless $_[1], $_[0]; | |
| 9 | } | ||
| 10 | |||
| 11 | sub next_step | ||
| 12 | 5 | ▶ | { |
|
Subroutine
next_step: called CC=1 SCAR=0.0
Pod
documented
| |||
| 13 | 5 | return splice @{$_[0]}, 0, 2; | |
| 14 | } | ||
| 15 | |||
| 16 | sub step_count | ||
| 17 | 7 | ▶ | { |
|
Subroutine
step_count: called CC=1 SCAR=0.0
Pod
documented
| |||
| 18 | 7 | return @{$_[0]} / 2; | |
| 19 | } | ||
| 20 | |||
| 21 | sub steps | ||
| 22 | 3 | ▶ | { |
|
Subroutine
steps: called CC=2 SCAR=6.9
Pod
documented
| |||
| 23 | 3 | my ($self) = @_; | |
| 24 | |||
| 25 | 3 | my @all; | |
| 26 | 3 | for my $i (map { $_ * 2 } 0 .. $self->step_count - 1) { | |
| 27 | 14 | push @all, [@{$self}[$i, $i + 1]]; | |
| 28 | } | ||
| 29 | |||
| 30 | 3 | return @all; | |
| 31 | } | ||
| 32 | |||
| 33 | 3 | 1; | |
| 34 | |||
| 35 | __END__ | ||