It is currently Sat May 25, 2013 3:06 pm Advanced search

The open source your ant bot topic

Share and discuss ideas for your entries here.

Re: The open source your ant bot topic

Postby KonaEarth » Mon Dec 19, 2011 4:36 pm

I'd be happy to share but rather than bore everybody with my entire code base (I don't wish that headache on anybody), I posted just a part that I thought was interesting.
http://forums.aichallenge.org/viewtopic.php?f=24&t=2181

Like with any program, those very first few lines of code can often make a big difference in the long run. With ants, what's the first problem you had to deal with? Probably adding two coordinates together then getting them to wrap around the map correctly. It's not too difficult but make a sloppy solution and you'll be living with it forever. An elegant solution is much easier to live with and can more than pay for itself.

I'm not say my vector class is all that wonderful. I'm just saying that I'm glad I had it instead of having to pass around row,column pairs everywhere.
KonaEarth
Major
 
Posts: 33
Joined: Thu Nov 25, 2010 1:51 am

Design overview

Postby Memetix » Mon Dec 19, 2011 5:27 pm

I'm a psychotherapist, not a programmer, and I'm not sure how best to share my code ... so I have attached it.
I have shared most of the concepts on the forums already, but I have written an overview on my website and I do divulge how I pulled the concepts together and a few of the tweaks I made along the way.

My bot peaked at skill level 93.76 (2nd place at the time).

http://www.blackmoor.org.uk/AI.htm
Attachments
Version21.zip
The only files of interest are Ants and Location (.java) the rest are the starter package
(15.38 KiB) Downloaded 217 times
Memetix
Major
 
Posts: 39
Joined: Tue Nov 08, 2011 3:53 pm

Re: The open source your ant bot topic

Postby lama3oid » Mon Dec 19, 2011 5:39 pm

http://lama.od.ua/ex/lama3oid_v18.zip
profile: http://aichallenge.org/profile.php?user=453
was maximum on #34 a couple of weeks ago. current version is much smarter, but my oponents also became much smarter, so hard to predict which place I'm going to take. I think it's gonna be somewhere around #50, but won't be surprised if I take higher or much lower position :)
The code is a little bit messy since it's my first C# program, but not too much.
p.s. some comments are in russian -- I wasn't going to post the code :)
lama3oid
Captain
 
Posts: 21
Joined: Wed Dec 07, 2011 7:20 am

Re: The open source your ant bot topic

Postby NmdSnprEnigma » Mon Dec 19, 2011 5:41 pm

My bot (of the same name) ended the initial contest in the low 200s: http://dl.dropbox.com/u/11628984/MyBot.zip
http://aichallenge.org/profile.php?user=1920

I took a diffusive approach and quickly learned that positive pressures (pushing) was a bad idea. Enemies (most of the time), enemy hills, and food exert negative pressures. I'd had explicit exploration forces at one point, but it kept getting me stuck in dead ends. Instead, I did bfs expansion with Nodes with my hills as seeds. Each node had a value of one less (attractive negative pressures) than its parent's. As a node had no more possible expansions, it would be pruned until it hit a node with children. These nodes persisted over turns. Each turn these nodes would expand outward with positive pressure, so highways would find the best path away from my hills and pressures would push towards the highways. Enemy hills could never be pruned and nodes could kidnap other nodes if it was a shorter path, so eventually I'd be guaranteed a shortest past from one of my hills, to every enemy hill. Ants would choose randomly between two equal adjacent values, so every branching path would distribute and even share to each path.

Combat was also done using a test pressure. For each enemy ant with my ants near it, remove the positive pressure and see which directions my adjacent ants would move (typically inward to attack). I permuted the orders in which my ants would move where their first choice of destination conflicted. I checked the target ants 5 possible ants and then aborted if my ants would get caught alone. This left me with the problem that my bot had no good way to determine when it was safe to a attack a single ant (because it considered enemy ants one at a time), so I hacked a heuristic together.
NmdSnprEnigma
Cadet
 
Posts: 1
Joined: Mon Dec 19, 2011 4:47 pm

Re: Design overview

Postby Darhuuk » Mon Dec 19, 2011 5:47 pm

Memetix wrote:I'm a psychotherapist, not a programmer, and I'm not sure how best to share my code ... so I have attached it.
I have shared most of the concepts on the forums already, but I have written an overview on my website and I do divulge how I pulled the concepts together and a few of the tweaks I made along the way.

My bot peaked at skill level 93.76 (2nd place at the time).

http://www.blackmoor.org.uk/AI.htm


I just read your explanation, very nice! Of course, when you read it, it all seems so simple, but coming up with those ideas is quite a bit harder. Great job, I especially liked the pushing other ants part & the "muddy" tiles.

