lpst.pl - added comments. cell drawing now aware of row+column

This commit is contained in:
gashapwn 2021-04-04 01:10:13 +00:00
parent 6fefa7125c
commit 5bf5dc8d3f

62
lpst.pl
View File

@ -206,15 +206,21 @@ my $EMPTY_CELL = 900;
my %board;
sub disp_1(){
return $HEX_1
# Display lines
#==================================================
sub disp_1($$){
my ($r0, $c0) = (shift, shift);
return $HEX_1;
}
sub disp_2(){
return $HEX_2
sub disp_2($$){
my ($r0, $c0) = (shift, shift);
return $HEX_2;
}
sub disp_3(){
sub disp_3($$){
my ($r0, $c0) = (shift, shift);
return $HEX_3;
}
@ -232,12 +238,15 @@ sub disp_y_axis($$$$){
return ($s0, $s1, $s2);
}
# Display cell
#==================================================
sub add_cell($$$$$){
my ($s0, $s1, $s2, $r0, $c0) = @_;
$s0 .= disp_1();
$s1 .= disp_2();
$s2 .= disp_3();
$s0 .= disp_1($r0, $c0);
$s1 .= disp_2($r0, $c0);
$s2 .= disp_3($r0, $c0);
return ($s0, $s1, $s2);
}
@ -249,7 +258,10 @@ sub disp_0($){
$r0 = shift;
# Append the y axis
($s0, $s1, $s2) = disp_y_axis($s0, $s1, $s2, $r0);
# Iterate through the cells
for my $i (1..11){
($s0, $s1, $s2) = add_cell($s0, $s1, $s2, $r0, $i);
}
@ -257,6 +269,9 @@ sub disp_0($){
return $s0."\n".$s1."\n".$s2."\n";
}
# Display row
#==================================================
sub disp_row($){
my $row;
my $r0;
@ -264,6 +279,8 @@ sub disp_row($){
$r0 = shift;
$row = disp_0($r0);
# Handle trailing characters
if($r0 % 2 == 1){
# Trim the start of the first line
$row =~ s/$TRAIL_1/ /;
@ -277,19 +294,6 @@ sub disp_row($){
return $row;
}
sub disp_x_axis(){
my $s0;
$s0 = $PAD_AXIS;
$s0 .= join(
$PAD_AXIS, map{
$AXIS_RV{$_}
}(1..11));
$s0 .= "\n";
return $s0
}
sub disp_trailing_row(){
my $s0;
my $s1;
@ -314,6 +318,22 @@ sub disp_trailing_row(){
return $s0;
}
sub disp_x_axis(){
my $s0;
$s0 = $PAD_AXIS;
$s0 .= join(
$PAD_AXIS, map{
$AXIS_RV{$_}
}(1..11));
$s0 .= "\n";
return $s0
}
# Display board
#==================================================
sub disp_board(){
my $b;