Generate Chess960 starting position: Difference between revisions
Generate Chess960 starting position (view source)
Revision as of 12:16, 17 March 2024
, 2 months ago→{{header|EasyLang}}
imported>Vukung (Prolog solution) |
|||
(One intermediate revision by the same user not shown) | |||
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
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$[]
</syntaxhighlight>
{{out}}
<pre>
RBBNQNKR
</pre>
=={{header|EchoLisp}}==
|