Skip to main content
deleted 4 characters in body
Source Link

EDIT: Changed Berserker's rage threshold from 50 to 3025, since otherwise it would take itself out before doing anything...

import sys
class Berserker:
    def rage(self,command):

    
        if len(command) <=1:
            return 'ok'
        else:
            last_turn = list(command)
            bot_to_smash = -1
            me = last_turn[0]
            my_power = last_turn[int(me)].split(',')[2]
            for k in xrange(0,len(last_turn)):
                #bot_action = last_turn.split(',')
                
                if len(last_turn[k]) ==1:
                    pass
                else:
                    bot_action = last_turn[k].split(',')
                    if int(my_power) < 3025:
                        #Too weak! Need make stronger for smashing!
                        bot_to_smash = me
                        break
                    else:
                        #Now strong! Smash! Not smash the broken things!
                        if bot_action[0] != me and bot_action[1] > 0:
                            bot_to_smash = bot_action[0]
    
            if bot_to_smash > -1:
                return bot_to_smash
            else:
                #Confused! Don't like! MORE POWER!
                return me
            
print Berserker().rage(sys.argv[1:])

EDIT: Changed Berserker's rage threshold from 50 to 30, since otherwise it would take itself out before doing anything...

import sys
class Berserker:
    def rage(self,command):

    
        if len(command) <=1:
            return 'ok'
        else:
            last_turn = list(command)
            bot_to_smash = -1
            me = last_turn[0]
            my_power = last_turn[int(me)].split(',')[2]
            for k in xrange(0,len(last_turn)):
                #bot_action = last_turn.split(',')
                
                if len(last_turn[k]) ==1:
                    pass
                else:
                    bot_action = last_turn[k].split(',')
                    if int(my_power) < 30:
                        #Too weak! Need make stronger for smashing!
                        bot_to_smash = me
                        break
                    else:
                        #Now strong! Smash! Not smash the broken things!
                        if bot_action[0] != me and bot_action[1] > 0:
                            bot_to_smash = bot_action[0]
    
            if bot_to_smash > -1:
                return bot_to_smash
            else:
                #Confused! Don't like! MORE POWER!
                return me
            
print Berserker().rage(sys.argv[1:])

EDIT: Changed Berserker's rage threshold from 50 to 25, since otherwise it would take itself out before doing anything...

import sys
class Berserker:
    def rage(self,command):

    
        if len(command) <=1:
            return 'ok'
        else:
            last_turn = list(command)
            bot_to_smash = -1
            me = last_turn[0]
            my_power = last_turn[int(me)].split(',')[2]
            for k in xrange(0,len(last_turn)):
                #bot_action = last_turn.split(',')
                
                if len(last_turn[k]) ==1:
                    pass
                else:
                    bot_action = last_turn[k].split(',')
                    if int(my_power) < 25:
                        #Too weak! Need make stronger for smashing!
                        bot_to_smash = me
                        break
                    else:
                        #Now strong! Smash! Not smash broken things!
                        if bot_action[0] != me and bot_action[1] > 0:
                            bot_to_smash = bot_action[0]
    
            if bot_to_smash > -1:
                return bot_to_smash
            else:
                #Confused! Don't like! MORE POWER!
                return me
            
print Berserker().rage(sys.argv[1:])
added 127 characters in body
Source Link

Berserker smash! Hits itself until it has enough power, then starts attacking the closest living thing. Also hits itself if it can't work out who it should be hitting, for whatever reason. runs

EDIT: Changed Berserker's rage threshold from 50 to 30, since otherwise it would take itself out before doing anything...

Runs with python Berserker.py <input>

import sys
class Berserker:
    def rage(self,command):

    
        if len(command) <=1:
            return 'ok'
        else:
            last_turn = list(command)
            bot_to_smash = -1
            me = last_turn[0]
            my_power = last_turn[int(me)].split(',')[2]
            for k in xrange(0,len(last_turn)):
                #bot_action = last_turn.split(',')
                
                if len(last_turn[k]) ==1:
                    pass
                else:
                    bot_action = last_turn[k].split(',')
                    if int(my_power) < 5030:
                        #Too weak! Need make stronger for smashing!
                        bot_to_smash = me
                        break
                    else:
                        #Now strong! Smash! Not smash the broken things!
                        if bot_action[0] != me and bot_action[1] > 0:
                            bot_to_smash = bot_action[0]
    
            if bot_to_smash > -1:
                return bot_to_smash
            else:
                #Confused! Don't like! MORE POWER!
                return me
            
