def remod(gameState): gameState = gameState.clone() currentPlayer = gameState.players[gameState.turn] result = currentPlayer.selectInput(InputSets.handCardSet(gameState, 1), gameState, actionSimulator=remodSim1, helpMessage='Choose a card to trash') if result == None: return gameState else: result = result[0] cards = gameState.pcards[gameState.turn] cards.hand[result] -= 1 gameState.trash[result] += 1 costs = range(result.cost + 2 + 1) result = currentPlayer.selectInput(InputSets.stackCardSet(gameState, costs=costs), gameState, actionSimulator=remodSim2) if result == None: return gameState else: result = result[0] gameState.stacks[result] -= 1 cards.gain(result) return gameState
def work(gameState): gameState = gameState.clone() currentPlayer = gameState.players[gameState.turn] result = currentPlayer.selectInput(InputSets.stackCardSet(gameState, costs=[0,1,2,3,4]), gameState, actionSimulator = actionSim) if result == None: return gameState else: result = result[0] gameState.stacks[result] -= 1 gameState.pcards[gameState.turn].gain(result) return gameState
def work(gameState): gameState = gameState.clone() currentPlayer = gameState.players[gameState.turn] result = currentPlayer.selectInput(InputSets.stackCardSet( gameState, costs=[0, 1, 2, 3, 4]), gameState, actionSimulator=actionSim) if result == None: return gameState else: result = result[0] gameState.stacks[result] -= 1 gameState.pcards[gameState.turn].gain(result) return gameState
def gainCard(gameState): gameState = gameState.clone() currentPlayer = gameState.players[gameState.turn] result = currentPlayer.selectInput(InputSets.stackCardSet(gameState, costs=xrange(5+1)), gameState, actionSimulator = actionSim) if result == None: return gameState else: result = result[0] gameState.trash[Feast()] += 1 gameState.pcards[gameState.turn].currInPlay[Feast()] -= 1 gameState.stacks[result] -= 1 gameState.pcards[gameState.turn].gain(result) return gameState
def gainCard(gameState): gameState = gameState.clone() currentPlayer = gameState.players[gameState.turn] result = currentPlayer.selectInput(InputSets.stackCardSet(gameState, costs=xrange(5 + 1)), gameState, actionSimulator=actionSim) if result == None: return gameState else: result = result[0] gameState.trash[Feast()] += 1 gameState.pcards[gameState.turn].currInPlay[Feast()] -= 1 gameState.stacks[result] -= 1 gameState.pcards[gameState.turn].gain(result) return gameState
def mineSim1(gameState, minedCard): gameState = gameState.clone() currentPlayer = gameState.players[gameState.turn] if minedCard == None: return gameState else: minedCard = minedCard[0] costs = [minedCard.cost + i for i in xrange(4)] gameState.trash[minedCard] += 1 gameState.pcards[gameState.turn].hand[minedCard] -= 1 newCard = currentPlayer.selectInput( InputSets.stackCardSet(gameState, 1, costs=costs, filtered=(lambda x: x.coins > 0)), gameState) if newCard == None: return gameState else: newCard = newCard[0] gameState.stacks[newCard] -= 1 gameState.pcards[gameState.turn].hand[newCard] += 1 return gameState
def remodSim1(gameState, result): gameState = gameState.clone() currentPlayer = gameState.players[gameState.turn] if result == None: return gameState else: result = result[0] cards = gameState.pcards[gameState.turn] cards.hand[result] -= 1 gameState.trash[result] += 1 costs = range(result.cost + 2 + 1) result = currentPlayer.selectInput( InputSets.stackCardSet(gameState, costs=costs), gameState, actionSimulator=remodSim2 ) if result == None: return gameState else: result = result[0] gameState.stacks[result] -= 1 cards.gain(result) return gameState
def mine(gameState): gameState = gameState.clone() currentPlayer = gameState.players[gameState.turn] minedCard = currentPlayer.selectInput( InputSets.handCardSet(gameState, 1, filtered=(lambda x: x.coins > 0)), gameState, actionSimulator = mineSim1, helpMessage = 'Which Treasure do you choose to Trash?') if minedCard == None: return gameState else: minedCard = minedCard[0] costs = [minedCard.cost + i for i in xrange(4)] gameState.trash[minedCard] += 1 gameState.pcards[gameState.turn].hand[minedCard] -= 1 newCard = currentPlayer.selectInput( InputSets.stackCardSet(gameState, 1, costs=costs, filtered=(lambda x: x.coins > 0)), gameState, actionSimulator = mineSim2,) if newCard == None: return gameState else: newCard = newCard[0] gameState.stacks[newCard] -= 1 gameState.pcards[gameState.turn].hand[newCard] += 1 return gameState
def availableBuys(self, gameState, money): if not gameState.abcs[gameState.turn]['buys']: return [] cards = list(InputSets.stackCardSet(gameState, number=1, costs=range(money+1))) return [card[0] for card in cards]