Browse Source

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

master
gashapwn 3 years ago
parent
commit
441c390b09
1 changed files with 34 additions and 4 deletions
  1. +34
    -4
      lpst.pl

+ 34
- 4
lpst.pl View File

@@ -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($$){
@@ -361,11 +387,15 @@ sub cell_index($){
my $l0;
$l0 = $_;
(map {$l0.$_} ("1".."11"))
} map{
} map {
$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…
Cancel
Save