Generate Chess960 starting position: Difference between revisions

m
→‎{{header|Factor}}: simplify "next" word
m (→‎{{header|Factor}}: unhyphenate the name of the method used)
m (→‎{{header|Factor}}: simplify "next" word)
Line 485:
 
: empty ( seq -- n ) 32 swap indices random ; ! return a random empty index (i.e. equal to 32) of seq
: next ( seq -- n ) [ 32 =swap index ; ] find drop ; ! return the leftmost empty index of seq
: place ( seq elt n -- seq' ) rot [ set-nth ] keep ; ! set nth member of seq to elt, keeping seq on the stack
 
1,808

edits