First-price sealed-bid auction
hard_coded
class hard_coded:
def __init__(self):
self.money = 0
self.round = 0
def play_round(self, did_i_win, amount):
self.money += 500
self.round += 1
if did_i_win == 0:
self.money -= amount
prob = [500, 992, 1170, 1181, 1499, 1276, 1290, 1401, 2166, 5000][self.round - 1]
if prob > self.money:
return self.money
else:
return prob
This bot is the results of genetic training against a lot of other pseudo-random bots (and some of the bots in other answers). I've spent some time fine-tuning at the end, but its structure is actually very simple.
The decisions are based only on a fixed set of parameters and not on the outcome of previous rounds.
The key seems to be the first round: you have to go all-in, bidding 500 is the safe move. Too many bots are trying to outsmart the initial move by bidding 499 or 498. Winning the first round gives you a big advantage for the rest of the auction. You are only 500 dollars behind, and you have time to recover.
A safe bet in the second round is a little over 990, but even bidding 0 gives some good result. Bidding too high and winning could be worse than losing this round.
In the third round, most bots stop escalating: 50% of them have less than 1500 dollars by now, so there is no need to waste money on this round, 1170 is a good tradeoff. Same thing in the fourth round. If you lost the first three, you can win this one very cheap, and still have enough money for the next.
After that, the average money required to win a round is 1500 dollars (which is the logical conclusion: everyone wins a round out of four by now, bidding less to win later is just wasting money, the situation has stabilized and it's just round-robin from now on).
The last round must be all-in, and the other parameters are fine-tuned to win the last round by bidding as low as possible until then.
A lot of bots try to win the ninth round by bidding more than 2000 dollars, so I took that into account and try to overbid them (I can't win both the last two rounds anyway, and the last will be harder).
Above Average
Bids above the average amount of money the other players have. Bids everything in the last round.
class above_average:
def __init__(self):
self.round = 0
self.player_money = [0] * 4
def play_round(self, winner, winning_bid):
self.round += 1
self.player_money = [x+500 for x in self.player_money]
if winner != -1:
self.player_money[winner] -= winning_bid
if self.round == 10:
return self.player_money[0]
bid = sum(self.player_money[1:]) / 3 + 1
if bid > self.player_money[0]:
return self.player_money[0]
return min(self.player_money[0], bid)
I Don't Even
class I_Dont_Even:
def __init__(self):
self.money = 0
self.round = 0
def play_round(self, loser, bid):
self.money += 500 - (not loser) * bid
self.round += 1
return self.money * (self.round & 1 or self.round == 10)
Only participates in odd rounds and the last round.