LPST.pm - refactored into a class ntvl.pl - created a test board

This commit is contained in:
gashapwn 2021-04-06 23:29:45 +00:00
parent bd10b2ae4d
commit e3c07ef59f
2 changed files with 56 additions and 31 deletions

43
LPST.pm
View File

@ -107,7 +107,7 @@ sub new {
return bless $self, $class; return bless $self, $class;
} }
package main; package LPST;
# #
# /--\ +1 # /--\ +1
@ -704,37 +704,30 @@ sub get_block_cell($){
} keys(%board); } keys(%board);
} }
sub new {
my $class = shift;
my $self = { @_ };
# Creates a hash of the the form
# Main starts here! # $board{cell_notation} = piece_enum
#================================================== %board = map {
binmode(STDOUT, ":utf8");
# Creates a hash of the the form
# $board{cell_notation} = piece_enum
%board = map {
$_ => $EMPTY_CELL $_ => $EMPTY_CELL
} map { } map {
my $l0; my $l0;
$l0 = $_; $l0 = $_;
(map {$l0.$_} ("1".."11")) (map {$l0.$_} ("1".."11"))
} map { } map {
$AXIS_RV{$_} $AXIS_RV{$_}
}(1...11); }(1...11);
# my $m1 = "F7"; return bless $self, $class;
my $m1 = "C10";
my $m2 = "B3";
my $c1 = $MG_SY;
my $c2 = $MG_A;
$board{$m1} = $P1.$DIV.$c1;
$board{$m2} = $P2.$DIV.$c2;
for my $el (get_block_cell($P1)){
printf("%s\n", $el);
} }
shade_all_mvmt($P1); return 1;
disp_board();
# Is this needed?
# binmode(STDOUT, ":utf8");

32
ntvl.pl Normal file
View File

@ -0,0 +1,32 @@
#!/usr/bin/perl
package main;
use warnings;
use strict;
use lib './';
use LPST;
my $b;
# my $m1 = "F7";
# my $m1 = "C10";
# my $m2 = "B3";
# my $c1 = $MG_SY;
# my $c2 = $MG_A;
# $board{$m1} = $P1.$DIV.$c1;
# $board{$m2} = $P2.$DIV.$c2;
# for my $el (get_block_cell($P1)){
# printf("%s\n", $el);
# }
# shade_all_mvmt($P1);
# disp_board();
$b = LPST->new();
$b->shade_all_mvmt("P1");
$b->disp_board();