[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4586: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4588: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4589: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4590: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
AI Challenge Forums • View topic - The open source your ant bot topic

It is currently Wed Jul 26, 2017 2:37 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 Speedy_Consoles » Thu Dec 22, 2011 1:51 am

Here is mine:

I got to like rank 20 before close and xathis said its much more readable written than his code :D.
Speedy_Consoles
Cadet
 
Posts: 1
Joined: Thu Dec 22, 2011 1:48 am

Re: The open source your ant bot topic

Postby Fearless » Thu Dec 22, 2011 11:18 am

Our AI here: https://bitbucket.org/artm/ants-ai-challenge (best version was in top100)

On each turn we do evaluation for each ant and choose one with best probability.
Fearless
Cadet
 
Posts: 1
Joined: Thu Dec 22, 2011 10:51 am

Re: The open source your ant bot topic

Postby jacob_strauss » Thu Dec 22, 2011 1:53 pm

This is my code


And my profile


Probably finish in top 100
jacob_strauss
Cadet
 
Posts: 2
Joined: Wed Nov 02, 2011 10:54 pm

Re: The open source your ant bot topic

Postby RebelXT » Thu Dec 22, 2011 5:09 pm

Rebelxt's code:

Rebelxt's profile:

It was ranked 40 before the finals started, and currently hovering around ~100 in the finals.

Thanks organizers and everyone who participated! Already looking forward to next year's challenge.
RebelXT
Colonel
 
Posts: 81
Joined: Fri Sep 10, 2010 2:05 pm

Re: The open source your ant bot topic

Postby agent_smith » Thu Dec 22, 2011 6:57 pm

I'm happy today, as my bot went from ~300 to ~180, so there's a reason to celebrate :P Here's the story of agent_smith and the source code, in case you're interested:

viewtopic.php?f=24&t=2219

I would like to thank you people for open-sourcing your bots, although I didn't have the time to read much yet. What I would like to see most is more high ranking Python bots and more top 10/20/50 bots.
agent_smith
Colonel
 
Posts: 54
Joined: Mon Nov 28, 2011 2:28 pm

Re: The open source your ant bot topic

Postby fourmidable » Thu Dec 22, 2011 11:10 pm

I have attached the source code of 'fourmidable', currently 13th as I'm writing this.

This is essentially a greedy for food bot. It uses a 3 tier approach:
1) Resolve subgroup combat up to 4 vs 2
2) Path finding to the following objectives: food, hills, invisible tiles, enemy ants closest to hill and own hill.
3) Probabilistic move selection and collision avoidance.

The third element is probably the most interesting. Each turn, each ant is assigned a discrete behavioral tag that decides whether it is willing to enter a trade or not this turn. Tags are assigned randomly between allow trade and disallow trade based on the following formula:

p = (n/(0.6*e))^3

where p is the probability to allow trade, n is my ant count, and e is the estimate of the total number of ants by assuming constant ant density over unobserved land squares. Basically, fourmidable's probability to trade ants increases as it dominates the map. This is an attempted trade off between avoiding ant trading (which is bad in a multi-player game), and still trying to gain ground against bot that always back off.

Another interesting element is that it has a full map inference engine that identifies the map translation, symmetry and rotations. This has been discussed in other threads before, but fourmidable uses a few additional twists.
1) It detects probable but not yet proven transformation to make an early guess and map water, hills and food. In case the hypothesis proves false, it simply wipes the mistakes and restart over.
2) One challenge is to prove the correct transformation when not all players have been seen. One twist to improve that is to factor into prime number the possible number of players. Let's say we have seen 8 opponents, so the number of players is 8, 9 or 10, and the prime factors are 2, 3 and 5. Transformations can be grouped in sets that map back to the identity. However, if there is no set that maps back in 3 or 9 steps, then obviously there cannot be nine players. The same argument can apply to 5 or 7 to eliminate some player count hypothesis and converge faster.
Unfortunately, the whole map inference thing as a marginal impact at best.
Attachments
fourmidable.zip
Fourmidable's final submission.
(43.29 KiB) Downloaded 239 times
fourmidable
Cadet
 
Posts: 8
Joined: Sun Oct 30, 2011 11:55 am

Re: The open source your ant bot topic

Postby qgazq » Thu Dec 22, 2011 11:51 pm

My bot is a bit rubbish (currently 453), and it looks like this post has got a bit long.
So if you have better things to do I suggest you do them rather than read it. However if all you're doing is hitting refresh on your profile page then give the web server a break and have a browse.

I wrote the bot coz the competition looked cool, and I did enjoy it thank you organisers.
I choose Java since my day job is c/c++ and wanted to expand my skills a bit. This has influenced my bot some what.
I spent quite a bit of time learning how bad java is at real time stuff :)
Or more accurately how manage java in real time situations, such creating pools of the objects I had a lot of turnover of so that I could reuse them rather than having the gc kick in and eat up all my turn at random.
The code isn't well commented, structured and the variables aren't well named. I tend to get a bit messy when the code is just for me and won't have to be maintained by anyone else.

