Jump to content

Solve a Holy Knight's tour: Difference between revisions

m
(→‎{{header|JavaScript}}: added JS (ES6) version (composing generic functions))
Line 1,979:
};
 
// firstSolution :: {nodeKey: [nodeKey]} -> Int -> nodeKey, nodeKey, [nodeKey] ->
// nodeKey -> nodeKey -> {path::[nodeKey], pathLen::Int, found::Bool}->
// -> {path::[nodeKey], pathLen::Int, found::Bool}
const firstSolution = (dctMoves, intTarget, strStart, strNodeKey, path) => {
const
Line 2,096 ⟶ 2,097:
just: startXY
}), lstGroups)),
strSoln = 'First solution found in c. ' +
intMSeconds + ' milliseconds:\n\n' +
unlines(map(groupLine(cellWidth, ' ', {
Line 2,123 ⟶ 2,124:
0 0 0
 
First solution found in c.24 21 milliseconds:
 
25 14 23
Line 2,151 ⟶ 2,152:
0 0
 
First solution found in c.7223 7084 milliseconds:
 
1 3
Line 2,168 ⟶ 2,169:
 
 
[Finished in 7.331s2s]</pre>
 
=={{header|Lua}}==
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.