Solve a Hidato puzzle: Difference between revisions
Content added Content deleted
(→{{header|Tailspin}}: Clearer types (required thanks to autotyping)) |
|||
Line 4,711: | Line 4,711: | ||
templates hidato |
templates hidato |
||
composer setup |
composer setup |
||
data givenInput <[<={}|{row: <row>, col: <col>}>*]> local |
|||
@: {row: 1, col: 1, givenInput:[]}; |
|||
{ board: [ <line>+ ], given: $@. |
{ board: [ <line>+ ], given: $@.givenInput -> \[i](<~={}> { n: $i, $...} !\) } |
||
rule line: [ <cell>+ ] (<'\n '>?) (..|@: {row: $@.row + 1, col: 1};) |
rule line: [ <cell>+ ] (<'\n '>?) (..|@: {row: $@.row + 1, col: 1};) |
||
rule cell: <open|blocked|given> (<' '>?) (@.col: $@.col + 1;) |
rule cell: <open|blocked|given> (<' '>?) (@.col: $@.col + 1;) |
||
Line 4,718: | Line 4,719: | ||
rule blocked: <' \.'> -> -1 |
rule blocked: <' \.'> -> -1 |
||
rule given: (<' '>?) (def given: <INT>;) |
rule given: (<' '>?) (def given: <INT>;) |
||
($given -> ..|@. |
($given -> ..|@.givenInput: $@.givenInput::length+1..$ -> {};) |
||
($given -> @. |
($given -> @.givenInput($): { row: $@.row, col: $@.col };) |
||
$given |
$given |
||
end setup |
end setup |