Computer Science Canada

Turing bot contest!

Author:  zylum [ Tue Apr 11, 2006 12:09 am ]
Post subject:  Turing bot contest!

this is sort of similar to all those other robot contests but cheaper and in turing. i have created a rough engine to demonstrate the basic structure of the contest. basically you can have a number of robots playing at a time. you are to code a procedure which controls your bot to destroy the enemies. the last bot standing wins.

at the moment that are three commands that you can use. these include:

shoot(p : int) which shoots a bullet in the current direction you are facing.

move(p : int) which moves you PLAYER_SPEED units forward in the direction you are facing.

rotate(p, d : int) which rotates your bot d degrees.

in each case p represents the player number.


you also have access to a number of constants which include:

const SHOOT_DELAY := 20
const DAMAGE := 20
const PLAYER_SPEED := 2
const PLAYER_ROTATION := 10
const PLAYER_RADIUS := 12
const BULLET_SPEED := 3
const BORDER := 20

these are all fairly self explanitory.

also you have read only access to bullet and player data.

well thats basically it... here is a demo with 5 bots which are quite dumb.. they use random brownian motion and shoot whenever they can..

so what do you guys think? for the future i was think of adding levels with walls and such and maybe even team play.

Author:  MysticVegeta [ Tue Apr 11, 2006 9:15 am ]
Post subject: 

too bad I sux0rz at trig, I would certainly try, the deadline is?

Author:  Andy [ Tue Apr 11, 2006 9:25 am ]
Post subject: 

why didnt we just do a robocode one for java? it's much easier.. and i have my bots already made

Author:  codemage [ Tue Apr 11, 2006 9:47 am ]
Post subject: 

If the AI routines are pulled into a procedure like so

code:
proc brownianAI (p : int)
    if players (p)._shootDelay = 0 then
        shoot (p)
    elsif Rand.Int (0, 1) = 0 then
        move (p)
    else
        rotate (p, (Rand.Int (0, 1) * 2 - 1) * PLAYER_ROTATION)
    end if
end brownianAI


...the player routines can be inserted a little easier. ie, here I've substituted my own proc for player 1 in the main loop.

code:
loop
    cls
    update
    draw
    exit when upper (players) <= 1
    delay (100)

    playerai (1)
    for i : 2 .. upper (players)
        brownianAI (i)
    end for
end loop
[/quote]

Author:  beard0 [ Wed Apr 12, 2006 12:36 pm ]
Post subject: 

May I suggest this change to the engine? What I've done is to save the procedure being used to control each bot as part of the player data. It should make it much easier to incorporate separate bot code for each bot.

Author:  zylum [ Wed Apr 12, 2006 9:23 pm ]
Post subject: 

yeah i admit its pretty shitty code ATM. i jsut wanted to know what you guys thought about the contest? how many people would be interested in doing it? if no one wants to do it then i dont want to waste my time coding up the actual game engine...

Author:  beard0 [ Wed Apr 12, 2006 10:52 pm ]
Post subject: 

I'd be willing to put in some time working on a bot. As MysticVegeta says, we'd need some kind of time-frame.

Author:  zylum [ Wed Apr 12, 2006 11:01 pm ]
Post subject: 

sounds cool. ill set a deadline as soon as i finish the interface... how about making it so that there are walls and stuff with a level editor so that each user can submit a level tailor made to their AI. or maybe that would be too complex for beginners..

Author:  [Gandalf] [ Wed Apr 12, 2006 11:15 pm ]
Post subject: 

I'll participate, though I've been avoiding Turing for the past days I'm not completely reformed. Smile

How exactly would the competition part work though?

Author:  zylum [ Wed Apr 12, 2006 11:25 pm ]
Post subject: 

we would simulate a bunch of battles. we'd have to decide how many people would be in each round... it could be a tournament style contest.. i dunno what do you guys think? im thinking i could get the engine done either tomorrow or friday... hopefully we could get a few trial submissions by saturday to test out the interface.

Author:  beard0 [ Thu Apr 13, 2006 12:43 am ]
Post subject: 

