Skip to content

Commit

Permalink
support binary-star; WiP;
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomif committed Jan 29, 2024
1 parent 3f045d5 commit c472eb4
Showing 1 changed file with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ sub process_solution

if ( $s ne '' )
{
die "Line '$line_idx' is not empty, but '$s'";
Carp::confess("Line '$line_idx' is not empty, but '$s'");
}

return;
Expand All @@ -232,14 +232,16 @@ sub process_solution
{
die "First line is '$l' instead of 'Solved!'";
}
my $IS_BINARY_STAR = $self->_is_binary_star;
my $IS_GOLF = $self->_is_golf;
my $CHECK_EMPTY = ( $IS_GOLF or $self->_variant eq "black_hole" );
my $IS_DETAILED_MOVE = $IS_BINARY_STAR;
my $IS_BINARY_STAR = $self->_is_binary_star;
my $IS_GOLF = $self->_is_golf;
my $CHECK_EMPTY = ( $IS_GOLF or $self->_variant eq "black_hole" );
my $IS_DETAILED_MOVE = $IS_BINARY_STAR;
my $IS_DISPLAYED_BOARD = $IS_BINARY_STAR;
my $num_decks = $self->_num_foundations();

# As many moves as the number of cards.
MOVES:
for my $move_idx ( 0 .. ( $MAX_RANK * $NUM_SUITS - 1 ) )
for my $move_idx ( 0 .. ( $num_decks * $MAX_RANK * $NUM_SUITS - 1 ) )
{
my ( $move_line, $move_line_idx ) = $get_line->();

Expand Down Expand Up @@ -303,20 +305,20 @@ m/\AMove a card from stack ([0-9]+) to the foundations\z/
}

$moved_card_str = $1;
}

$assert_empty_line->();
$assert_empty_line->();
$assert_empty_line->();
$assert_empty_line->();

my ( $sep_line, $sep_line_idx ) = $get_line->();
my ( $sep_line, $sep_line_idx ) = $get_line->();

if ( $sep_line !~ m/\A=+\z/ )
{
die
if ( $sep_line !~ m/\A=+\z/ )
{
die
"Invalid format for separator line no. $sep_line_idx - '$sep_line'";
}
}

$assert_empty_line->();
$assert_empty_line->();
}

if ( defined $card )
{
Expand All @@ -339,7 +341,7 @@ m/\AMove a card from stack ([0-9]+) to the foundations\z/
"Card moved should be '$top_card_moved_str', but the info says it is '$moved_card_str' at line $info_line_idx";
}

my $found_card = $self->_foundation->cell(0);
my $found_card = $self->_foundation->cell($foundation_idx);
if ( defined($found_card) )
{
my $found_rank = $found_card->rank();
Expand All @@ -366,6 +368,10 @@ m/\AMove a card from stack ([0-9]+) to the foundations\z/
"Cannot put $top_card_moved_str in the foundations that contain "
. $found_card->to_string();
}
if ($IS_DISPLAYED_BOARD)
{
Carp::confess("Unimpl!");
}
}
$card = $col->pop;
--$remaining_cards;
Expand Down

0 comments on commit c472eb4

Please sign in to comment.