Generate random chess position: Difference between revisions
J: bugfix (and assuming I have read the specification properly...)
m (changed a trailing semicolon to a period in the task's preamble.) |
(J: bugfix (and assuming I have read the specification properly...)) |
||
Line 28:
white=: 0 1,?n#2 NB. which ones are white?
pawns=: 0 0,?n#2 NB. where are the pawns?
pawns=: pawns * 1- white*layout e.56
pawns=: pawns * 1-(1-white)*layout e.i.8
ptyp=: 'pkqbjnPKQBJN'{~(6*white)+1 1,(1-2}.pawns)*2+?n#4
Line 44:
NB. (just the task specific crippled fen)
b2fen=:3 :0
(}.;|.<@(('/',fen1)"1) y),' w - - 0 1'
)
Line 52:
<lang J> randfen''
randfen''
randfen''
randfen''
p4n2/1Q6/8/8
randfen''
bk1q3J/8/1N4K1/N3P3/3BQ3/j1P3P1/7P/5jq1 w - - 0 1
randfen''
b1Q1Bb1J/j1N1PpK1/PpB1P1Pp/2pp2PN/3nnk2/3J4/P6P/1N2Qb1J w - - 0 1
</lang>
=={{header|Perl 6}}==
|