blackdarkbishops += 1 blacklightbishops = blacklightbishops > 0 and (blacklightbishops-1) or 0 break tmp = ''.join(black) + '/pppppppp/8/8/8/8/PPPPPPPP/' + \ ''.join(white).upper() + ' w - - 0 1' return tmp class AsymmetricRandomChess: __desc__ = \ _("FICS wild/4: http://www.freechess.org/Help/HelpFiles/wild.html\n" + "* Randomly chosen pieces (two queens or three rooks possible)\n" + "* Exactly one king of each color\n" + "* Pieces placed randomly behind the pawns, SUBJECT TO THE CONSTRAINT THAT THE BISHOPS ARE BALANCED\n" + "* No castling\n" + "* Black's arrangement DOES NOT mirrors white's") name = _("Asymmetric Random") cecp_name = "unknown" board = AsymmetricRandomBoard need_initial_board = True standard_rules = True variant_group = VARIANTS_SHUFFLE if __name__ == '__main__': Board = AsymmetricRandomBoard(True) for i in range(10): print Board.asymmetricrandom_start()
blacklightbishops = blacklightbishops > 0 and ( blacklightbishops - 1) or 0 break tmp = ''.join(black) + '/pppppppp/8/8/8/8/PPPPPPPP/' + \ ''.join(white).upper() + ' w - - 0 1' return tmp class AsymmetricRandomChess: __desc__ = \ _("FICS wild/4: http://www.freechess.org/Help/HelpFiles/wild.html\n" + "* Randomly chosen pieces (two queens or three rooks possible)\n" + "* Exactly one king of each color\n" + "* Pieces placed randomly behind the pawns, SUBJECT TO THE CONSTRAINT THAT THE BISHOPS ARE BALANCED\n" + "* No castling\n" + "* Black's arrangement DOES NOT mirrors white's") name = _("Asymmetric Random") cecp_name = "unknown" board = AsymmetricRandomBoard need_initial_board = True standard_rules = True variant_group = VARIANTS_SHUFFLE if __name__ == '__main__': Board = AsymmetricRandomBoard(True) for i in range(10): print Board.asymmetricrandom_start()
bishopindex = blackbishoprandomindexstack.pop() for index, piece in RandomEnumeratePieces(black): if piece != 'b': if ((blackdarkbishops > whitedarkbishops) and \ (bishopindex % 2 == 1) and (index % 2 == 0)): black[bishopindex] = piece black[index] = 'b' blacklightbishops += 1 blackdarkbishops = blackdarkbishops > 0 and ( blackdarkbishops - 1) or 0 break elif ((blacklightbishops > whitelightbishops) and \ (bishopindex % 2 == 0) and (index % 2 == 1)): black[bishopindex] = piece black[index] = 'b' blackdarkbishops += 1 blacklightbishops = blacklightbishops > 0 and ( blacklightbishops - 1) or 0 break tmp = ''.join(black) + '/pppppppp/8/8/8/8/PPPPPPPP/' + \ ''.join(white).upper() + ' w - - 0 1' return tmp if __name__ == '__main__': Board = AsymmetricRandomBoard(True) for i in range(10): print(Board.asymmetricrandom_start())
(whitelightbishops != blacklightbishops): bishopindex = blackbishoprandomindexstack.pop() for index, piece in RandomEnumeratePieces(black): if piece != 'b': if ((blackdarkbishops > whitedarkbishops) and (bishopindex % 2 == 1) and (index % 2 == 0)): black[bishopindex] = piece black[index] = 'b' blacklightbishops += 1 blackdarkbishops = blackdarkbishops > 0 and ( blackdarkbishops - 1) or 0 break elif ((blacklightbishops > whitelightbishops) and (bishopindex % 2 == 0) and (index % 2 == 1)): black[bishopindex] = piece black[index] = 'b' blackdarkbishops += 1 blacklightbishops = blacklightbishops > 0 and ( blacklightbishops - 1) or 0 break tmp = ''.join(black) + '/pppppppp/8/8/8/8/PPPPPPPP/' + \ ''.join(white).upper() + ' w - - 0 1' return tmp if __name__ == '__main__': Board = AsymmetricRandomBoard(True) for i in range(10): print(Board.asymmetricrandom_start())