Solve triangle solitaire puzzle: Difference between revisions
m
→{{header|Wren}}: Minor tidy
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
m (→{{header|Wren}}: Minor tidy) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 23:
Reference picture: http://www.joenord.com/puzzles/peggame/
<br/>Updated link (June 2021):
https://www.joenord.com/triangle-peg-board-game-solutions-to-amaze-your-friends/
Line 365 ⟶ 367:
=={{header|EasyLang}}==
<syntaxhighlight lang="text">
brd$[] = strchars "
┏━━━━━━━━━┓
┃ · ┃
Line 373 ⟶ 376:
┃● ● ● ● ●┃
┗━━━━━━━━━┛"
solution$ = ""
for pos
if brd$[pos] = "●"
npegs += 1
for dir in [ -13 -11 2 13 11 -2 ]
if brd$[pos + dir] = "●" and brd$[pos + 2 * dir] = "·"
brd$[pos] = "·"
brd$[pos + dir] = "·"
brd$[pos + 2 * dir] = "●"
brd$[pos] = "●"
brd$[pos + dir] = "●"
brd$[pos + 2 * dir] = "·"
if solution$ <> ""
solution$ = strjoin brd$[] & solution$
.
.
.
.
if npegs = 1▼
.▼
solution$ = strjoin brd$[]▼
▲ if npegs = 1
▲ .
▲ solution$ = strjoin brd$[]
.
print solution$
</syntaxhighlight>
Line 3,485 ⟶ 3,488:
{{trans|Kotlin}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="
var board = List.filled(16, true)
|