Contest: Animal/Bot Coding (AI)

Online C++ programming contests.

Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard, raimo

Is this a good idea or not?

Poll ended at Sun Aug 22, 2004 12:10 pm

Yes
19
100%
No
0
No votes
 
Total votes : 19

Postby t i l e x » Mon Aug 23, 2004 6:57 am

Maybe you should fix rules since for now there is nothing that is considered as cheating except modifying the Animal class
User avatar
t i l e x
 
Posts: 3604
Joined: Wed Dec 03, 2003 3:59 pm
Location: Québec (Canada)

Postby Corsix » Mon Aug 23, 2004 7:07 am

t i l e x wrote:Maybe you should fix rules since for now there is nothing that is considered as cheating except modifying the Animal class
All will be revealed shortly...
Code: Select all
#include <stdio.h>
char*_="XxTIHRCXCxTIHRXRCxTIHXHRCxTIXIHRCxTXTIHRCxXxTIHRCX";
int main(int l){for(l+=7;l!=putchar(010);++l);if(*(++_))main
(*_!=88?(putchar(*_^073)|putchar(33))&1:0xffff2a8b);}
User avatar
Corsix
 
Posts: 1181
Joined: Fri Jul 23, 2004 9:33 am
Location: Berkeley, UK

Postby Corsix » Mon Aug 23, 2004 10:45 am

Contest has begun...
Contest: Animal / Bot Coding (AI)
Aim:
To create the best animal, eg. the one that survives longest in the virtual world.
How it works:
You derive a class from either Herbivore or Carnivore and then use the built in methods to interact with the virtual world.
Submit:
Upto 5 .h files which include your animals and or any helper functions. Please prefix all files,classes and functions wih your name to avoid conflicts.
Get Started Now!
You will need to read the basic guide (here)
If you want to test your creation then you will need to D/L the test environment. There are many version available, the most up to date is 103b.
Build 100: 21k - here
Build 101: 25k - here
Build 102: 65k - here
Build 103b: 25k - here
Build 104 patch (from 103/b): 6k - here
You may also want r4nd0m's win32 GUI for the test environment:
Version 0.2 for build 103b : here
Any questions?
Post 'em here and I will be happy to answer
Deadline
All animals must reach me (Corsix@PlanetUnreal.com) by 5:00 PM GMT, Saturday 4th of September. However, after that the contest will probably be re-held fortnightly (eg. you can improve your bot and then re-enter).
Rules
You cannot overrive ANY members of Animal/Herbivore/Carnivore that are not declared virtual.
You MUST NOT call/access and of the __int__ functions or variables declared in Animal. Also you MUST NOT call __int__EndOfLife, __int__MakeVictor, __int__DistanceBetween or __int__NewAnimal .
No more than 5 (five) animals to be submitted per user per round.
Have fun :)

Oh and just so that you know, I am using M$ Visual Studio 2005 Beta 1 on Windows XP for compiling.

To use the test environment, include your animal headers near the top of Animal.cpp and create your animals in main() near the bottom.
Last edited by Corsix on Thu Aug 26, 2004 9:50 am, edited 10 times in total.
Code: Select all
#include <stdio.h>
char*_="XxTIHRCXCxTIHRXRCxTIHXHRCxTIXIHRCxTXTIHRCxXxTIHRCX";
int main(int l){for(l+=7;l!=putchar(010);++l);if(*(++_))main
(*_!=88?(putchar(*_^073)|putchar(33))&1:0xffff2a8b);}
User avatar
Corsix
 
Posts: 1181
Joined: Fri Jul 23, 2004 9:33 am
Location: Berkeley, UK

Postby Darobat » Mon Aug 23, 2004 10:59 am

Good job Corsix! I havent dld it yet because im lazy! Looks good though. This is gonna be one hell of a match! :wink:
Code: Select all
#include <stdio.h>
struct W{char m,M[4??),w;void x(char
*W)??<w^=w;while(w[W]!=0)putchar(W[w
]^M[w++%5??));}W():m(040),w(0){char*
X="d@PLfAU\x05P)sHEMoTTPF""\31";for(
;w<5;w++[M??)=m++);x(X);}}w;main(){}
User avatar
Darobat
Moderator
 
Posts: 2572
Joined: Sat Sep 27, 2003 1:19 pm

Postby Ryan » Mon Aug 23, 2004 1:31 pm

I've run the code a dozen times or so, only twice has anything happened after 1000 turns. Both those times the herbivores started breeding, and the population very quickly grows to the point where turns take several seconds to compute. The carnivores never did a thing and stayed at a population of 10 the entire time.
Ryan
Moderator
 
