Skip to content

Commit 03c009f

Browse files
authored
Update starter.pl
Had to fix loading the trees and actions so that they cleared out each turn.
1 parent 22a632b commit 03c009f

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

starterAIs/starter.pl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,25 @@ sub loadTurn {
3232
chomp($t = <STDIN>);
3333
($game->{oppSun}, $game->{oppScore}, $game->{oppIsWaiting}) = split / /, $t;
3434

35-
chomp(my $number_of_trees = <STDIN>);
35+
chomp(my $number_of_trees = <>);
36+
my @trees;
3637
for my $i (0..$number_of_trees-1) {
3738
my $tree = new Tree();
38-
chomp($t = <STDIN>);
39+
chomp($t = <>);
3940
($tree->{cellIndex}, $tree->{size}, $tree->{isMine}, $tree->{isDormant}) = split / /, $t;
40-
push @{ $game->{trees} }, $tree;
41+
push @trees, $tree;
4142
}
42-
43-
chomp(my $number_of_actions = <STDIN>);
43+
$game->{trees} = \@trees;
44+
45+
chomp(my $number_of_actions = <>);
46+
my @actions;
4447
for my $i (0..$number_of_actions-1) {
45-
chomp($t = <STDIN>);
48+
chomp($t = <>);
4649
my $action = Action->parse($t);
47-
push @{ $game->{possActions} }, $action;
50+
push @actions, $action;
51+
#say STDERR $action->getAction();
4852
}
53+
$game->{possActions} = \@actions;
4954
}
5055

5156
######################## classes

0 commit comments

Comments
 (0)