Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - G.K.

Pages: 1 ... 642 643 644 645 646 647 648 [649] 650 651 652 653 654 655 656 ... 663
12961
Creativity Showcase / Re: Bots in MS Paint
« on: December 24, 2009, 10:16:11 AM »
Snatch reminds me of Biohazard

12962
Stock Showcases / Re: G.K.'s Showcase
« on: December 24, 2009, 10:15:00 AM »
Here's the updated popup. I had to remove 12 razors, but the result is still very powerful (The only BBEANS 5 bot to give it trouble is Bumble Bee):



Here it is in battle:



I put it into Starcore 4, and here's what it did (Clockwork Hydra is the robot on the bottom):



I even imported it into DSL and took on Hazcon:



Best moments
  • Outwedging NWB
  • OHKO'ing Cardiac Arest
Worst moment



12963
Tutorials and Tips / Re: AI-ing (.py files, coding, R+D, and help)
« on: December 24, 2009, 09:38:03 AM »
Crashing it.

12964
Tutorials and Tips / Re: AI-ing (.py files, coding, R+D, and help)
« on: December 24, 2009, 09:28:41 AM »
Cheers Mad. I've run it through IDLE and fixed some indentation errors. However, there's still something wrong. I've tried with both true/false and 1/0 like Click suggested. IDLE can't find anything else wrong with it.

Code: [Select]
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics

class IgnorePopup2(AI.SuperAI):
    "My special popup py that will ignore upside down bots."
    # Use variable 'NoChassisTime' in Bindings.py to set the amount of time in seconds the AI will wait to find the chassis before giving up and firing, when there are components in the smart zone.
    name = "IgnorePopup"

    def __init__(self, **args):
        AI.SuperAI.__init__(self, **args)
               
        self.zone1 = "weapon"
        self.triggers1 = ["Fire"]
        self.triggers2 = ["Srimech"]
        self.botinzone = 0
        self.compinzone = 0
        self.comptimer = 0
        self.NoChassisTime = 8
       
        fire = 0       

        if 'zone' in args: self.zone = args['zone']
       
        if 'triggers' in args: self.triggers1 = args['triggers']
        if 'triggers' in args: self.triggers2 = args['triggers']
        if 'NoChassisTime' in args: self.NoChassisTime = args.get('NoChassisTime') * 4

        self.tactics.append(Tactics.Engage(self))
       
    def Activate(self, active):
        if active:
            if AI.SuperAI.debugging:
                self.debug = Gooey.Plain("watch", 0, 75, 100, 75)
                tbox = self.debug.addText("line0", 0, 0, 100, 15)
                tbox.setText("Throttle")
                tbox = self.debug.addText("line1", 0, 15, 100, 15)
                tbox.setText("Turning")
                tbox = self.debug.addText("line2", 0, 30, 100, 15)
                tbox.setText("")
                tbox = self.debug.addText("line3", 0, 45, 100, 15)
                tbox.setText("")
           
            self.RegisterSmartZone(self.zone1, 1)
           
        return AI.SuperAI.Activate(self, active)

    def Tick(self):
        # fire weapon

        targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \
            and not plus.isDefeated(x.robot)]
       
        # if a component is in the smart zone but not the chassis, wait to find chassis before firing weapons
        if self.compinzone == 1 and self.botinzone == 0:
            self.comptimer += 1
           
        if self.botinzone == 1:
            self.comptimer = 0
           
        if self.weapons and (self.botinzone == 1 or (self.comptimer >= self.NoChassisTime and self.compinzone == 1)):
            for trigger in self.triggers1: self.Input(trigger, 0, 1)

        if self.weapons:
       
            if fire: self.Input(self.trigger, 0, 1)
       
        for bot in targets:
            if not plus.isUpsideDown(bot) or self.CanDriveUpsideDown(bot):
                    fire = 1
                                   
        bReturn = AI.SuperAI.Tick(self)
       
        return bReturn
           
    def CanDriveUpsideDown(self, bot):
        MOVE_THRESHOLD = 4.0
     
        if bot in self.upTrack:
            t = self.upTrack[bot]
            if t.invertible: return True
            else:
                # check to see if he's moved recently
                position = plus.getLocation(bot)
                time = plus.getTimeElapsed()
                if time - t.last_time > 10:
                    # this record is too old to be reliable
                    t.last_time = time
                    t.last_position = position
                    return False
                v0 = vector3(t.last_position)
                v1 = vector3(position)
                if (v1-v0).length() > MOVE_THRESHOLD: t.invertible = True
                return t.invertible
        else:
            t = UpsideDownTracker()
            t.last_position = plus.getLocation(bot)
            t.last_time = plus.getTimeElapsed()
            self.upTrack[bot] = t
           
            return False

    def InvertHandler(self):
        # fire all weapons once per second (until we're upright!)
        while 1:
            for trigger in self.triggers2:
                self.Input(trigger, 0, 1)
           
            for i in range(0, 8):
                yield 0
               
    def LostComponent(self, id):
        # if we lose all our weapons, stop using the Engage tactic and switch to Shove
        if id in self.weapons: self.weapons.remove(id)
       
        if not self.weapons:
            tactic = [x for x in self.tactics if x.name == "Engage"]
            if len(tactic) > 0:
                self.tactics.remove(tactic[0])
               
                self.tactics.append(Tactics.Shove(self))
                self.tactics.append(Tactics.Charge(self))
           
        return AI.SuperAI.LostComponent(self, id)
               
    def DebugString(self, id, string):
        if self.debug:
            if id == 0: self.debug.get("line0").setText(string)
            elif id == 1: self.debug.get("line1").setText(string)
            elif id == 2: self.debug.get("line2").setText(string)
            elif id == 3: self.debug.get("line3").setText(string)

    def SmartZoneEvent(self, direction, id, robot, chassis):
        if id == 1 and self.weapons:
            if robot > 0:
                if direction == 1:
                    self.compinzone = 1
                    if chassis:
                        self.botinzone = 1
                if direction == -1:
                    self.compinzone = 0
                    if chassis:
                        self.botinzone = 0
        return True
   
