RosettaCodeData/Task/Generate-Chess960-starting-position/PureBasic/generate-chess960-starting-position.basic
2025-02-27 18:35:13 -05:00

21 lines
598 B
Text

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()