LPST.pm - refactored into a class ntvl.pl - created a test board
This commit is contained in:
parent
bd10b2ae4d
commit
e3c07ef59f
53
LPST.pm
53
LPST.pm
@ -107,7 +107,7 @@ sub new {
|
||||
return bless $self, $class;
|
||||
}
|
||||
|
||||
package main;
|
||||
package LPST;
|
||||
|
||||
#
|
||||
# /--\ +1
|
||||
@ -704,37 +704,30 @@ sub get_block_cell($){
|
||||
} keys(%board);
|
||||
}
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $self = { @_ };
|
||||
|
||||
# Creates a hash of the the form
|
||||
# $board{cell_notation} = piece_enum
|
||||
%board = map {
|
||||
$_ => $EMPTY_CELL
|
||||
} map {
|
||||
my $l0;
|
||||
$l0 = $_;
|
||||
(map {$l0.$_} ("1".."11"))
|
||||
} map {
|
||||
$AXIS_RV{$_}
|
||||
}(1...11);
|
||||
|
||||
# Main starts here!
|
||||
#==================================================
|
||||
binmode(STDOUT, ":utf8");
|
||||
|
||||
# Creates a hash of the the form
|
||||
# $board{cell_notation} = piece_enum
|
||||
%board = map {
|
||||
$_ => $EMPTY_CELL
|
||||
} map {
|
||||
my $l0;
|
||||
$l0 = $_;
|
||||
(map {$l0.$_} ("1".."11"))
|
||||
} map {
|
||||
$AXIS_RV{$_}
|
||||
}(1...11);
|
||||
|
||||
# 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);
|
||||
return bless $self, $class;
|
||||
}
|
||||
|
||||
shade_all_mvmt($P1);
|
||||
disp_board();
|
||||
return 1;
|
||||
|
||||
# Is this needed?
|
||||
# binmode(STDOUT, ":utf8");
|
||||
|
||||
|
||||
|
||||
|
||||
|
32
ntvl.pl
Normal file
32
ntvl.pl
Normal 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();
|
Loading…
Reference in New Issue
Block a user