2018-01-04 01:50:34 -06:00
|
|
|
from player.player import Player
|
2018-01-10 14:01:44 -05:00
|
|
|
from card.basic.card_treasure import Treasure
|
|
|
|
|
|
2018-01-04 01:50:34 -06:00
|
|
|
|
2018-01-05 03:42:13 -06:00
|
|
|
class Pure_Big_Money(Player):
|
2018-01-04 01:50:34 -06:00
|
|
|
def take_action(self):
|
|
|
|
|
print("\nAs a BIG MONEY BOT, I'm skipping this unnecessary action phase. Beep-boop, bow to me humans!")
|
|
|
|
|
|
|
|
|
|
#This method will only be called for this bot when it is time to play treasures, it will play all of them always.
|
2018-01-05 21:33:36 -06:00
|
|
|
def get_play_input(self, message, target_type):
|
2018-01-04 01:50:34 -06:00
|
|
|
choice = -1
|
|
|
|
|
hand = self.get_hand().get_supply()
|
|
|
|
|
|
|
|
|
|
for c in hand:
|
2018-01-10 14:01:44 -05:00
|
|
|
if isinstance(c, Treasure):
|
2018-01-04 01:50:34 -06:00
|
|
|
choice = hand.index(c)
|
|
|
|
|
|
|
|
|
|
print(message + str(choice))
|
|
|
|
|
return choice
|
|
|
|
|
|
|
|
|
|
#This method will only be called when it is time to buy things, a very simple logic will decide its action.
|
2018-01-05 21:33:36 -06:00
|
|
|
def get_buy_input(self, message, target_type):
|
2018-01-10 23:30:39 -05:00
|
|
|
coin = self.get_coin()
|
2018-01-04 01:50:34 -06:00
|
|
|
choice = -1
|
|
|
|
|
|
|
|
|
|
if coin >= 8:
|
|
|
|
|
choice = self.get_table().get_pile_index_of_card("Province")
|
|
|
|
|
elif coin >= 6:
|
|
|
|
|
choice = self.get_table().get_pile_index_of_card("Gold")
|
|
|
|
|
elif coin >= 3:
|
|
|
|
|
choice = self.get_table().get_pile_index_of_card("Silver")
|
|
|
|
|
|
|
|
|
|
print(message + str(choice))
|
|
|
|
|
return choice
|
2018-01-05 03:42:13 -06:00
|
|
|
|
|
|
|
|
#This will pick either the first or the first least effective purchasing card as this bot doesn't care about that
|
2018-01-06 08:39:06 -06:00
|
|
|
def militia_input(self, message, target_type):
|
2018-01-05 03:42:13 -06:00
|
|
|
choice = self.__get_first_non_Treasure()
|
|
|
|
|
min_coin = self.get_hand().get_supply()[choice].get_purchase_power()
|
|
|
|
|
|
|
|
|
|
for c in self.get_hand().get_supply():
|
2018-01-10 14:01:44 -05:00
|
|
|
# We want to do isinstance rather than not isinstance because we only want to evaluate this loop when we are
|
|
|
|
|
# evaluating an all treasure card hand as at that point the choice will be a treasure card, otherwise the
|
|
|
|
|
# choice will already be non-treasure and we don't need to check anything since this bot doesn't do action
|
|
|
|
|
if c.get_purchase_power() < min_coin and isinstance(c, Treasure):
|
2018-01-05 03:42:13 -06:00
|
|
|
min_coin = c.get_purchase_power()
|
|
|
|
|
choice = self.get_hand().get_supply().index(c)
|
|
|
|
|
|
|
|
|
|
print(message + str(choice))
|
|
|
|
|
return choice
|
|
|
|
|
|
|
|
|
|
def __get_first_non_Treasure(self):
|
|
|
|
|
for c in self.get_hand().get_supply():
|
2018-01-10 14:01:44 -05:00
|
|
|
if not isinstance(c, Treasure):
|
2018-01-05 03:42:13 -06:00
|
|
|
return self.get_hand().get_supply().index(c)
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
|
return "Player " + str(self.get_player_index()) + " (pure big money bot)"
|