Knight's tour: Difference between revisions

Line 8,551:
 
dnl Extract the nth position from the path.
define(`path_nth',`substr($1,eval(( $2 ) * 2),2)')
`ifelse($2,0,`path_car($1)',`path_nth(path_cdr($1),eval(( $2 ) - 1))')')
 
define(`random_positionrandom_move',`path_nth($1,randnum(path_length($1)))')
 
dnl Is the position $1 contained in the path $2?
Line 8,612 ⟶ 8,611:
`pushdef(`moves',next_moves($2))`'dnl
ifelse(moves,`',`find_tour($1)',
`find_tour($1,$2`'random_positionrandom_move(next_moves($2)))')`'dnl
popdef(`moves')')')
 
1,448

edits