Board.__init__(self, setup=self.shuffle_start()) else: Board.__init__(self, setup=setup) def shuffle_start(self): tmp = ['r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'] random.shuffle(tmp) tmp = ''.join(tmp) tmp = tmp + '/pppppppp/8/8/8/8/PPPPPPPP/' + tmp.upper() + ' w - - 0 1' return tmp class ShuffleChess: __desc__ = _("xboard nocastle: http://tim-mann.org/xboard/engine-intf.html#8\n" + "FICS wild/2: http://www.freechess.org/Help/HelpFiles/wild.html\n" + "* Random arrangement of the pieces behind the pawns\n" + "* No castling\n" + "* Black's arrangement mirrors white's") name = _("Shuffle") cecp_name = "nocastle" board = ShuffleBoard need_initial_board = True standard_rules = True variant_group = VARIANTS_SHUFFLE if __name__ == '__main__': Board = ShuffleBoard(True) for i in range(10): print Board.shuffle_start()
random.shuffle(tmp) b1 = tmp.index('b') b2 = tmp.index('b', b1 + 1) tmp = ''.join(tmp) tmp = 'k' + tmp + '/pppppppp/8/8/8/8/PPPPPPPP/' + tmp[::-1].upper( ) + 'K w - - 0 1' return tmp class CornerChess: __desc__ = \ _("http://brainking.com/en/GameRules?tp=2\n" + "* Placement of the pieces on the 1st and 8th row are randomized\n" + "* The king is in the right hand corner\n" + "* Bishops must start on opposite color squares\n" + "* Black's starting position is obtained by rotating white's position 180 degrees around the board's center\n" + "* No castling") name = _("Corner") cecp_name = "nocastle" board = CornerBoard need_initial_board = True standard_rules = True variant_group = VARIANTS_SHUFFLE if __name__ == '__main__': Board = CornerBoard(True) for i in range(10): print Board.shuffle_start()
Board.__init__(self, setup=self.shuffle_start(), lboard=lboard) else: Board.__init__(self, setup=setup, lboard=lboard) def shuffle_start(self): tmp = ['r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'] random.shuffle(tmp) tmp = ''.join(tmp) tmp = tmp + '/pppppppp/8/8/8/8/PPPPPPPP/' + tmp.upper() + ' w - - 0 1' return tmp class ShuffleChess: __desc__ = _("xboard nocastle: http://home.hccnet.nl/h.g.muller/engine-intf.html#8\n" + "FICS wild/2: http://www.freechess.org/Help/HelpFiles/wild.html\n" + "* Random arrangement of the pieces behind the pawns\n" + "* No castling\n" + "* Black's arrangement mirrors white's") name = _("Shuffle") cecp_name = "nocastle" board = ShuffleBoard need_initial_board = True standard_rules = True variant_group = VARIANTS_SHUFFLE if __name__ == '__main__': Board = ShuffleBoard(True) for i in range(10): print(Board.shuffle_start())