print Berserker().rage(sys.argv[1:])

Berserker smash! Hits itself until it has enough power, then starts attacking the closest living thing. Also hits itself if it can't work out who it should be hitting, for whatever reason. runs with python Berserker.py <input>

import sys
class Berserker:
    def rage(self,command):

    
        if len(command) <=1:
            return 'ok'
        else:
            last_turn = list(command)
            bot_to_smash = -1
            me = last_turn[0]
            my_power = last_turn[int(me)].split(',')[2]
            for k in xrange(0,len(last_turn)):
                #bot_action = last_turn.split(',')
                
                if len(last_turn[k]) ==1:
                    pass
                else:
                    bot_action = last_turn[k].split(',')
                    if int(my_power) < 50:
                        #Too weak! Need make stronger for smashing!
                        bot_to_smash = me
                        break
                    else:
                        #Now strong! Smash! Not smash the broken things!
                        if bot_action[0] != me and bot_action[1] > 0:
                            bot_to_smash = bot_action[0]
    
            if bot_to_smash > -1:
                return bot_to_smash
            else:
                #Confused! Don't like! MORE POWER!
                return me
            
print Berserker().rage(sys.argv[1:])

Berserker smash! Hits itself until it has enough power, then starts attacking the closest living thing. Also hits itself if it can't work out who it should be hitting, for whatever reason.

EDIT: Changed Berserker's rage threshold from 50 to 30, since otherwise it would take itself out before doing anything...

Runs with python Berserker.py <input>

import sys
class Berserker:
    def rage(self,command):

    
        if len(command) <=1:
            return 'ok'
        else:
            last_turn = list(command)
            bot_to_smash = -1
            me = last_turn[0]
            my_power = last_turn[int(me)].split(',')[2]
            for k in xrange(0,len(last_turn)):
                #bot_action = last_turn.split(',')
                
                if len(last_turn[k]) ==1:
                    pass
                else:
                    bot_action = last_turn[k].split(',')
                    if int(my_power) < 30:
                        #Too weak! Need make stronger for smashing!
                        bot_to_smash = me
                        break
                    else:
                        #Now strong! Smash! Not smash the broken things!
                        if bot_action[0] != me and bot_action[1] > 0:
                            bot_to_smash = bot_action[0]
    
            if bot_to_smash > -1:
                return bot_to_smash
            else:
                #Confused! Don't like! MORE POWER!
                return me
            
print Berserker().rage(sys.argv[1:])
Removed test print statements, added comments
Source Link
import sys
class snapping_turtle:
    def bitey(self,command):

    
        if len(command) <=1:
            return 'ok'
        else:
            last_turn = list(command)
            print last_turn
            bot_to_bite = -1
            me = last_turn[0]
            print 'I am ' + me
            for k in xrange(0,len(last_turn)):
                #bot_action = last_turn.split(',')
                
                if len(last_turn[k]) ==1:
                    pass
                else:
                    bot_action = last_turn[k].split(',')
                    # If they hit me
                    if bot_action[3] == me:
                        # And if they're still alive, hit them
                        if int(bot_action[1]) > 0:
                            bot_to_bite = bot_action[0]
                            break
                        #Otherwise, stay in my shell
                        else:
                            pass
    
            if bot_to_bite > -1:
                return bot_to_bite
            else:
                return 'D'
            
print snapping_turtle().bitey(sys.argv[1:])

Berserker smash! Hits itself until it has enough power, then starts attacking the closest living thing. Also hits itself if it can't work out who it should be hitting, for whatever reason. runs with python Berserker.py <input>

import sys
class Berserker:
    def rage(self,command):

    
        if len(command) <=1:
            return 'ok'
        else:
            last_turn = list(command)
            print last_turn
            bot_to_smash = -1
            me = last_turn[0]
            my_power = last_turn[int(me)].split(',')[2]
            print 'power = ' + `my_power`
            print 'I am ' + me
            for k in xrange(0,len(last_turn)):
                #bot_action = last_turn.split(',')
                
                if len(last_turn[k]) ==1:
                    pass
                else:
                    bot_action = last_turn[k].split(',')
                    if int(my_power) < 50:
                        #Too weak! Need make stronger for smashing!
                        bot_to_smash = me
                        break
                    else:
                        #Now strong! Smash! Not smash the broken things!
                        if bot_action[0] != me and bot_action[1] > 0:
                            bot_to_smash = bot_action[0]
    
            if bot_to_smash > -1:
                return bot_to_smash
            else:
                #Confused! Don't like! MORE POWER!
                return 'D'me
            