If you want to get some submissions for Saturday, I would definately suggest that the competition take place in one large "room" - without any walls. Also, you really need to have the competition interface down: what is allowed to be read; what actions can be taken; and how is each done, before we can start developping bots. Since you are talking about developping one aspect while we develop another, you need to layout the specifications.


Edit: Also, making a procedure leaves room for someone to make multiple moves in one turn - why not have each person make a function which returns an integer: 0 for shoot, 1 for move forward, 2 to turn clockwise, and 3 to turn couterclockwise for example

Author:  zylum [ Thu Apr 13, 2006 12:56 am ]
Post subject: 

thats a great idea! yes a function would be best. i'll keep that in mind when creating the interface

Author:  ZeroPaladn [ Thu Apr 13, 2006 9:15 am ]
Post subject: 

I would be willing to attempt to make a bot for the contest, just what are the parameters, and are there any restrictions to code size?

Author:  alpe [ Thu Apr 13, 2006 12:18 pm ]
Post subject: 

I would participate in this.

Author:  zylum [ Fri Apr 14, 2006 2:42 pm ]
Post subject: 

ok here is the engine...

your task will be to implement a procedure which alters a global variable command. you are to assign command a value between 1 and 4 inclusive.

1: shoots a bullet in the current direction you are facing at a velocity BULLET_SPEED

2: moves your bot forward PLAYER_SPEED units

3: turns your bot right ROTATION_SPEED degrees

4: turns your bot left ROTATION_SPEED degrees

to prevent users code from calling the update, initialize or makeCommad method, these methods have a password parameter which must match the code in the class. i will change this code before the contest so no one will have access to these methods. if anyone has a better solution to this problem please let me know.

the methods you do get access to are:

getPlayerData(i : int):Player -> returns the data for player 'i' of type Player
getBulletData(i : int):Bullet -> returns the data for bullet 'i' of type Bullet
numAlive:int -> returns the number of bots which are still alive
getNumPlayers -> returns how many players there are in the battle (both alive and dead)
getNumBullets -> returns how many bullets there are on the screen (only alive)

where i have comments, just replace them with the appropriate code... you can declare your own variables and such, just dont mess with the other vars... if anyone has any better idea how to make this more secure let me know...

well thats pretty much it. lets see some submissions!!!

Author:  zylum [ Fri Apr 14, 2006 7:54 pm ]
Post subject: 

wait... forget that engine.. i have an idea for a better way of implementing it. the basic idea will be the same so if you want to test your AI you can still do so with engine2

Author:  alpe [ Sat Apr 15, 2006 2:28 pm ]
Post subject: 

Is there a way to access which player number one's procedure is acting on behalf of? Maybe that could be inputted as a parameter.

Hopefully I'm not missing something obvious in your game engine code.

Author:  zylum [ Sat Apr 15, 2006 3:23 pm ]
Post subject: 

i dont quite understand what you mean... can you elaborate?

also, my new idea isnt working out so well so engine2 is what we will use for now unless someone comes up with a better idea to implement it...

Author:  alpe [ Sun Apr 16, 2006 12:39 am ]
Post subject: 

How would you know which player's data is your own? Like if I'm looping through each player's set of info, how would a bot determine if the info was its own?

(I hope that makes more sense?)

Author:  zylum [ Sun Apr 16, 2006 12:59 am ]
Post subject: 

oh yes.. perhaps i should have mentioned that Embarassed your proc should have one parameter of type int. when your proc is called, it will be passed your bots number.

Author:  [Gandalf] [ Fri Apr 21, 2006 4:01 am ]
Post subject: 

Are we giving up on this contest (like usual Sad), or is it still going to happen? It looked very promising... I can say I'll enter for sure since I've already created a fairly crappy AI.

Author:  zylum [ Fri Apr 21, 2006 1:08 pm ]
Post subject: 

im still not satisfied with the contest engine... but if you guys dont have a problem with it then its fine with me..

Author:  ZeroPaladn [ Fri Apr 21, 2006 1:22 pm ]
Post subject: 

ARGH! damnit im completely clueless on how to make a bot. sorry, but untill i can get better, im out. Crying or Very sad


: