use
elseif r > 3 then ...
instead of the endless
if r == 4
if r == 5
if == 6
...
---general blabla incoming---
Kernel Panic is relatively easy for AI because it is easy to play.
Not easy to be
good at but be
decent at and "generally avoid total failure:"
In the sockets (factories) you can only make one type of unit, so obviously you spam this.
In your mainbuilding you have some special units but which one of them you make is not that criticial. There is no way to end up with a bunch of "useless" units like making only AA bots in *A mods.
Also no resources means the AI does not need to worry about stalling. Just make a constructor from time to time, send it to free geovents and thats it.
Apart from walls (no really needed) that is also the only base building you need to worry about, compare to *A where base building and building placement (turrets) is very important.
For the military side, just give a fight command for all units to nearest enemy socket.
Of course later on you might want more strategy, retreating units etc but for the start I find it helpful if you think
what is the dumbest possible way to play this game.
ie for Spring Tanks:
1) select all your units and send them to the nearest enemy flag.
2) If you manage to pick up a flag, return to base.
Those 2 rules alone allow you/an AI to play the game.
Now add something like
3) if a unit is too far away from allies, go to the nearest ally
and units will try to stick together, like they want to attack in a team or something.
That is all ST's AI does for now.
If there was something to
4) avoid enemies
it would be pretty good I guess.
For CT drones faction, there are not that many options either when it comes to unit building.
1) at start, you get one engineer.
Now you can either
a) morph to a mining tower b) clone him c) make a factory
-> a) makes no sense if it is your only/first unit [and you have resources]
b) & c) are kind of similiar
2) engineers that have nothing to do should basically always morph to mining towers to get resources.
3) only two factories: ground & air. It does not matter that much which unit you make, basically any type will do. (apart from shields, if you spam only those its useless)
again, dumbest posssible way to play.
for example building placement for CT drones:
mining towers: obviously near resource rocks.
If you deploy at the nearest rocks, at rocks not occupied by the enemy or at rocks on high ground does not matter for start.
Later you might want not to suicide engineers into the enemy base but to get it working, it does not matter that much.
Same for factories: does not really matter where you put them.
Pro points if you hide them from enemy but for start it is more important that you
have some factories instead of where they are.
Also see:
I found the ultimate build queue!
Weapon v unit bonus