I'm also amazed that you only added 300 lines of code. In my C++ implementation using diffusion, my block-unrolled diffusion function alone is somewhere around 130 lines (excluding comments & whitespace). In total (excluding whitespace & comments), I have around 3000 lines of code :).
Darhuuk
Colonel
 
Posts: 71
Joined: Wed Nov 16, 2011 12:58 pm

Re: The open source your ant bot topic

Postby Manwe56 » Mon Dec 19, 2011 6:06 pm

Alea jacta es :D
You will find in the attached zip the code of my bot (src/main) the tests of my bot (src/test using gtest) plus an already built binary for windows (check binary)

I have been ranked 25th on top, so I hope been around the top 50. If you run my tests, you will notice 5 will test over 110...I changed my mind yesterday very late, and did a little correction I was not thinking it might have a great impact. It is not really the case, and I have now a more aggressiv bot, with less expansion...It was unwanted, but does not seems too bad after all looking at the first matchs

I will detail later a few interesting thing I coded for combat and food gathering, with illustrations etc... But for now I just release the code

Good luck everybody for the finals ;)
Attachments
Manwe56.7z
Manwe56 code+tests+Windows binary
(479.04 KiB) Downloaded 84 times
Manwe56
Lieutenant
 
Posts: 12
Joined: Tue Oct 19, 2010 4:39 pm

Re: Design overview

Postby KonaEarth » Mon Dec 19, 2011 6:10 pm

Memetix wrote:I have written an overview on my website


From your website:
> My aim was to be the top British entry which meant a top 50 finish.

I like that idea! My goal is to be the top Hawaii coffee farmer entry. Woohoo! First place!

Really, that's my only choice because it appears that there is no way I can compete with the British psychotherapist crowd. I like how you limit the BFS to a specific number of affected ants, and how all the different goals have assigned weights, and using the inverse square law to assign scores, and pushing ants to spread out before approaching an enemy, and... I wish I had thought of that.
KonaEarth
Major
 
Posts: 33
Joined: Thu Nov 25, 2010 1:51 am

Re: The open source your ant bot topic

Postby cheeser » Mon Dec 19, 2011 8:00 pm

Hello! :D

My rank was 9 before the start of the final. I hope to finish in top 30.
May be my bot will be one of the best written in C# 8-)

My bot has a bulky code with a lot of Russian comments, im sorry for this, I have translated only the key comments :roll:

From Russia with love
P.S. I'll drink vodka if I'm in the top 10! Good luck and have fun! :D
Attachments
Cheeser_bot_last_version.zip
Almost all the code in MyBot.cs
(81.43 KiB) Downloaded 106 times
Last edited by cheeser on Mon Dec 19, 2011 9:24 pm, edited 1 time in total.
cheeser
Cadet
 
Posts: 7
Joined: Tue Oct 18, 2011 2:15 am

Re: The open source your ant bot topic

Postby BenJackson » Mon Dec 19, 2011 8:06 pm

cheeser wrote:My bot has a bulky code with a lot of Russian comments, im sorry for this, I lazy to translate them :roll:


Mine has almost no comments! I feel bad releasing it because I'm used to writing code for other people to read.
BenJackson
Colonel
 
Posts: 94
Joined: Sat Oct 29, 2011 4:16 am

Re: The open source your ant bot topic

Postby xoposhiy » Mon Dec 19, 2011 8:35 pm

Profile: http://aichallenge.org/profile.php?user=4206 (~40th place)

Code: https://bitbucket.org/xoposhiy/aichalle ... 55/src/Bot

Strategy is obvious from this piece code: https://bitbucket.org/xoposhiy/aichalle ... t/MyBot.cs
Code: Select all
                        Stage("GatherFood", () => DoGatherFood(antsBusyInThisTurn, engagedCloseFood));
                        Stage("Battles", () => DoBattles(antsBusyInThisTurn));
                        Stage("Guard", () => DoGuardHills(antsBusyInThisTurn));
                        Stage("Attack", () => DoAttackEnemyHill(antsBusyInThisTurn));
                        Stage("Support", () => DoSupportAttackers(antsBusyInThisTurn));
                        Stage("Visible", () => DoKeepMapVisible(antsBusyInThisTurn));
                        Stage("Border", () => DoGoToBorder(antsBusyInThisTurn));
                        Stage("Spread", () => DoSpread(antsBusyInThisTurn));
xoposhiy
Cadet
 
Posts: 7
Joined: Sun Oct 30, 2011 5:06 am

PreviousNext

Return to Strategy

Who is online

Users browsing this forum: Google [Bot] and 0 guests

cron