Commits

shl...@b384bcd7-cfd4-0310-aca0-d78b80f7b91b  committed 61b8143

Randomize the two clues for each row/column/diagonal.

This way it's less predictable.

  • Participants
  • Parent commits 54d7c7c

Comments (0)

Files changed (1)

File abc-path/generator/generate-abs-path.pl

             if (!@clues)
             {
                 # Yay! We found a configuration.
+                my $handle_clue = sub {
+                    my @cells = @{shift->{cells}};
+                    $self->_fisher_yates_shuffle(\@cells);
+                    return [map { vec($layout, $_, 8) } @cells];
+                };
                 my $riddle =
                 {
                     solution => $layout,
-                    clues => [map { [ map { vec($layout, $_, 8) } @{$_->{cells}}] } @{$last_state->{clues}}],
+                    clues =>
+                    [
+                        map { $handle_clue->($_) } @{$last_state->{clues}}
+                    ],
                     A_pos => [$self->_to_xy($A_pos)],
                 };