print Berserker().rage(sys.argv[1:])
import sys
class snapping_turtle:
    def bitey(self,command):

    
        if len(command) <=1:
            return 'ok'
        else:
            last_turn = list(command)
            print last_turn
            bot_to_bite = -1
            me = last_turn[0]
            print 'I am ' + me
            for k in xrange(0,len(last_turn)):
                #bot_action = last_turn.split(',')
                
                if len(last_turn[k]) ==1:
                    pass
                else:
                    bot_action = last_turn[k].split(',')
                    if bot_action[3] == me:
                        if int(bot_action[1]) > 0:
                            bot_to_bite = bot_action[0]
                            break
                        else:
                            pass
    
            if bot_to_bite > -1:
                return bot_to_bite
            else:
                return 'D'
            
print snapping_turtle().bitey(sys.argv[1:])

Berserker smash! Hits itself until it has enough power, then starts attacking the closest living thing. runs with python Berserker.py <input>

import sys
class Berserker:
    def rage(self,command):

    
        if len(command) <=1:
            return 'ok'
        else:
            last_turn = list(command)
            print last_turn
            bot_to_smash = -1
            me = last_turn[0]
            my_power = last_turn[int(me)].split(',')[2]
            print 'power = ' + `my_power`
            print 'I am ' + me
            for k in xrange(0,len(last_turn)):
                #bot_action = last_turn.split(',')
                
                if len(last_turn[k]) ==1:
                    pass
                else:
                    bot_action = last_turn[k].split(',')
                    if int(my_power) < 50:
                        
                        bot_to_smash = me
                        break
                    else:
                        if bot_action[0] != me and bot_action[1] > 0:
                            bot_to_smash = bot_action[0]
    
            if bot_to_smash > -1:
                return bot_to_smash
            else:
                return 'D'
            
print Berserker().rage(sys.argv[1:])
import sys
class snapping_turtle:
    def bitey(self,command):

    
        if len(command) <=1:
            return 'ok'
        else:
            last_turn = list(command)
            bot_to_bite = -1
            me = last_turn[0]
            for k in xrange(0,len(last_turn)):
                #bot_action = last_turn.split(',')
                
                if len(last_turn[k]) ==1:
                    pass
                else:
                    bot_action = last_turn[k].split(',')
                    # If they hit me
                    if bot_action[3] == me:
                        # And if they're still alive, hit them
                        if int(bot_action[1]) > 0:
                            bot_to_bite = bot_action[0]
                            break
                        #Otherwise, stay in my shell
                        else:
                            pass
    
            if bot_to_bite > -1:
                return bot_to_bite
            else:
                return 'D'
            
print snapping_turtle().bitey(sys.argv[1:])

Berserker smash! Hits itself until it has enough power, then starts attacking the closest living thing. Also hits itself if it can't work out who it should be hitting, for whatever reason. runs with python Berserker.py <input>

import sys
class Berserker:
    def rage(self,command):

    
        if len(command) <=1:
            return 'ok'
        else:
            last_turn = list(command)
            bot_to_smash = -1
            me = last_turn[0]
            my_power = last_turn[int(me)].split(',')[2]
            for k in xrange(0,len(last_turn)):
                #bot_action = last_turn.split(',')
                
                if len(last_turn[k]) ==1:
                    pass
                else:
                    bot_action = last_turn[k].split(',')
                    if int(my_power) < 50:
                        #Too weak! Need make stronger for smashing!
                        bot_to_smash = me
                        break
                    else:
                        #Now strong! Smash! Not smash the broken things!
                        if bot_action[0] != me and bot_action[1] > 0:
                            bot_to_smash = bot_action[0]
    
            if bot_to_smash > -1:
                return bot_to_smash
            else:
                #Confused! Don't like! MORE POWER!
                return me
            
print Berserker().rage(sys.argv[1:])
added 1460 characters in body
Source Link
Loading
Source Link
Loading