# So, folks. AI battle?

**URL:** <https://forum.kirupa.com/t/so-folks-ai-battle/205348>\
**Category:** design\
**Created:** [October 28, 2006, 9:58am UTC](https://forum.kirupa.com/t/so-folks-ai-battle/205348 "2006-10-28T09:58:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![puppy](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@puppy](https://forum.kirupa.com/u/puppy)\
**Post date:** [October 28, 2006, 9:58am UTC](https://forum.kirupa.com/t/so-folks-ai-battle/205348/1 "2006-10-28T09:58:33Z")

</div>

Seing how previous battle never started because noone ever come up with any sort of ready-to-use environment, i have decided to do [something](http://myjobsuck.com/exp/aibattlefield.html) about it. In a few hours I am flying away for a business trip, so you will have enough time to play with this stuff, find some bugs in it, discuss improvements, battle rules, judgement procedure etc.

Here’s simple short-term memory no-ai-at-all script to get you started:

```auto
if (!this.inHasBullet) {
    // no bullet, let's get it
    var bulletAt = -1;
    for (var i=0; i< this.inColors.length; i++) {
        if (this.inColors* == 2) {
            bulletAt = i; break;
        }
    }
    // go up until we see it
    this.outMoveAngle = (bulletAt < 0) ? 27 : bulletAt;
    this.outMoveSpeed = this.inMaxSpeed;
} else {
    // look around for enemy
    var enemyAt = -1;
    for (var i=0; i< this.inColors.length; i++) {
        if (this.inColors* == 1) {
            enemyAt = i; break;
        }
    }
    if (enemyAt > -1) {
        // throw the bullet
        this.outThrowBullet = true;
        this.outThrowAngle = enemyAt;
 this.trace("Throwing @" + enemyAt);
    }
    // up we go
    this.outMoveAngle = 27;
    this.outMoveSpeed = this.inMaxSpeed;
}

```

So, will see you in three weeks.

:rd:
