def breakSixBarrier(self, player, dVal, chkID): chkSelected = None if player.checkersAtHome() == False: if dVal == 6 or dVal == 12: chkSelected = player.checkIfHasBarrier(None, dVal, self.getNormalSquares(), self.getStairSquares(player)) if chkSelected == None: # wait until player select one checker chk = self.__blockUntilSelect(player, dVal) else: chk = chkSelected return chk.getID()
def breakFiveBarrier(self, processTurn, player, chkID, dVal): breakBarrier = True if processTurn == -1: # recall for processing break barrier at # initial position with dVal = 5, sending -1 # for advice checkers = player.getCheckers() for chk in checkers: chkToMove = player.checkIfHasBarrier(chk, dVal, self.getNormalSquares(), self.getStairSquares(player)) if chk == chkToMove: # this chk is not in a barrier movement = player.checkIfChkCanMove(chk, dVal, self.getNormalSquares(), self.getStairSquares(player)) # this chk can move, it is not necessary break barrier if movement <> False: breakBarrier = False logging.info("break barrier: %s", breakBarrier) if breakBarrier == True: processTurn = self.nextTurn(player, -1, chkID, False) else: chk = self.__blockUntilSelect(player, dVal, breakBarrier) chkID = chk.getID() logging.info("barrier in dVal: %s and chkID: %s", dVal, chkID) processTurn = self.nextTurn(player, -1, chkID, True) if processTurn <> False: return processTurn else: return dVal