Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,30 @@
function generateposition()
# Placeholder knights
rank = ['♘', '♘', '♘', '♘', '♘', '♘', '♘', '♘']
lrank = length(rank)
# Check if a space is available
isfree(x::Int) = rank[x] == '♘'
# Place the King
rank[indking = rand(2:lrank-1)] = '♔'
# Place rooks
rank[indrook = rand(filter(isfree, 1:lrank))] = '♖'
if indrook > indking
rank[rand(filter(isfree, 1:indking-1))] = '♖'
else
rank[rand(filter(isfree, indking+1:lrank))] = '♖'
end
# Place bishops
rank[indbish = rand(filter(isfree, 1:8))] = '♗'
pbish = filter(iseven(indbish) ? isodd : iseven, 1:lrank)
rank[rand(filter(isfree, pbish))] = '♗'
# Place queen
rank[rand(filter(isfree, 1:lrank))] = '♕'
return rank
end
@show generateposition()