Tron Driver FLAs
Time for an AI flash off! ASCHKIN SKRIP 3 POINT OH!
What is it? It is a TRON BATTLE!
It is a 4 player free for all AI challenge!
Now, in order to make a bot, you don't alter the FLA in any bit. Pick a bot.as file from the zip to play with. Any one is fine. When you send me your bots for the battle, you will rename your bot's file to YOURNAMEBOT.as
In the bot's file, you put all the code for your bot. My default bots are STUPID! If you want to really test your bot's skill, pit it against itself, or make more than one and see which one is victorious in the end. If you want to be ballsy and try a 1v1 battle, simply make 2 of the bots move up then down, and they will kill themselves.
====WHAT YOU ARE ALLOWED TO DO====
if(!bot.defined){ //do not modify this
bot.defined = true; //or this
setMyColor(0xCC3322); //set your color
setMyName("Glaiel Bot"); //set your name
//DECLARE YOUR VARIABLES HERE
bot.stuff = 12345;
}
This should be at the top of your .as file. Anything in this block will be executed once and once only, meaning if you want to declare variables for your bot, here is where you declare them. ANY DECLARED VARIABLES MUST BE MADE ON THE "bot" OBJECT! Anything else will just be temporary, and you will lose it after the function exits.
Do not worry about potential variable name clashes with other bots. The bot object is a reference to your bot and your bot only. It is different across different .as files, you do not need to worry about this.
Remember to set your color and your name so you can be unique. These have nothing to do with the actual gameplay. You can't set your bot's color to white, it automatically makes it 1 less than white.
You can't name your variables x, y, dead, color, or defined. These names clash with what's already on the bot. Do not reference or change these variables in your code, there are functions to do that for you.
Any variables you declare outside of the bot object must be declared using var, and will be terminated when the function exits. Because of flash's scoping retardedness, these could potentially clash with driver names. Be wary of this, and be safe with your names.
====FUNCTIONS====
These are the only functions you are allowed to call from your file
getMyPos()
getEnemyStatus()
getWallAtPoint(x, y)
randomNumber()
setMyColor(color)
setMyName(name)
getMyPos returns an array, where element 0 is your x position and element 1 is your y position.
getEnemyStatus returns an array with 3 arrays in it, each one representing a lost of statuses about other bots.
[[x, y, dead?]
[x, y, dead?]
[x, y, dead?]]
dead is true of the other bot is dead, and false if it isn't. The bots will always be reported in the same order.
getWallAtPoint takes an x and a y and returns true if there is a wall and false if there isn't. Out of bounds points will return true, so don't worry too much about bounds checking. The level is 70x50 by default in case you need to know.
randomNumber returns a psuedo-random number between -2^31 and 2^31.
randomNumber()%N will return a random number between 0 and N (I believe, might want to abs() it also). DO NOT use the built in random() function. This one gives a predictable pattern of random numbers, unlike flash's built in function which really is random.
You can use all the built in math functions besides random() if you think you need to.
setMyColor(color) will change the color of your bot. Do this as often as you want if you want pretty rainbow walls. It's fun.
setMyName(name) will set your name. This shows up when you win, which hopefully you will.
These are the ONLY functions you can reference in your code.
====Making the Decision====
You will return either UP, DOWN, LEFT, or RIGHT from your function.
UP, RIGHT, DOWN, and LEFT represent 0, 1, 2, and 3, respectively. You can use this to your advantage and add or subtract 1 from a name to turn right and left from the direction you're facing, as long as you remember to wrap the value back into 0-3. Any outside bounds values will default to UP, and if you don't return a value it will default to UP.
return UP;
return LEFT;
return RIGHT;
return DOWN;
Anyway, it's time to start battling! Someone can port this to AS2 if they want, bot files should be compatible for both drivers since the AS3-specific stuff is in the driver and not the .as files.
When you are done with your bot, and only when you are REALLY DONE and finally done with your bot, email me the .as file to glaielgamesmail@comcast.net, named YOURNAMEbot.as
WHAT NOW?