Solve triangle solitaire puzzle: Difference between revisions
Content added Content deleted
Line 373: | Line 373: | ||
┗━━━━━━━━━┛ |
┗━━━━━━━━━┛ |
||
" |
" |
||
⚫ | |||
# |
# |
||
func solve . |
func solve . solution$ . |
||
⚫ | |||
for pos range len brd$[] |
for pos range len brd$[] |
||
if brd$[pos] = "●" |
if brd$[pos] = "●" |
||
Line 384: | Line 384: | ||
brd$[pos + dir] = "·" |
brd$[pos + dir] = "·" |
||
brd$[pos + 2 * dir] = "●" |
brd$[pos + 2 * dir] = "●" |
||
call solve |
call solve solution$ |
||
brd$[pos] = "●" |
brd$[pos] = "●" |
||
brd$[pos + dir] = "●" |
brd$[pos + dir] = "●" |
||
brd$[pos + 2 * dir] = "·" |
brd$[pos + 2 * dir] = "·" |
||
if |
if solution$ <> "" |
||
break 2 |
break 2 |
||
. |
. |
||
Line 395: | Line 395: | ||
. |
. |
||
. |
. |
||
if |
if npegs = 1 or solution$ <> "" |
||
solution$ = str_join brd$[] & solution$ |
solution$ = str_join brd$[] & solution$ |
||
solved = 1 |
|||
. |
. |
||
. |
. |
||
call solve |
call solve solution$ |
||
print solution$ |
print solution$ |
||
</lang> |
</lang> |