Robot Roulette: High stakes robot gambling
UpYours
Being late to enter I spent a while admiring the existing bots, spent a while overcomplicating your guys' ideas, then un-overcomplicating them. Then it came to me
Good artists copy, great artists steal. --
Pablo PicassoMe
"Up Yours" because I'm unabashedly stealing (and sometimes tacking a point or two onto your bots' bids to one up them).
def UpYoursBot(hp, history, ties, alive, start):
willToLive = "I" in "VICTORY"
args = [hp, history, ties, alive, start]
enemyHealth = 100 - sum(history)
roundNumber = len(history)
if roundNumber is 0:
# Steal HalfPunchBot
return halfpunch(*args) + 2
if alive == 2:
# Nick OneShotBot
return one_shot(*args)
if enemyHealth >= hp:
# Pinch SarcomaBotMkTwo
return sarcomaBotMkTwo(*args) + 1
if enemyHealth < hp:
# Rip off KickBot
return kick(*args) + 1
if not willToLive:
# Peculate KamikazeBot
return kamikaze(*args) + 1
But for real, this is a great competition guys. I love this community on days like this.
Kamikaze
Why bother with complicated logic when we are all going to die anyway...
def kamikaze(hp, history, ties, alive):
return hp
One shot
It's going to survive at least a single round if it doesn't encounter the kamikaze.
def one_shot(hp, history, ties, alive):
if hp == 1:
return 1
else:
return hp - 1
Pathetic Bot gets a much needed upgrade:
The pathetic attempt at a bot that tries to incorporate other bots' features
def pathetic_attempt_at_analytics_bot(hp, history, ties, alive, start):
'''Not a good bot'''
if hp == 100 and alive == 2:
return hp - 1
#This part is taken from Survivalist Bot, thanks @SSight3!
remaining = alive - 2
btf = 0
rt = remaining
while rt > 1:
rt = float(rt / 2)
btf += 1
if ties > 2:
return hp - 1
if history:
opp_hp = 100 - sum(history)
#This part is taken from Geometric Bot, thanks @Mnemonic!
fractions = []
health = 100
for x in history:
fractions.append(float(x) / health)
health -= x
#Modified part
if len(fractions) > 1:
i = 0
ct = True
while i < len(fractions)-1:
if abs((fractions[i] * 100) - (fractions[i + 1] * 100)) < 1:
ct = False
i += 1
if ct:
expected = fractions[i] * opp_hp
return expected
if alive == 2:
if hp > opp_hp:
return hp - 1
return hp
if hp > opp_hp + 1:
if opp_hp <= 15:
return opp_hp + 1
if ties == 2:
return opp_hp + 1
else:
return opp_hp
else:
n = 300 // (alive - 1) + 1 #greater than
if n >= hp:
n = hp - 1
return n
This bot incorporates features from Survivalist Bot and Geometric Bot for more efficient bot takedowns.
Pre-Upgrade:
The pathetic attempt at a bot that analyzes the history of its opponent
def pathetic_attempt_at_analytics_bot(hp, history, ties, alive, start):
'''Not a good bot'''
if history:
opp_hp = 100 - sum(history)
if alive == 2:
if hp > opp_hp:
return hp - 1
return hp
if hp > opp_hp + 1:
if opp_hp <= 15:
return opp_hp +1
if ties > 0:
return hp - 1 #Just give up, kamikaze mode
return opp_hp + 1
return opp_hp
else:
n = 300 // (alive - 1) + 1 #greater than
if n >= hp:
n = hp - 1
return n
If there is previous history of its opponent, then it calculates its opponent's hp. Then, it does one of the following:
- If its opponent is the last opponent alive, then it will bid one less than its hp.
- If its opponent is not the last opponent alive but the opponent has less than 16 hp, then it will outbid its opponent's hp.
- If its opponent is not the last opponent alive and there is a history of ties, then it will bid its hp because it is bored of ties.
- Otherwise, it will outbid its opponent.
If there is no history, then it does some fancy calculations that I hacked together and bids that. If the value exceeds 100, then it automatically bids its hp minus 1.
I hacked this code together during work and this is my first submission, so it probably won't win or anything, and it'll lose to the kamikaze.
EDIT: Due to some suggestions, the bot's beginning behavior has been changed to bid a higher value.
EDIT 2: added start param that does nothing
EDIT 3: Added new spinoff bot:
[The pathetic attempt at a bot that attacks Gang Bots (as well as doing everything the above bot does)] REMOVED
[This bot analyzes whether its opponent is a gangbot or not and pretends to be one as well to get the sweet low bids that it can trump easily.]
This bot has been scrapped, please remove it from the leaderboards.
EDIT 4: Fixed errors, changed tie feature.