2021-04-06 19:29:45 -04:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
package main;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use lib './';
|
|
|
|
use LPST;
|
|
|
|
|
|
|
|
my $b;
|
|
|
|
|
2021-04-07 10:40:39 -04:00
|
|
|
# Move types
|
|
|
|
my $SUMMON = 0b00000001;
|
|
|
|
my $MOVE = 0b00000010;
|
|
|
|
my $CAPTURE = 0b00000100;
|
|
|
|
my $SACRIFICE = 0b00001000;
|
|
|
|
# my $SPELL = 0b10000000;
|
|
|
|
my $DRAW = 0b01000000;
|
2021-04-06 19:29:45 -04:00
|
|
|
|
2021-04-07 10:40:39 -04:00
|
|
|
sub mt1($$){
|
|
|
|
my ($s0, $tc) = (shift, shift);
|
|
|
|
|
|
|
|
return $SUMMON if $s0 =~ /\*/;
|
|
|
|
return $MOVE if $s0 =~ /([A-Za-z]{1,2}[0-9]{1,2}){2}/;
|
|
|
|
return $CAPTURE if $s0 =~ /\~/;
|
|
|
|
return $SACRIFICE if $s0 =~ /([A-Za-z]{1,2}[0-9]{1,2}' ?){2}/;
|
|
|
|
|
|
|
|
return $DRAW if $tc <= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub f2($$$){
|
|
|
|
my ($s0, $tc, $apl) = (shift, shift, shift);
|
|
|
|
my $mt0;
|
|
|
|
|
2021-04-07 19:45:14 -04:00
|
|
|
return LPST->P2 if $apl eq LPST->P1;
|
|
|
|
return LPST->P1;
|
2021-04-07 10:40:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
sub f1($){
|
|
|
|
my $ns0 = shift;
|
|
|
|
my $apl;
|
|
|
|
my $tc;
|
|
|
|
|
|
|
|
$apl = LPST->P1;
|
2021-04-06 19:29:45 -04:00
|
|
|
|
2021-04-07 10:40:39 -04:00
|
|
|
$tc = 0;
|
|
|
|
|
|
|
|
for my $s0 (split(/\n/, $ns0)){
|
2021-04-07 19:45:14 -04:00
|
|
|
# $mt0 = mt1($s0, $tc);
|
2021-04-07 10:40:39 -04:00
|
|
|
$apl = f2($s0, $tc, $apl);
|
|
|
|
# printf(">>%s\n", $s0);
|
|
|
|
$tc++;
|
|
|
|
}
|
2021-04-07 19:45:14 -04:00
|
|
|
}
|
2021-04-06 19:29:45 -04:00
|
|
|
|
2021-04-07 10:40:39 -04:00
|
|
|
my $ns0;
|
2021-04-06 19:29:45 -04:00
|
|
|
|
2021-04-07 10:40:39 -04:00
|
|
|
$ns0 = "";
|
|
|
|
$ns0 .= "A I It Au\n";
|
|
|
|
$ns0 .= "H S Im Im\n";
|
|
|
|
|
|
|
|
f1($ns0);
|
|
|
|
|
|
|
|
|
|
|
|
my $m1 = "C10";
|
|
|
|
my $m2 = "B3";
|
|
|
|
my $c1 = LPST->MG_SY;
|
|
|
|
my $c2 = LPST->MG_A;
|
|
|
|
|
2021-04-07 19:45:14 -04:00
|
|
|
$b = LPST->new();
|
2021-04-07 10:40:39 -04:00
|
|
|
|
|
|
|
# $board{$m1} = $P1.$DIV.$c1;
|
|
|
|
# $board{$m2} = $P2.$DIV.$c2;
|
2021-04-06 19:29:45 -04:00
|
|
|
|
2021-04-06 20:35:47 -04:00
|
|
|
# $b->shade_all_p1_mvmt();
|
2021-04-07 19:45:14 -04:00
|
|
|
$b->disp_board();
|