lpst.pl - added enums for player... tried to add a piece to a cell and board got fucked up... i think the hash that stores piece data is borked. will fix
This commit is contained in:
parent
36e02db08c
commit
441c390b09
38
lpst.pl
38
lpst.pl
@ -41,6 +41,12 @@ my $MG_AU = "Au"; # Automaton
|
|||||||
my $MG_SY = "Sy"; # Sylph
|
my $MG_SY = "Sy"; # Sylph
|
||||||
my $MG_Q = "Q"; # Queen
|
my $MG_Q = "Q"; # Queen
|
||||||
|
|
||||||
|
# Players
|
||||||
|
my $P1 = "P1";
|
||||||
|
my $P2 = "P2";
|
||||||
|
|
||||||
|
my $DIV = ":";
|
||||||
|
|
||||||
my %AXIS = (
|
my %AXIS = (
|
||||||
"A" => 1,
|
"A" => 1,
|
||||||
"B" => 2,
|
"B" => 2,
|
||||||
@ -201,10 +207,24 @@ my %MOVE = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
# Special cells
|
# Special cells
|
||||||
my $EMPTY_CELL = 900;
|
my $EMPTY_CELL = "_";
|
||||||
|
|
||||||
my %board;
|
my %board;
|
||||||
|
|
||||||
|
# Display pieces
|
||||||
|
#==================================================
|
||||||
|
|
||||||
|
sub f_1($){
|
||||||
|
my $p = shift;
|
||||||
|
my $s0;
|
||||||
|
|
||||||
|
$p =~ s/($P1|$P2)$DIV//;
|
||||||
|
$p .= "_" if length($p) < 2;
|
||||||
|
$s0 = $HEX_2;
|
||||||
|
$s0 =~ s/$SUB_CHR{1,2}/$p/;
|
||||||
|
|
||||||
|
return $s0;
|
||||||
|
}
|
||||||
|
|
||||||
# Display lines
|
# Display lines
|
||||||
#==================================================
|
#==================================================
|
||||||
@ -216,7 +236,13 @@ sub disp_1($$){
|
|||||||
|
|
||||||
sub disp_2($$){
|
sub disp_2($$){
|
||||||
my ($r0, $c0) = (shift, shift);
|
my ($r0, $c0) = (shift, shift);
|
||||||
return $HEX_2;
|
my $p;
|
||||||
|
|
||||||
|
$p = $board{$r0}{$c0};
|
||||||
|
|
||||||
|
return f_1($p);
|
||||||
|
# my ($r0, $c0) = (shift, shift);
|
||||||
|
# return $HEX_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub disp_3($$){
|
sub disp_3($$){
|
||||||
@ -361,11 +387,15 @@ sub cell_index($){
|
|||||||
my $l0;
|
my $l0;
|
||||||
$l0 = $_;
|
$l0 = $_;
|
||||||
(map {$l0.$_} ("1".."11"))
|
(map {$l0.$_} ("1".."11"))
|
||||||
} map{
|
} map {
|
||||||
$AXIS_RV{$_}
|
$AXIS_RV{$_}
|
||||||
}(1...11);
|
}(1...11);
|
||||||
|
|
||||||
disp_board();
|
$board{1}{1} = $P1.$DIV.$MG_A;
|
||||||
|
|
||||||
|
|
||||||
|
printf("%s\n", $board{3}{3});
|
||||||
|
# disp_board();
|
||||||
|
|
||||||
# disp_0("C1");
|
# disp_0("C1");
|
||||||
# printf(">>%s, %s\n", cell_index("C1"));
|
# printf(">>%s, %s\n", cell_index("C1"));
|
||||||
|
Loading…
Reference in New Issue
Block a user