-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdriver.pl
More file actions
53 lines (42 loc) · 857 Bytes
/
driver.pl
File metadata and controls
53 lines (42 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/perl
system("cp board.txt brd_a");
$time = 10;
$result = 5;
while ($result == 5)
{
system("cat brd_a");
$move = `cat brd_a | ./playerA $time`;
chop($move);
$result = `./verifier $move brd_a brd_b`;
chop($result);
print "A made move: $move\n";
if ($result == 0)
{
die "B won!\n";
}
elsif ($result == 1)
{
die "Draw!\n";
}
elsif ($result == 2)
{
die "A won!\n";
}
$move = `cat brd_b | ./playerB $time`;
chop($move);
$result = `./verifier $move brd_b brd_a`;
chop($result);
print "B made move: $move\n";
if ($result == 0)
{
die "A won!\n";
}
elsif ($result == 1)
{
die "Draw!\n";
}
elsif ($result == 2)
{
die "B won!\n";
}
};