예제 #1
0
 def swordmaster01(summon_x, summon_y, vector):
     fup1 = action[3]
     if fup1 == "": return True
     (des_x, des_y) = util.getAdjacent(summon_x, summon_y, fup1)
     assert tk.board[des_x][des_y][
         0] == -1 * tk.current_player and tk.board[des_x][des_y][
             1] == util.COMMON
     tk.removePiece(des_x, des_y)
     tk.pieces_destroyed[0] += 1
     tk.placePiece(tk.current_player, util.HEROIC, summon_x, summon_y)
     return True
예제 #2
0
 def champion11(summon_x, summon_y, vector):
     fup1 = action[3]
     if fup1 == "": return True
     (des_x, des_y) = util.getAdjacent(summon_x, summon_y, fup1)
     assert tk.board[des_x][des_y][
         0] == -1 * tk.current_player, "champion can't destroy an empty square or its own team"
     if tk.board[des_x][des_y][1] == util.COMMON:
         tk.pieces_destroyed[0] += 1
     elif tk.board[des_x][des_y][1] == util.HEROIC:
         tk.pieces_destroyed[1] += 1
     tk.removePiece(des_x, des_y)
     return True
예제 #3
0
        def timeMage07(summon_x, summon_y, vector):
            tk.remaining_game_actions += 1

            (des_x, des_y) = util.getAdjacent(summon_x, summon_y, vector)
            if tk.board[des_x][des_y][0] == -1 * tk.current_player:
                if tk.board[des_x][des_y][1] == util.COMMON:
                    tk.pieces_destroyed[0] += 1
                elif tk.board[des_x][des_y][1] == util.HEROIC:
                    tk.pieces_destroyed[1] += 1
                # only destroy enemy pieces
                tk.removePiece(des_x, des_y)
            return True
예제 #4
0
        def swordmaster01(summon_x, summon_y, vector):
            fup = [[""]]

            def enemyCommon(coordinate):
                (x, y) = coordinate
                if not util.validCoordinates(x, y): return False
                if board[x][y][0] == -1 * player and board[x][y][
                        1] == util.COMMON:
                    return True
                else:
                    return False

            if enemyCommon(util.getAdjacent(summon_x, summon_y, "NE")):
                fup.append(["NE"])
            if enemyCommon(util.getAdjacent(summon_x, summon_y, "SE")):
                fup.append(["SE"])
            if enemyCommon(util.getAdjacent(summon_x, summon_y, "SW")):
                fup.append(["SW"])
            if enemyCommon(util.getAdjacent(summon_x, summon_y, "NW")):
                fup.append(["NW"])
            return fup
예제 #5
0
 def cannon10(summon_x, summon_y, vector):
     fup1 = action[3]
     (old_x, old_y) = (summon_x, summon_y)
     while True:
         (des_x, des_y) = util.getAdjacent(old_x, old_y, fup1)
         # go up to edge of the board
         if not util.validCoordinates(des_x, des_y): return True
         if tk.board[des_x][des_y][1] == util.COMMON:
             if tk.board[des_x][des_y][0] == -1 * tk.current_player:
                 tk.pieces_destroyed[0] += 1
             tk.removePiece(des_x, des_y)
         (old_x, old_y) = (des_x, des_y)
     return True
예제 #6
0
        def bomb04(summon_x, summon_y, vector):
            # last action: nothing happens
            if tk.remaining_game_actions == 1: return True

            for direction in util.CARDINAL_DIRECTIONS:
                (des_x, des_y) = util.getAdjacent(summon_x, summon_y,
                                                  direction)
                if not util.validCoordinates(des_x, des_y): continue
                if tk.board[des_x][des_y][1] == util.COMMON:
                    if tk.board[des_x][des_y][0] == -1 * tk.current_player:
                        tk.pieces_destroyed[0] += 1
                    tk.removePiece(des_x, des_y)
            # self destruct
            tk.removePiece(summon_x, summon_y)
            return True
예제 #7
0
 def assassin06(summon_x, summon_y, vector):
     (des_x, des_y) = util.getAdjacent(summon_x, summon_y, vector)
     was_empty = (des_x, des_y) in tk.empty_squares
     if tk.board[des_x][des_y][0] == -1 * tk.current_player:
         if tk.board[des_x][des_y][1] == util.COMMON:
             tk.pieces_destroyed[0] += 1
         elif tk.board[des_x][des_y][1] == util.HEROIC:
             tk.pieces_destroyed[1] += 1
     tk.removePiece(des_x, des_y)
     fup1 = action[3]
     if fup1 == "": return True
     assert fup1 == vector
     assert was_empty, "assassin can't jump back unless the square was empty before"
     # jump back (standard move)
     tk.removePiece(summon_x, summon_y)
     tk.placePiece(tk.current_player, self.rank, des_x, des_y)
     return True
예제 #8
0
 def gunTower18(summon_x, summon_y, vector):
     fup1 = action[3]
     if fup1 == "": return True
     kill_count = 0
     (old_x, old_y) = (summon_x, summon_y)
     while True:
         (des_x, des_y) = util.getAdjacent(old_x, old_y, fup1)
         # go up to edge of the board
         if not util.validCoordinates(des_x, des_y): return True
         if tk.board[des_x][des_y][0] != EMPTY:
             kill_count += 1
             if tk.board[des_x][des_y][0] == -1 * tk.current_player:
                 if tk.board[des_x][des_y][1] == util.COMMON:
                     tk.pieces_destroyed[0] += 1
                 elif tk.board[des_x][des_y][1] == util.HEROIC:
                     tk.pieces_destroyed[1] += 1
             tk.removePiece(des_x, des_y)
         if kill_count == 2: return True
     return True
예제 #9
0
 def champion11(summon_x, summon_y, vector):
     fup = [[""]]
     for direction in util.CARDINAL_DIRECTIONS:
         (x, y) = util.getAdjacent(summon_x, summon_y, direction)
         if board[x][y][0] == -1 * player: fup.append([direction])
     return fup
예제 #10
0
 def assassin06(summon_x, summon_y, vector):
     fup = [[""]]
     (x, y) = util.getAdjacent(summon_x, summon_y, vector)
     if not util.validCoordinates(x, y): return fup
     if board[x][y][0] == util.EMPTY: fup.append([vector])
     return fup