Exemplo n.º 1
0
    def play_round(self, winner, win_amount):
        self.dollar += get_dollars()
        self.count500 += 1
        self.round += 1
        if winner == 0:
            self.dollar -= win_amount
            self.count500 = int(self.dollar / get_dollars())
        if self.round == 10:
            return self.dollar

        return min(self.dollar, (self.count500 - 1) * get_dollars() + 1)
Exemplo n.º 2
0
 def play_round(self, winner, win_amount):
     self.money += get_dollars()
     if winner == 0:
         self.money -= win_amount
     if self.money >= win_amount:
         return max(0, win_amount)
     return 0
Exemplo n.º 3
0
 def play_round(self, winner, win_amount):
     self.rounds += 1
     self.dollar += get_dollars()
     if winner == 0:
         self.dollar -= win_amount
     if self.rounds == get_rounds():
         return self.dollar
     return self.dollar / 2
Exemplo n.º 4
0
 def play_round(self, winner, win_amount):
     self.round += 1
     self.dollar += get_dollars()
     if winner == 0:
         self.dollar -= win_amount
     if self.round == get_rounds():
         self.win_with_this = self.dollar
     return self.win_with_this if self.dollar >= self.win_with_this else 0
Exemplo n.º 5
0
 def play_round(self, winner, win_amount):
     self.round += 1
     self.dollar += get_dollars()
     if winner != -1:
         self.win_amounts.append(
             win_amount)  # adding from the current winner his win_amount
         if winner == 0:
             self.dollar -= win_amount
     return self.max_win_amount_bid()
Exemplo n.º 6
0
    def play_round(self, winner, win_amount):
        self.dollar += get_dollars()
        if winner == 0:
            self.dollar -= win_amount

        if self.time_to_bid:
            bid = self.dollar
        else:
            bid = 0
        self.time_to_bid = not self.time_to_bid
        return bid
Exemplo n.º 7
0
    def play_round(self, winner, win_amount):
        self.dollar += get_dollars()
        if winner == 0:
            self.dollar -= win_amount
        if winner != -1:
            self.general_wins += 1
            self.sum_of_win_amounts += win_amount

        if self.general_wins == 0 or self.sum_of_win_amounts / self.general_wins > self.dollar:
            return self.dollar
        return self.sum_of_win_amounts / self.general_wins
Exemplo n.º 8
0
 def play_round(self, winner, win_amount):
     self.players_money = [d + get_dollars() for d in self.players_money]
     if winner == -10:
         self.players_money[1] -= win_amount
     elif winner != -1:
         self.players_money[winner] -= win_amount
     # average money of the other players
     s = sum(self.players_money) / len(self.players_money)
     if s > self.players_money[0]:
         return self.players_money[0]
     return s
Exemplo n.º 9
0
    def play_round(self, winner, win_amount):
        self.players_money = [d + get_dollars() for d in self.players_money]
        if winner == -10:
            self.players_money[self.random.randint(1,
                                                   get_players() -
                                                   1)] -= win_amount
        elif winner != -1:
            self.players_money[winner] -= win_amount

        if self.players_money[0] in self.players_money[1:]:
            return self.players_money[0] - self.random.randint(1, 10)
        return self.players_money[0]
Exemplo n.º 10
0
    def play_round(self, winner, win_amount):
        self.round += 1
        self.players_money = [d + get_dollars() for d in self.players_money]

        if winner == -10:
            print("I don't know what I am doing")
        elif winner != -1:
            self.winning_behaviour_inturn = win_amount / (
                self.players_money[winner] - get_dollars()
            )  # the behaviour of the recent winner
            if self.winning_behaviour_inturn != 1 and self.winning_behaviour_inturn != 0.5 and self.winning_behaviour_inturn != 0:
                self.winning_behaviour_inturn = "not specific value"
                self.sumof_bit_bellow_values += (
                    self.players_money[winner] - get_dollars()
                ) - win_amount  # the needed bit bellow value to win
            self.players_money[winner] -= win_amount
            self.behaviours[self.winning_behaviour_inturn][
                0] += 1  # adding 1 to the winning behaviour of this turn

        if self.round == get_rounds():
            return self.players_money[
                0]  # default all in acting if it is the final round.

        max_wins = max([
            self.behaviours[key][0] for key in self.keys
        ])  # the max_wins that have been with 1 or more behaviours
        winnable_behaviours = [
        ]  # saves all the behaviours that won max_wins times.

        for key in self.keys:
            if self.behaviours[key][0] == max_wins:
                winnable_behaviours.append(key)

        # ideally it's only one the winnable behaviour but if it isn't the chosen behaviour will be randomly.
        chosen_behaviour = winnable_behaviours[self.random.randint(
            0,
            len(winnable_behaviours) - 1)]

        return self.behaviours[chosen_behaviour][1]()
Exemplo n.º 11
0
    def play_round(self, winner, win_amount):
        self.dollar += get_dollars()
        self.round += 1
        if winner == 0:
            self.dollar -= win_amount
            self.hasWon = True

        if self.round == 10:
            return self.dollar

        if not self.hasWon:
            return self.dollar - 1
        else:
            return self.dollar
Exemplo n.º 12
0
    def play_round(self, winner, win_amount):
        self.money += get_dollars()
        self.round += 1

        if winner == 0:
            self.money -= win_amount
            self.wins.append(self.round)
        # after 2 non winning rounds go all in
        last_win = 0
        if len(self.wins) > 0:
            last_win = self.wins[-1]

        if self.round - last_win > 2:
            return self.money
        return 0
Exemplo n.º 13
0
 def play_round(self, winner, win_amount):
     self.dollar += get_dollars()
     self.round += 1
     if winner == 0:
         self.dollar -= win_amount
     if self.round == 1:
         return 0
     elif self.round == 2:
         return min(self.dollar, 1000)
     elif self.round == 3:
         return min(self.dollar, 1001)
     elif self.round == 4:
         return min(self.dollar, 2000)
     elif self.round == 5:
         return min(self.dollar, 1001)
     elif self.round == get_rounds():
         return self.dollar
     return min(self.dollar, 1002)
Exemplo n.º 14
0
 def play_round(self, winner, win_amount):
     self.dollar += get_dollars()
     if winner == 0:
         self.dollar -= win_amount
     return self.dollar - self.random.randint(0, min(20, get_dollars()))
Exemplo n.º 15
0
 def play_round(self, winner, win_amount):
     self.dollar += get_dollars()
     if winner == 0:
         self.dollar -= win_amount
     return self.dollar
Exemplo n.º 16
0
 def __init__(self):
     self.dollar = 0
     self.win_with_this = get_dollars() * 2 + 1
     self.round = 0