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
36
lpst.pl
36
lpst.pl
@ -41,6 +41,12 @@ my $MG_AU = "Au"; # Automaton
|
||||
my $MG_SY = "Sy"; # Sylph
|
||||
my $MG_Q = "Q"; # Queen
|
||||
|
||||
# Players
|
||||
my $P1 = "P1";
|
||||
my $P2 = "P2";
|
||||
|
||||
my $DIV = ":";
|
||||
|
||||
my %AXIS = (
|
||||
"A" => 1,
|
||||
"B" => 2,
|
||||
@ -201,10 +207,24 @@ my %MOVE = (
|
||||
);
|
||||
|
||||
# Special cells
|
||||
my $EMPTY_CELL = 900;
|
||||
my $EMPTY_CELL = "_";
|
||||
|
||||
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
|
||||
#==================================================
|
||||
@ -216,7 +236,13 @@ sub disp_1($$){
|
||||
|
||||
sub disp_2($$){
|
||||
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($$){
|
||||
@ -365,7 +391,11 @@ sub cell_index($){
|
||||
$AXIS_RV{$_}
|
||||
}(1...11);
|
||||
|
||||
disp_board();
|
||||
$board{1}{1} = $P1.$DIV.$MG_A;
|
||||
|
||||
|
||||
printf("%s\n", $board{3}{3});
|
||||
# disp_board();
|
||||
|
||||
# disp_0("C1");
|
||||
# printf(">>%s, %s\n", cell_index("C1"));
|
||||
|
Loading…
Reference in New Issue
Block a user