Author Topic: AI-ing (.py files, coding, nose-orienting R+D, and help)  (Read 235875 times)

Offline Squirrel_Monkey

  • Squirrel_Monkeyweight
  • *
  • Posts: 7587
  • Rep: 7
  • [Insert clever and witty comment here]
    • 0SquirrelMonkey0
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #640 on: June 02, 2010, 10:09:19 AM »
Yes
Better than GK since 2009.
I think SM is a pretty cool guy, eh builds unicycle-bots and doesn't afraid of anything

Offline nicsan2009

  • Ultra Heavyweight
  • Posts: 1836
  • Rep: 5
  • Here we go again!
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #641 on: June 02, 2010, 10:10:56 AM »
ok then next queston
Hosted 2 Legit 2 Quit tourney Congrats Somebody
Hosted 2 Legit 2 Quit 2 congrats to Plazmic Inferno as well as Somebody (again)
Hosted RA2 World Cup Congrats to Senstro
Hosted TGRR congrats to 090901
ITAT Tournament- Champion
Beetle Bashers- Champion
Father and Son Tournament 2- Champion
GTM All Stars- HW Champion; MW runner up
Father and Son Tournament- Runner up
All Time Record 51-36

Offline Gazea2

  • Ultra Heavyweight
  • Posts: 3670
  • Rep: 9
  • the one and only
    • View Profile
    • Awards
  • Skype: gazea2
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #642 on: June 05, 2010, 07:46:26 AM »
Thyrus and I are teaming up for Tag Team Tornado and I've A.I-ed my bot but when I A.I his, it won't fire. It's a flipper and I've named the smartzone "flip" (according to the A.I chart) and I've named the controls right.

Help?

P.S - I've just realised that I ask for lots of help. :P


Offline Naryar

  • Posts: 23278
  • Rep: 20
  • hybrids oui oui
    • http://www.youtube.com/us
  • Awards BOTM Winner
    • View Profile
    • Awards
  • Skype: TheMightyNaryar
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #643 on: June 05, 2010, 07:48:35 AM »
Are they wired right ?

Offline Gazea2

  • Ultra Heavyweight
  • Posts: 3670
  • Rep: 9
  • the one and only
    • View Profile
    • Awards
  • Skype: gazea2
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #644 on: June 05, 2010, 07:49:45 AM »
Yes. When I go into battle and I control the bot I can fire them fine.


Offline G.K.

  • *
  • Posts: 12156
  • Rep: 10
  • Striving for a good personal text since 1994.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #645 on: June 05, 2010, 07:54:07 AM »
Post a screenshot of the controls.
My above post explains everything about everything.

Host of: Wheely Tag, Back To The Beginnings, BTTB 2, BTTB 3, BTTB 4, & BTTB V.