AI.register(IgnorePopup2)

12965
Tournament Archives / Re: International League Idea
« on: December 24, 2009, 09:11:22 AM »
Good.

12966
Stock Showcases / Re: Mr halitosises showcase
« on: December 24, 2009, 09:09:15 AM »
Is this the equivalent of being a cross-dresser on GTM?

Not the way I would have put it, but that's an interesting analogy LDL.

12967
Tournament Archives / Re: International League Idea
« on: December 24, 2009, 08:21:51 AM »
I could help with of the first two (presuming the team playoffs just need to be the matches, not anything flashy, and I don't have to AI any servo or flamethrower stuff, which confuses me a bit)

12968
Tournament Archives / Re: International League Idea
« on: December 24, 2009, 08:13:13 AM »
I'm fine with those rules. I just need to build a good MW.

anyone else wanting to contribute somehow.

What other things would be needed?

12969
Tutorials and Tips / Re: AI-ing (.py files, coding, R+D, and help)
« on: December 24, 2009, 08:10:48 AM »
I tried to download python, but my computer rejected the proper install and only let me download the source stuff, which I can't make head or tail of.

12970
Stock Showcases / Re: Mr halitosises showcase
« on: December 24, 2009, 03:51:49 AM »
Acting in "The Hobbit".

12971
General Support / Re: Shark Tooth
« on: December 24, 2009, 03:50:34 AM »
So where is "TOTAL COMPONENTS" ? There's no line saying it, and I find no "26" either, which is the number of components in the bot.

12972
Stock Showcases / Re: Mr halitosises showcase
« on: December 24, 2009, 03:20:49 AM »
We actually had a clue back on page 2. Reier posts what do you mean by the armour, when he would clearly know. halitosises says the same thing 42 seconds later. I'm guessing Reier forgot to log out and in again as halitosises.

12973
General Support / Re: Shark Tooth
« on: December 24, 2009, 03:19:19 AM »
That was in notepad ++

12974
Tutorials and Tips / Re: AI-ing (.py files, coding, R+D, and help)
« on: December 24, 2009, 02:52:45 AM »
The numbers bit confused me, but I'll try it in a minute.

Here's the whole py as it currently looks. I bet I've got fire=false out of line in the init section.

Code: [Select]
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics

class IgnorePopup2(AI.SuperAI):
    "My special popup py that will ignore upside down bots."
    # Use variable 'NoChassisTime' in Bindings.py to set the amount of time in seconds the AI will wait to find the chassis before giving up and firing, when there are components in the smart zone.
    name = "IgnorePopup"

    def __init__(self, **args):
        AI.SuperAI.__init__(self, **args)
               
        self.zone1 = "weapon"
        self.triggers1 = ["Fire"]
        self.triggers2 = ["Srimech"]
        self.botinzone = 0
        self.compinzone = 0
        self.comptimer = 0
        self.NoChassisTime = 8
       
            fire = false       

        if 'zone' in args: self.zone = args['zone']
       
        if 'triggers' in args: self.triggers1 = args['triggers']
        if 'triggers' in args: self.triggers2 = args['triggers']
        if 'NoChassisTime' in args: self.NoChassisTime = args.get('NoChassisTime') * 4

        self.tactics.append(Tactics.Engage(self))
       
    def Activate(self, active):
        if active:
            if AI.SuperAI.debugging:
                self.debug = Gooey.Plain("watch", 0, 75, 100, 75)
                tbox = self.debug.addText("line0", 0, 0, 100, 15)
                tbox.setText("Throttle")
                tbox = self.debug.addText("line1", 0, 15, 100, 15)
                tbox.setText("Turning")
                tbox = self.debug.addText("line2", 0, 30, 100, 15)
                tbox.setText("")
                tbox = self.debug.addText("line3", 0, 45, 100, 15)
                tbox.setText("")
           
            self.RegisterSmartZone(self.zone1, 1)
           
        return AI.SuperAI.Activate(self, active)

    def Tick(self):
        # fire weapon

        targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \
            and not plus.isDefeated(x.robot)]
       
        # if a component is in the smart zone but not the chassis, wait to find chassis before firing weapons
        if self.compinzone == 1 and self.botinzone == 0:
            self.comptimer += 1
           
        if self.botinzone == 1:
            self.comptimer = 0
           
        if self.weapons and (self.botinzone == 1 or (self.comptimer >= self.NoChassisTime and self.compinzone == 1)):
            for trigger in self.triggers1: self.Input(trigger, 0, 1)

        if self.weapons:
       
            if fire: self.Input(self.trigger, 0, 1)
       
        for bot in targets:
            if not plus.isUpsideDown(bot) or self.CanDriveUpsideDown(bot):
                    fire = True
                                   
        bReturn = AI.SuperAI.Tick(self)
       
        return bReturn
               
    def CanDriveUpsideDown(self, bot):
        MOVE_THRESHOLD = 4.0
     
        if bot in self.upTrack:
            t = self.upTrack[bot]
            if t.invertible: return True
            else:
                # check to see if he's moved recently
                position = plus.getLocation(bot)
                time = plus.getTimeElapsed()
                if time - t.last_time > 10:
                    # this record is too old to be reliable
                    t.last_time = time
                    t.last_position = position
                    return False
                v0 = vector3(t.last_position)
                v1 = vector3(position)
                if (v1-v0).length() > MOVE_THRESHOLD: t.invertible = True
                return t.invertible
        else:
            t = UpsideDownTracker()
            t.last_position = plus.getLocation(bot)
            t.last_time = plus.getTimeElapsed()
            self.upTrack[bot] = t
           
            return False

    def InvertHandler(self):
        # fire all weapons once per second (until we're upright!)
        while 1:
            for trigger in self.triggers2:
                self.Input(trigger, 0, 1)
           
            for i in range(0, 8):
                yield 0
               
    def LostComponent(self, id):
        # if we lose all our weapons, stop using the Engage tactic and switch to Shove
        if id in self.weapons: self.weapons.remove(id)
       
        if not self.weapons:
            tactic = [x for x in self.tactics if x.name == "Engage"]
            if len(tactic) > 0:
                self.tactics.remove(tactic[0])
               
                self.tactics.append(Tactics.Shove(self))
                self.tactics.append(Tactics.Charge(self))
           
        return AI.SuperAI.LostComponent(self, id)
               
    def DebugString(self, id, string):
        if self.debug:
            if id == 0: self.debug.get("line0").setText(string)
            elif id == 1: self.debug.get("line1").setText(string)
            elif id == 2: self.debug.get("line2").setText(string)
            elif id == 3: self.debug.get("line3").setText(string)

    def SmartZoneEvent(self, direction, id, robot, chassis):
        if id == 1 and self.weapons:
            if robot > 0:
                if direction == 1:
                    self.compinzone = 1
                    if chassis:
                        self.botinzone = 1
                if direction == -1:
                    self.compinzone = 0
                    if chassis:
                        self.botinzone = 0
        return True
   