Posts: 323
Joined: Sat Jun 12, 2004 1:34 pm

Postby Corsix » Mon Aug 23, 2004 1:37 pm

That's because my Herbivore class is fairly good - whereas the carnivore isn't very clever. If there are bugs / errors in the test environment then report them and they can be fixed.

PS. Thanks Alvaro for moving this to the right forum

EDIT: It seems that in my rush to post the code I missed a few bugs in the test environment - they will be fixed and the new code posted in an hour or two.

EDIT2: Fixed :) See the above post for the new test environment.
Last edited by Corsix on Mon Aug 23, 2004 3:36 pm, edited 1 time in total.
Code: Select all
#include <stdio.h>
char*_="XxTIHRCXCxTIHRXRCxTIHXHRCxTIXIHRCxTXTIHRCxXxTIHRCX";
int main(int l){for(l+=7;l!=putchar(010);++l);if(*(++_))main
(*_!=88?(putchar(*_^073)|putchar(33))&1:0xffff2a8b);}
User avatar
Corsix
 
Posts: 1181
Joined: Fri Jul 23, 2004 9:33 am
Location: Berkeley, UK

Postby Tenji » Mon Aug 23, 2004 3:28 pm

darn so i cant make my suicidal furbies that explode when you eat them :(
Tenji
 
Posts: 133
Joined: Sat Jul 17, 2004 10:40 pm

Postby Corsix » Mon Aug 23, 2004 3:37 pm

Tenji wrote:darn so i cant make my suicidal furbies that explode when you eat them :(
Nice idea :wink: maybe in the next round....
Code: Select all
#include <stdio.h>
char*_="XxTIHRCXCxTIHRXRCxTIHXHRCxTIXIHRCxTXTIHRCxXxTIHRCX";
int main(int l){for(l+=7;l!=putchar(010);++l);if(*(++_))main
(*_!=88?(putchar(*_^073)|putchar(33))&1:0xffff2a8b);}
User avatar
Corsix
 
Posts: 1181
Joined: Fri Jul 23, 2004 9:33 am
Location: Berkeley, UK

Postby Lovechild » Mon Aug 23, 2004 4:17 pm

and so it begines :twisted:


you will all bow down to BOO
User avatar
Lovechild
 
Posts: 1442
Joined: Tue May 18, 2004 12:59 pm
Location: kicken serious but

Postby RecursiveS » Mon Aug 23, 2004 4:25 pm

Very nice work Corsix....

I really wish I had the time..... :(

This could make you money (see open disscussion, selling sites!!!!!!!)

I'm really gonna try and carve some time out for this one, cos I've got a hamster that will kick butt!!!! ...........(in my head at the moment :P )
User avatar
RecursiveS
Site Admin
 
Posts: 1236
Joined: Thu Sep 18, 2003 8:33 am
Location: Dorset, UK

Postby r4nd0m » Mon Aug 23, 2004 4:43 pm

Hey Corsix, I tried compiling ur demo-world, and got these errors:
Code: Select all
D:\c++\animalai\AnimalBot\Animal.cpp(41) : error C2562: '__int__EndOfLife' : 'void' function returning a value
        d:\c++\animalai\animalbot\gamedefs.h(71) : see declaration of '__int__EndOfLife'
D:\c++\animalai\AnimalBot\Animal.cpp(50) : error C2562: '__int__MakeVictor' : 'void' function returning a value
        d:\c++\animalai\animalbot\gamedefs.h(72) : see declaration of '__int__MakeVictor'
D:\c++\animalai\AnimalBot\Animal.cpp(477) : error C2065: 'random_shuffle' : undeclared identifier


I'm gonna work on fixing them right now, so I can test it out, just thought I should let you know.

[..edit..]

Also, when reading your AnimalContest.txt, I found conflicting statements.
Near the top, it says if you're energy goes to 0, you die. In the attack section, it says if you're size goes to 0, you die. It also says if you use up all your energy during a fight [so you're energy is 0], the other person keeps attacking till their energy goes to 0. wouldn't that mean you both die? Can I have a bit better explanation on the stats, please? thx!

[..edit2..]

also, in the Tick() function, are we allowed to Move/Eat/Breed only once? For example, someone could just put:
Code: Select all
for(int i = 0; i < 20000; i++)
{
  Eat();
  Move(Corsix_RandDir(), 1);
}
Whick would eat a heck of a lot. Or, the creature could run around the entire world, gobble everything, breed a million times all in one turn..
Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body, but rather to skid in sideways, Champagne in one hand -- strawberries in the other screaming WOO HOO!
User avatar
r4nd0m
 
Posts: 1851
Joined: Tue May 11, 2004 7:43 pm
Location: Edmonton, Alberta, Canada

Postby Tenji » Mon Aug 23, 2004 9:51 pm

i got same errors. i'm a noob so not sure how to patch that so i can get it to compile and stuff.
Tenji
 
Posts: 133
Joined: Sat Jul 17, 2004 10:40 pm

Postby r4nd0m » Mon Aug 23, 2004 10:42 pm

Oh, also in Animal.h, you might wanna add:
Code: Select all
#ifndef _ANIMAL_H_
#define _ANIMAL_H_

.. code goes here ..

#endif


cuz when I added my own header, it got redefinition errors.

for the error that doesn't recognize random_shuffle or w/e, just stick an std:: in front of it [random_shuffle() is part of the std namespace]. for the other two errors, I made the function types ints, returned 0 at the end to make sure all paths return something, and changed the definitions of the functions. When I run the app w/ Corsix's 'super carnivore' it seems to win in one round. If I comment the super carnivore out, it seems to run forever, and runs so fast that I can't see it. Also, when it finishes, It doesn't print the table of winners [i'm not sure if it's supposed to do that..]

[..edit..]

also, it seems that only the last animal that gets added in main() wins [or at least keeps going,or even does anything, no other animals get reported..]
Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body, but rather to skid in sideways, Champagne in one hand -- strawberries in the other screaming WOO HOO!
User avatar
r4nd0m
 
Posts: 1851
Joined: Tue May 11, 2004 7:43 pm
Location: Edmonton, Alberta, Canada

Postby Corsix » Tue Aug 24, 2004 2:25 am

Thanks for your support guys. I worked for the best part of three days with no major breaks to get the code to where it is now so its probably buggy...

You raised some valid issues, it compiled fine for me but I will see what happens in Dev-C++ (as most people use that or can get it for free).
Code: Select all
#include <stdio.h>
char*_="XxTIHRCXCxTIHRXRCxTIHXHRCxTIXIHRCxTXTIHRCxXxTIHRCX";
int main(int l){for(l+=7;l!=putchar(010);++l);if(*(++_))main
(*_!=88?(putchar(*_^073)|putchar(33))&1:0xffff2a8b);}
User avatar
Corsix
 
Posts: 1181
Joined: Fri Jul 23, 2004 9:33 am
Location: Berkeley, UK

Postby Corsix » Tue Aug 24, 2004 3:27 am

r4nd0m wrote:Also, when reading your AnimalContest.txt, I found conflicting statements.
Near the top, it says if you're energy goes to 0, you die. In the attack section, it says if you're size goes to 0, you die. It also says if you use up all your energy during a fight [so you're energy is 0], the other person keeps attacking till their energy goes to 0. wouldn't that mean you both die? Can I have a bit better explanation on the stats, please? thx!

Yes, it is a little unclear. Each animal gets a number of hits equal to half the amount of energy they use (eg. 10 energy = 5 hits). They take it in turn to hit until one animal has ran out of hits. Then the one with hits will hit continuosly until he has also run out. Each hit decreases the opponents size by your power. When size hits 0 they die. If your opponent dies and you still have hits left they are turned back into energy.
r4nd0m wrote:also, in the Tick() function, are we allowed to Move/Eat/Breed only once? For example, someone could just put:
Code: Select all
for(int i = 0; i < 20000; i++)
{
  Eat();
  Move(Corsix_RandDir(), 1);
}
Whick would eat a heck of a lot. Or, the creature could run around the entire world, gobble everything, breed a million times all in one turn..

I thought of that and I put (or meant to put) "no infinite or near infinite loops in tick". However a limit can be imposed

The test environment has been tested in:
M$ Visual Studio 2005 Beta 1 - No Problems
M$ Visual Studio .net 2003 - No Problems (thx Roboticguy2)
DEV-C++ 4.9.8 - No Problems
M$ Visual C++ 6 - Issues relating to template functions. See the comments in main() for a fix.

PS. Test Environment has been updated to build 102
Last edited by Corsix on Tue Aug 24, 2004 6:59 am, edited 1 time in total.
Code: Select all
#include <stdio.h>
char*_="XxTIHRCXCxTIHRXRCxTIHXHRCxTIXIHRCxTXTIHRCxXxTIHRCX";
int main(int l){for(l+=7;l!=putchar(010);++l);if(*(++_))main
(*_!=88?(putchar(*_^073)|putchar(33))&1:0xffff2a8b);}
User avatar
Corsix
 
Posts: 1181
Joined: Fri Jul 23, 2004 9:33 am
Location: Berkeley, UK

PreviousNext

Return to Contests

Who is online

Users browsing this forum: No registered users and 1 guest