Beispiel #1
0
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 evaluate(self, gameState):
     abcs = gameState.abcs[gameState.turn]
     total_coins = abcs['coins'] + sum([card.coins*gameState.pcards[0].hand[card] for card in gameState.pcards[0].hand])
     v = [0,0,0,0,0]
     v[0] = abcs['actions'] * len(list(InputSets.handCardSet(gameState, number=1, filtered = lambda c: (c.action != None))))
     v[1] = min(abcs['buys']*8, total_coins)
     v[2] = total_coins
     v[3] = sum([c.cost*n for c,n in gameState.pcards[gameState.turn].allCards().items()])
     v[4] = (gameState.pcards[gameState.turn].currInPlay.count + gameState.pcards[gameState.turn].hand.count)
     return sum([v[i]*self.params[i] for i in xrange(len(self.params))])
def dbl(gameState):
    gameState = gameState.clone()
    currentPlayer = gameState.players[gameState.turn]
    result = currentPlayer.selectInput(InputSets.handCardSet(gameState, 1, filtered = lambda c: (c.action != None)),
            gameState, actionSimulator=dblSimulator, helpMessage='Choose which card to play twice')
    if result == None:
        return gameState
    else:
        result = result[0]
    gameState.pcards[gameState.turn].playFromHand(result)
    gameState = result.action(gameState)
    gameState = result.action(gameState)
    return gameState
def dbl(gameState):
    gameState = gameState.clone()
    currentPlayer = gameState.players[gameState.turn]
    result = currentPlayer.selectInput(
        InputSets.handCardSet(gameState,
                              1,
                              filtered=lambda c: (c.action != None)),
        gameState,
        actionSimulator=dblSimulator,
        helpMessage='Choose which card to play twice')
    if result == None:
        return gameState
    else:
        result = result[0]
    gameState.pcards[gameState.turn].playFromHand(result)
    gameState = result.action(gameState)
    gameState = result.action(gameState)
    return gameState
 def evaluate(self, gameState):
     abcs = gameState.abcs[gameState.turn]
     total_coins = abcs['coins'] + sum([
         card.coins * gameState.pcards[0].hand[card]
         for card in gameState.pcards[0].hand
     ])
     v = [0, 0, 0, 0, 0]
     v[0] = abcs['actions'] * len(
         list(
             InputSets.handCardSet(
                 gameState, number=1, filtered=lambda c:
                 (c.action != None))))
     v[1] = min(abcs['buys'] * 8, total_coins)
     v[2] = total_coins
     v[3] = sum([
         c.cost * n
         for c, n in gameState.pcards[gameState.turn].allCards().items()
     ])
     v[4] = (gameState.pcards[gameState.turn].currInPlay.count +
             gameState.pcards[gameState.turn].hand.count)
     return sum([v[i] * self.params[i] for i in xrange(len(self.params))])
Beispiel #6
0
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
Beispiel #7
0
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
Beispiel #8
0
 def availableActions(self, gameState):
     if not gameState.abcs[gameState.turn]['actions']:
         return []
     cards = list(InputSets.handCardSet(gameState, number=1, 
         filtered = lambda c: (c.action != None)))
     return [card[0] for card in cards]