AI.register(IgnorePopup2)

It still isn't working.

12975
General Support / Re: Shark Tooth
« on: December 24, 2009, 02:47:37 AM »
DP

I went back into the bot file to try STC's suggestion, and it worked straight away. However, the bot file is still bugging me. I couldn't find a Total components line, and I was using ++. I got a lot of this:



Is this normal for the bot file, or do I need to change something in the configurations/options/settings?

12976
General Support / Re: Dummy's Bot Editor
« on: December 24, 2009, 02:31:36 AM »
It works now, thanks Click.

12977
General Support / Re: Shark Tooth
« on: December 24, 2009, 02:18:19 AM »
Yeah, I was doing it in ++. It'll be the total components line. Unfortunately I don't know where it is.

12978
General Support / Re: Shark Tooth
« on: December 23, 2009, 03:50:35 PM »
I presume that I have to change something else in the .bot file as well as removing the code. Anyone?

12979
General Support / Shark Tooth
« on: December 23, 2009, 03:47:16 PM »
I put some 4kg shark teeth on my robot, but they took it over the weight limit. I can't take them off. Whenever I click on them, nothing happens. The other components are just fine. I also tried removing the following from the .bot file:

Code: [Select]
23
2
1
0 0 0
0 0 0 1
4.71239 0
Weapon
Components\lt_tooth.txt
22
2
1
0 0 0
0 -1.42109e-014 0 1
1.5708 0
Weapon
Components\lt_tooth.txt

However, this just crashes the game when I try to load it.

Help would be appreciated.

12980
Tournament Archives / Re: Clash Cubes 3 - SignUp
« on: December 23, 2009, 01:04:35 PM »
Mine doesn't have a wedge :)

Then again its an SnS so will fail.

Pages: 1 ... 642 643 644 645 646 647 648 [649] 650 651 652 653 654 655 656 ... 663