Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix solve-gen, enable it

  • Loading branch information...
commit 24ebf75235d0e899942ce180fca226c8c8d2b592 1 parent 1d1ae59
Moritz Lenz authored

Showing 1 changed file with 5 additions and 5 deletions. Show diff stats Hide diff stats

  1. +5 5 lib/Nonogram.pm
10 lib/Nonogram.pm
@@ -27,6 +27,8 @@ class Turtle {
27 27 }
28 28 }
29 29 class Nonogram {
  30 + # UNKNOWN, SPACE and BOX need the following properties:
  31 + # SPACE ~& $BOX eq $UNKNOWN
30 32 my $UNKNOWN = '0';
31 33 my $SPACE = '1';
32 34 my $BOX = '2';
@@ -100,6 +102,7 @@ class Nonogram {
100 102 $.solve-zero();
101 103 $.solve-one();
102 104 $.solve-shift();
  105 + $.solve-gen();
103 106 }
104 107
105 108 method solve-zero() {
@@ -215,8 +218,8 @@ class Nonogram {
215 218 $str ~|= $current;
216 219 }
217 220 }
218   - for $str.comb(/$SPACE|$BOX/).kv -> $k, $v {
219   - @.field-rows[$row-num][$k] = $v;
  221 + for $str.comb(/$SPACE|$BOX/, :match) -> $v {
  222 + @.field-rows[$row-num][$v.from] = ~$v;
220 223 }
221 224
222 225 sub distribute($total, $cells) {
@@ -225,11 +228,8 @@ class Nonogram {
225 228 take [$c, $_.flat] for distribute($total - $c, $cells - 1);
226 229 }
227 230 }
228   -
229 231 }
230   -
231 232 }
232   -
233 233 }
234 234
235 235 # vim: ft=perl6

0 comments on commit 24ebf75

Please sign in to comment.
Something went wrong with that request. Please try again.