Heavy Metal: Champion (Mockery of the Whole Concept)
Robotic International Wars Series 1: Champion (Minifridge 6)
RA2 Team Championships 1 & 2: Champion (High Speed Train & Upthrust - as part of Naryar's Not Quite Evil Council of Doom)

Runner Up in: The Amazing Rage (Team Fedex), R0B0NOVA (Zaphod Stock), Steel Warzone (Inception of Instability), Box of Nightmares (Gicquel), Wheely Tag (Minifridge the Second)

Clash Cubes IV: 5th place (Fretless)
BBEANS 6: Rumble Winner & 6th Place (Minifridge 4)

Offline Gazea2

  • Ultra Heavyweight
  • Posts: 3670
  • Rep: 9
  • the one and only
    • View Profile
    • Awards
  • Skype: gazea2
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #646 on: June 05, 2010, 08:02:45 AM »
I just realised that I named the control that controls the flippers "Fire" instead of "Flip". *Facepalm*


Offline Naryar

  • Posts: 23278
  • Rep: 20
  • hybrids oui oui
    • http://www.youtube.com/us
  • Awards BOTM Winner
    • View Profile
    • Awards
  • Skype: TheMightyNaryar
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #647 on: June 11, 2010, 03:23:04 AM »
Code: [Select]
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics

class PopupMultiZone(AI.SuperAI):
    "Like Popup strategy, up to 4 zones and the classical Fire/Weapon/Srimech"
    name = "PopupMultiZone"
    # up to 4 zones named weapon1, weapon2, weapon3 and weapon4
    # and the associated triggers : Fire1, Fire2, fire3, Fire4
    # weaponX is associated with FireX ie : ennemy in customzone weapon3 -> do the action associated with Fire3
    # You may also change the default tactics (engage) by specify in the bindings.py 'tactic': XXX
    # with XXX = "Charge", "Engage", "Shove", "Ram"
    # Ripped off Popup.py and OmniMultiZone.py by Naryar
    def __init__(self, **args):
        AI.SuperAI.__init__(self, **args)
               
        self.trigger2 = ["Srimech"]
        self.botinzone1 = 0
        self.compinzone1 = 0
        self.botinzone2 = 0
        self.compinzone2 = 0
        self.botinzone3 = 0
        self.compinzone3 = 0
        self.botinzone4 = 0
        self.compinzone4 = 0
        self.comptimer1 = 0
        self.comptimer2 = 0
        self.comptimer3 = 0
        self.comptimer4 = 0
        self.NoChassisTime = 8
       
        if 'NoChassisTime' in args: self.NoChassisTime = args.get('NoChassisTime') * 4
       
        self.triggerIterator = iter(self.triggers)

        if 'tactic' in args:
            self.theTactic = args['tactic']
            if   self.theTactic  == "Charge" : self.tactics.append(Tactics.Charge(self))
            elif self.theTactic  == "Ram" : self.tactics.append(Tactics.Ram(self))
            elif self.theTactic  == "Shove" : self.tactics.append(Tactics.Shove(self))             
            elif self.theTactic  == "Engage" : self.tactics.append(Tactics.Engage(self))
            else: self.tactics.append(Tactics.Engage(self))
        else: 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("weapon1", 1)
            self.RegisterSmartZone("weapon2", 2)
            self.RegisterSmartZone("weapon3", 3)
            self.RegisterSmartZone("weapon4", 4)
           
        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 first smart zone but not the chassis, wait to find chassis before firing weapons
        if self.compinzone1 == 1 and self.botinzone1 == 0:
            self.comptimer1 += 1
           
        if self.botinzone1 == 1:
            self.comptimer1 = 0
           
        if self.weapons and (self.botinzone1 == 1 or (self.comptimer1 >= self.NoChassisTime and self.compinzone1 == 1)):
            for trigger in self.triggers1: self.Input("Fire1", 0, 1)
           
        # if a component is in the second smart zone but not the chassis, wait to find chassis before firing weapons
        if self.compinzone2 == 1 and self.botinzone2 == 0:
            self.comptimer2 += 1
           
        if self.botinzone2 == 1:
            self.comptimer2 = 0
           
        if self.weapons and (self.botinzone2 == 1 or (self.comptimer2 >= self.NoChassisTime and self.compinzone2 == 1)):
            for trigger in self.triggers1: self.Input("Fire2", 0, 1)
           
        # if a component is in the third smart zone but not the chassis, wait to find chassis before firing weapons
        if self.compinzone3 == 1 and self.botinzone3 == 0:
            self.comptimer3 += 1
           
        if self.botinzone3 == 1:
            self.comptimer3 = 0
           
        if self.weapons and (self.botinzone3 == 1 or (self.comptimer3 >= self.NoChassisTime and self.compinzone3 == 1)):
            for trigger in self.triggers1: self.Input("Fire3", 0, 1)
           
        # if a component is in the fourth smart zone but not the chassis, wait to find chassis before firing weapons
        if self.compinzone4 == 1 and self.botinzone4 == 0:
            self.comptimer4 += 1
           
        if self.botinzone4 == 1:
            self.comptimer4 = 0
           
        if self.weapons and (self.botinzone4 == 1 or (self.comptimer4 >= self.NoChassisTime and self.compinzone4 == 1)):
            for trigger in self.triggers1: self.Input("Fire4", 0, 1)
                       
        bReturn = AI.SuperAI.Tick(self)
       
        return bReturn

           
        return AI.SuperAI.Tick(self)

    def InvertHandler(self):
        # fire all weapons once per second (until we're upright!)
        while 1:
            for trigger in self.trigger2:
                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.compinzone1 = 1
                    if chassis:
                        self.botinzone1 = 1
                if direction == -1:
                    self.compinzone1 = 0
                    if chassis:
                        self.botinzone1 = 0
        elif id == 2 and self.weapons:
            if robot > 0:
                if direction == 1:
                    self.compinzone2 = 1
                    if chassis:
                        self.botinzone2 = 1
                if direction == -1:
                    self.compinzone2 = 0
                    if chassis:
                        self.botinzone2 = 0
        elif id == 3 and self.weapons:
            if robot > 0:
                if direction == 1:
                    self.compinzone3 = 1
                    if chassis:
                        self.botinzone3 = 1
                if direction == -1:
                    self.compinzone3 = 0
                    if chassis:
                        self.botinzone3 = 0
        elif id == 4 and self.weapons:
            if robot > 0:
                if direction == 1:
                    self.compinzone4 = 1
                    if chassis:
                        self.botinzone4 = 1
                if direction == -1:
                    self.compinzone4 = 0
                    if chassis:
                        self.botinzone4 = 0
 
        return True
       
AI.register(PopupMultiZone)

Would like some feedback on that one... did i did it right ?

Offline JoeBlo

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #648 on: June 11, 2010, 03:32:28 AM »
very nice work...

just a point of interest you may or may not want to know...

Madiaba previously made a python for up to 7 "fire" buttons, 7 SZ's, Srimech and can also handle combo firing of controls with other SZ's also

I used a slightly tweaked verson for RY3NO in RAW 2 since that had 4 SZ's and a Srimech

all it would lack is the popup's chassis finding code piece...

Offline Reier

  • Rieir
  • *
  • Posts: 8569
  • Rep: 8
  • I GOT 3RD IN RAW1
    • https://www.youtube.com/c
  • Awards old BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #649 on: June 11, 2010, 03:14:27 PM »
ALERT- Another WS coming up...
voted best bot builder two times and counting babayy. the best ra2 builder who has never won an actual tournament match
ReiAI pack for Ironforge
My drawings, and my webcomics
Why online PVP will save RA2
The problem with competitive IRL in RA2
I'm fine with hugging reier

Offline Clickbeetle

  • *
  • Posts: 3375
  • Rep: 21
  • In Soviet Russia, bugs stomp YOU!
  • Awards BOTM Winner
    • View Profile
    • Beetle Bros site
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #650 on: June 13, 2010, 11:32:38 PM »
Would like some feedback on that one... did i did it right ?


Well does it work?  If so, yes. :P


I don't see any obvious problems with it.  It should work.

To lack feeling is to be dead, but to act on every feeling is to be a child.
-Brandon Sanderson, The Way of Kings

Offline Badnik96

  • tired of your shit
  • *
  • Posts: 17536
  • Rep: 3
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #651 on: June 22, 2010, 06:43:55 PM »
Hey, just wondering:

Is there an AI that once a robot is flipped over and there is an 'invertible':False line in the bindings it drives in reverse until reverted? And if not, could someone make it? I'd like it so my latest AW can self-right.

Offline Virus Bomb

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #652 on: June 22, 2010, 07:52:33 PM »
use VertSpinner.py?

Offline Badnik96

  • tired of your shit
  • *
  • Posts: 17536
  • Rep: 3
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #653 on: June 22, 2010, 09:18:12 PM »
No, it needs to use the...

OMG I JUST GOT IT!

Offline JoeBlo

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #654 on: June 22, 2010, 10:12:41 PM »
I'd like it so my latest AW can self-right.

so you need it to reverse to self right correctly ?

what you need is BountyHunter.py it handles sremech and reverse driving

Offline Badnik96

  • tired of your shit
  • *
  • Posts: 17536
  • Rep: 3
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #655 on: June 22, 2010, 11:29:26 PM »
Does it handle a spinning weapon?

Offline JoeBlo

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #656 on: June 22, 2010, 11:55:15 PM »
nope only Fire, Srimech, DriveBack, LeftRight and Forward

Offline Pwnator

  • *
  • Posts: 6676
  • Rep: 15
  • Awards BOTM Winner
    • View Profile
    • http://pwnator.tumblr.com
    • Awards
  • See profile for gamer tags: Yes
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #657 on: June 23, 2010, 02:30:32 AM »
The Inglourious Basterd uses BountyHunter. Just place a huge-ass SZ around your bot, and rename 'Spin' to 'Fire'.
Clash Cubes 1 - Grey Matter (Runner-Up)
King of Karnage - Sideshow Freak (Runner-Up, Best Engineered)
Rust In Pieces - Paper Cut 3 (Grand Champion, Most Dangerous Bot)
Wheely Tag Tournament - Ion Thruster (Grand Champion, along with Ounces' DiSemboweLment)
UK vs USA - Dark Striker (Grand Champion)
Rust In Pieces 2 - Claymore (Runner-Up, Favourite Bot)
BBEANS 6 - Infection 4 (Runner-Up)
RA2 Team Championships - Serious Business, Skeksis (Runner-Up, along with Scrappy, S_M, and Badnik)
RA2 Team Championships 2 - The Other Stig (Runner-Up, along with Scrappy, S_M, Badnik, 090901, and R1885)
Replica Wars 3 - Abaddon (Runner-Up, Luckiest Bot)
BroBots - wheebot & yaybot (Runner-Up)
Robo Zone 2 - Dipper (4th place, Survival Champion, & Best Axle Bot)
ARBBC - The Covenant (3rd place, BW Rumble Winner, Most Feared BW)

Offline Badnik96

  • tired of your shit
  • *
  • Posts: 17536
  • Rep: 3
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #658 on: June 23, 2010, 01:09:23 PM »
I haz an idea on how to self right it using VertSpinner.

You have to wire the spinner to the weapon analog and then on the other part of the analog instead of wiring the weapon to spin n reverse you just wire the drive in reverse! I'M A GENIUS!

Offline JoeBlo

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #659 on: June 23, 2010, 07:30:30 PM »
or you could just add a small change to a few lines in omni from memory :P