Solve triangle solitaire puzzle: Difference between revisions
m
→{{header|Julia}}: add starting position display
m (→{{header|Julia}}: add starting position display) |
|||
Line 683:
v[div(i*i-i+2,2):div(i*(i+1),2)]), ""), 1:5), "\n")
const solutiontext =
function solve(mv, turns=1, bd=[0; ones(Int, 14)])
Line 706:
for (i, move) in enumerate(moves)
if solve(move)
println(join([solutiontext[1]; reverse(solutiontext[2:end])], ""))
break
elseif i == length(moves)
Line 714:
</lang>{{out}}
<pre>
Starting board:
0
1 1
1 1 1
1 1 1 1
1 1 1 1 1
move 4 to 1
1
|