RosettaCodeData/Task/Generate-Chess960-starting-.../PureBasic/generate-chess960-starting-...

22 lines
598 B
Plaintext

OpenConsole()
RandomSeed(Date())
For i = 1 To 10
inicio.s = "RKR"
pieza.s = "QNN"
For n = 1 To Len(pieza)
posic = Random(Len(inicio)) + 1
inicio = Left(inicio, posic - 1) + Mid(pieza, n, 1) + Right(inicio, Len(inicio) - posic + 1)
Next n
posic = Random(Len(inicio)) + 1
inicio = Left(inicio, posic - 1) + "B" + Right(inicio, Len(inicio) - posic + 1)
posic + 1 + 2 * Int(Random(Len(inicio) - posic) / 2)
inicio = Left(inicio, posic - 1) + "B" + Right(inicio, Len(inicio) - posic + 1)
PrintN(inicio)
Next i
PrintN(#CRLF$ + "Press ENTER to exit"): Input()
CloseConsole()