Jump to content

Generate Chess960 starting position: Difference between revisions

Added Easylang
imported>Vukung
(Prolog solution)
(Added Easylang)
Line 936:
{{out}}
<pre>QBNNBRKR</pre>
 
=={{header|EasyLang}}==
{{trans|Lua}}
<syntaxhighlight>
len t$[] 8
proc randins c$ l r . pos .
repeat
pos = randint (r - l + 1) + l - 1
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
randins "B" 1 8 b2
while (b2 - b1) mod 2 = 0
t$[b2] = ""
randins "B" 1 8 b2
.
randins "Q" 1 8 b1
randins "N" 1 8 b1
randins "N" 1 8 b1
print strjoin t$[]
</syntaxhighlight>
{{out}}
<pre>
RBBNQNKR
</pre>
 
=={{header|EchoLisp}}==
2,058

edits

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