Author Topic: Incorporating custom tactics - no more messing with tactics.py  (Read 2184 times)

Online apanx

Add your tactic to your AI.

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

class HaltAndCatchFire(AI.Tactic):
    name = "HaltAndCatchFire"
   
    def Evaluate(self):
        self.priority = 170
               
    def Execute(self):
            return True
           
class FBS(AI.SuperAI):


Then instead of the usual self.tactics.append(Tactics.HaltAndCatchFire(self)), write this
Code: [Select]
self.tactics.append(HaltAndCatchFire(self))

Offline Clickbeetle

  • *
  • Posts: 3375
  • Rep: 21
  • In Soviet Russia, bugs stomp YOU!
  • Awards BOTM Winner
    • View Profile
    • Beetle Bros site
    • Awards
Incorporating custom tactics - no more messing with tactics.py
« Reply #1 on: July 26, 2009, 05:41:29 PM »
Nice.  Tactics.py is useful for universal tactics, but it would be a pain to edit for stuff no other bot is going to use.

Hey... you could feasibly give all rammers custom tweaked tactics this way.  Because some are better at pushing, while others need to back up and charge a lot.

Thanks apanx.

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