RosettaCodeData/Task/Generate-Chess960-starting-position/EasyLang/generate-chess960-starting-position.easy
2026-04-30 12:34:36 -04:00

21 lines
368 B
Text

len t$[] 8
proc randins c$ l r &pos .
repeat
pos = random l r
until t$[pos] = ""
.
t$[pos] = c$
.
randins "K" 2 7 king
randins "R" 1 (king - 1) h
randins "R" (king + 1) 8 h
randins "B" 1 8 b1
repeat
randins "B" 1 8 b2
until (b2 - b1) mod 2 <> 0
t$[b2] = ""
.
randins "Q" 1 8 b1
randins "N" 1 8 b1
randins "N" 1 8 b1
print strjoin t$[] ""