Пример #1
0
def play_phase(parser):
    """Decide which cards to play and play them.
    When making a decision, incorporate the coin primitively.
    Don't play anything if there are 7 minions on the field.
    """
    logger.debug("Play phase start")

    (total, cards) = botalgs.cards_to_play(gstate.tingle)
    logger.debug("Going to play {} with {} mana".format(cards, total))

    if total + 2 <= gstate.tingle.mana_available():
        # We should play the draw ability first and recalculate
        logger.info("Avail mana is greater than what we can spend; using hero power and recalculating")
        play_hero_ability()
        parser.process_log()
        (total, cards) = botalgs.cards_to_play(gstate.tingle)
    
    for card in cards:
        num_in_hand = len(gstate.tingle.hand)
        control.play_minion(num_in_hand, int(card.pos))
        # We need this to get the new position of cards
        # TODO: With a built-in cache we could predict the future positions of minions that die
        # (assuming they don't have side-effects)
        time.sleep(2)
        parser.process_log()
Пример #2
0
def play_phase(parser):
    """Decide which cards to play and play them.
    When making a decision, incorporate the coin primitively.
    Don't play anything if there are 7 minions on the field.
    """
    logger.debug("Play phase start")

    (total, cards) = botalgs.cards_to_play(gstate.tingle)
    logger.debug("Going to play {} with {} mana".format(cards, total))

    if total + 2 <= gstate.tingle.mana_available():
        # We should play the draw ability first and recalculate
        logger.info(
            "Avail mana is greater than what we can spend; using hero power and recalculating"
        )
        play_hero_ability()
        parser.process_log()
        (total, cards) = botalgs.cards_to_play(gstate.tingle)

    for card in cards:
        num_in_hand = len(gstate.tingle.hand)
        control.play_minion(num_in_hand, int(card.pos))
        # We need this to get the new position of cards
        # TODO: With a built-in cache we could predict the future positions of minions that die
        # (assuming they don't have side-effects)
        time.sleep(2)
        parser.process_log()
Пример #3
0
 def test_cards_to_play_empty(self):
     gstate = state.GameState()
     gstate.start_game()
     gstate.set_our_turn()
     self.assertEqual((0, []), botalgs.cards_to_play(gstate.tingle))
Пример #4
0
 def test_cards_to_play_empty(self):
     gstate = state.GameState()
     gstate.start_game()
     gstate.set_our_turn()
     self.assertEqual((0, []), botalgs.cards_to_play(gstate.tingle))