So the bot itself, is essential the tutorial bot with a few improvements.
The path finding is a breadth first search with caching.

So the basics, it assigned an ant to the closest food to the ant.
Then any left over go to the closest enemy hill.
Any left over after that explore by going towards the closest bit of unexplored map within 60 cells.
Any after that go to the closed unexplored point in a 10 by 10 grid, and if there aren't any of them, then just any unexplored point.
The two explores are to balance CPU time and can break out if there is less than 100ms left, though the time-outs don't often get hit (at least locally).
And after that just random.

Before any of that if there are several bits to try and manage close to the hill, it doesn't work well.
Its suppose to put some ants are guard, which is does by just not allowing them to move so they have to wander on there by accident. It also make ants on the exit routes move away in a straight line which doesn't work well if there is a wall in the way!

As you may notice there is nothing about avoiding other ants, or formations or anything like that, its pretty dumb.

Now as I say my intention was a bit of fun and to learn java so never expected to be up with the top 100. I'm not too disappointed with my 400-500 which is roughly where I am. However I can see some things which are obviously really stupid and could improve pretty easily which would get me up a fair bit more. These are on my to do list but didn't get done.

My directions to target function should return groups "best" (closer to the target) "same" (no closer but no further than the current tile) "sideways" (longer that the current one but next to best) "worst" (longer) "impossible" (there is water or something there). Now there are only 4 directions so not all of the groups would be populated. The idea being the ant tries to move to best, but if not slowly falls down them to at least same.

At the moment my ants walk around on their own, this is fine for food gathering and exploration, but for attacking sucks. A small improvement which wouldn't be good against the big boys, but would work against other bots like mine is to pair up. So thought of this: Every other turn, check if ant there is an behind by not in front, if then make a same or sideways move rather than the best move. The idea being this would “delay” the lead ant so the one behind will catch up and be at its side. Not sure if it would work since I didn't try it.
Then to improve the attacking of hills do something like:
Wait for "x" ants when "y" tiles from enemy hill if more than "x*z" defending where x, y and z are things I could tweek. By wait it means again not taking the best moves, by same and sideways would be ok (to allow them to flow and produce a line).

At the moment I noticed even when its about to cap a hill it will still wander off for food (as it would given food is the most important thing currently). I have lost at least one game because of this. So the idea being if within “x” of enemy hill then go for hill unless food is closer, i.e. make hills and food equally weighted when close to one.

Finally my own hill defence sucks, because the ants have to accidentally wander on to the defence positions and then get stuck. They also only start when there are enough ants.
My current to do list is have an order that the ants should build up the defences 1 by one as their numbers grow and they would want to go there. Probably at the same level as hill attacking, so they would leave to get close food, then come back.
But since reading someone post on here I've thought actually a better would be to keep a percentage of my ants within a radius of my hill and as an enemy gets closer then they fall back to the defensive positions. Potentially with the closest suiciding if I have enough ants and its a lone enemy.

Anyway I didn't do any of that, but again thanks for the competition and I'll try and keep an eye out for next years.

Regards
QGazQ
Attachments
QBot.zip
QBot
(16.65 KiB) Downloaded 205 times
qgazq
Cadet
 
Posts: 6
Joined: Thu Dec 22, 2011 10:12 am

Re: The open source your ant bot topic

Postby runevision » Fri Dec 23, 2011 12:46 am

My bot runevision is ranked between 4 and 11 depending on when you look.

I've posted the source code for it here as well as the beginning of an explanation of it:

http://blog.runevision.com/2011/12/ai-c ... art-i.html

Rune
runevision
Cadet
 
Posts: 7
Joined: Sun Nov 06, 2011 1:20 pm

Re: The open source your ant bot topic

Postby Kettling » Fri Dec 23, 2011 7:23 am

Might as well throw mine into the pool:

http://lnx-bsp.net/news/2011/12/24/entry.zip


It just missed out on getting into the top 1000, so not a terribly strong competitor, it has no battle code to speak of and what I did try to throw in was very hasty and probably worse than useless. However, it runs fast, because I was paranoid about timeouts, and only have a midrange desktop machine to test on.

The basic system is flood-fill maps that give the distance to the nearest item of interest (one for water, one for food, etc) and these are decently optimized so once you have the maps you can run many hundreds of ants. On top of that is a simple neural-net evaluator to judge the relative importance of goals (find food, attack enemy, etc), which was tuned by brute force simulated annealing over perhaps 1000 games.

There's bulk CPU left to add in a battle calculator, I just ran out of time to write one.
Kettling
Lieutenant
 
Posts: 11
Joined: Fri Dec 23, 2011 5:35 am

Re: The open source your ant bot topic

Postby flagcapper » Sat Dec 24, 2011 2:08 am

My post-mortem as well as my code can be found here: http://flagcapper.com/?c2

Direct link to code (very messy): http://flagcapper.com/code/FlagCapper_Ants.zip
flagcapper
Lieutenant
 
Posts: 10
Joined: Mon Feb 08, 2010 5:15 pm

PreviousNext

Return to Strategy

Who is online

Users browsing this forum: No registered users and 1 guest

cron