Ants
-
Marcus
- Gosei
- Posts: 1387
- Joined: Tue Apr 20, 2010 8:51 am
- GD Posts: 209
- KGS: Marcus316
- Has thanked: 139 times
- Been thanked: 111 times
Re: Ants
No worries perceval ... I still haven't submitted any code that takes time remaining into account ... in fact, my bot is the result of the Ants Tutorial in Python.
I should really get working on this. I have an idea of how I want to tackle the challenge, but I'm sure there are plenty of holes and bumps to overcome.
I should really get working on this. I have an idea of how I want to tackle the challenge, but I'm sure there are plenty of holes and bumps to overcome.
-
snorri
- Lives in sente
- Posts: 706
- Joined: Fri Jul 02, 2010 8:15 am
- GD Posts: 846
- Has thanked: 252 times
- Been thanked: 251 times
Re: Ants
daniel_the_smith wrote:So far I spent most of my time writing awesome pathfinding. All my current bot does is pathfind for all my ants for all food, unexplored areas, and enemy hills.
Sounds like more of an HI challenge than an AI one...
-
hyperpape
- Tengen
- Posts: 4382
- Joined: Thu May 06, 2010 3:24 pm
- Rank: AGA 3k
- GD Posts: 65
- OGS: Hyperpape 4k
- Location: Caldas da Rainha, Portugal
- Has thanked: 499 times
- Been thanked: 727 times
Re: Ants
Yeah, I'm always fuzzy on why a given thing counts as AI or not, but this is no more AI than programming chess, go or a war game (which is what it's most like).
-
AVAVT
- Dies in gote
- Posts: 32
- Joined: Fri Oct 29, 2010 12:18 pm
- Rank: KGS 1 dan
- GD Posts: 0
- KGS: AVAVT
- Has thanked: 10 times
- Been thanked: 1 time
Re: Ants
I'm so terrible at this, my bot keeps timing out whenever I have about 40+ ants T_T
I can't find this information on the page but I speculate that I can only get Ilk type of visible Tile right? Maybe I should change my code to adapt to this >.<
I can't find this information on the page but I speculate that I can only get Ilk type of visible Tile right? Maybe I should change my code to adapt to this >.<
-
lorill
- Lives with ko
- Posts: 281
- Joined: Wed Apr 21, 2010 1:03 am
- Rank: yes
- GD Posts: 0
- Location: France
- Has thanked: 69 times
- Been thanked: 25 times
Re: Ants
If you use the java starter kit (which I assume you do, based on the class names), Water will be kept even if not visible anymore, but food and ants will not, if I remember well.
- daniel_the_smith
- Gosei
- Posts: 2116
- Joined: Wed Apr 21, 2010 8:51 am
- Rank: 2d AGA
- GD Posts: 1193
- KGS: lavalamp
- Tygem: imapenguin
- IGS: lavalamp
- OGS: daniel_the_smith
- Location: Silicon Valley
- Has thanked: 152 times
- Been thanked: 330 times
- Contact:
Re: Ants
Nice, lorill made the top hundred! The highest my "stupid" bot ever got to was #110. Still working on a not-so-stupid one... 
That which can be destroyed by the truth should be.
--
My (sadly neglected, but not forgotten) project: http://dailyjoseki.com
--
My (sadly neglected, but not forgotten) project: http://dailyjoseki.com
-
lorill
- Lives with ko
- Posts: 281
- Joined: Wed Apr 21, 2010 1:03 am
- Rank: yes
- GD Posts: 0
- Location: France
- Has thanked: 69 times
- Been thanked: 25 times
Re: Ants
daniel_the_smith wrote:Nice, lorill made the top hundred! The highest my "stupid" bot ever got to was #110. Still working on a not-so-stupid one...
I think i can still gain some rank with this version.
My food gathering looks good enough, but I really need to improve my local fighting for the next one.
- Chew Terr
- Gosei
- Posts: 2060
- Joined: Mon Apr 19, 2010 12:45 pm
- Rank: KGS 3k
- GD Posts: 264
- KGS: Chew
- Location: Texas
- Has thanked: 546 times
- Been thanked: 172 times
- Contact:
Re: Ants
lorill wrote:My food gathering looks good enough, but I really need to improve my local fighting for the next one.
I recommend L&D.
Someday I want to be strong enough to earn KGS[-].
- flOvermind
- Lives with ko
- Posts: 295
- Joined: Wed Apr 21, 2010 3:19 am
- Rank: EGF 4 kyu
- GD Posts: 627
- Location: Linz, Austria
- Has thanked: 21 times
- Been thanked: 43 times
Re: Ants
Yesterday I uploaded my "random movement" bot.
I hope I find some time to work on a version that does something that actually makes sense
This time the game doesn't seem easy at all. While the general strategy of this game seems rather easy (for humans at least), there are lots of hard algorithmic problems hidden in there. For example, identifying and blocking choke points seems like it would give a huge advantage. I often see bots sending lots of ants to a choke point, and neither player makes any progress. In these cases, if the bot would realize that it can e.g. indefinitely block the choke point with just 3 stationary ants, it could free up lots of ants to do something else...
Another interesting algorithmic problem is the multi-shortest-path, that is, I have ants at positions s_1,...,s_n and I want them at d_1,...,d_n as fast as possible. That's different from just n BFS searches, it could easily be that no ant takes the locally shortest destination, but the total time is best.
I hope I find some time to work on a version that does something that actually makes sense
This time the game doesn't seem easy at all. While the general strategy of this game seems rather easy (for humans at least), there are lots of hard algorithmic problems hidden in there. For example, identifying and blocking choke points seems like it would give a huge advantage. I often see bots sending lots of ants to a choke point, and neither player makes any progress. In these cases, if the bot would realize that it can e.g. indefinitely block the choke point with just 3 stationary ants, it could free up lots of ants to do something else...
Another interesting algorithmic problem is the multi-shortest-path, that is, I have ants at positions s_1,...,s_n and I want them at d_1,...,d_n as fast as possible. That's different from just n BFS searches, it could easily be that no ant takes the locally shortest destination, but the total time is best.
-
lorill
- Lives with ko
- Posts: 281
- Joined: Wed Apr 21, 2010 1:03 am
- Rank: yes
- GD Posts: 0
- Location: France
- Has thanked: 69 times
- Been thanked: 25 times
Re: Ants
Chew Terr wrote:lorill wrote:My food gathering looks good enough, but I really need to improve my local fighting for the next one.
I recommend L&D.
Actually, I was dreaming of using a montecarlo like method
We'll see.
-
AVAVT
- Dies in gote
- Posts: 32
- Joined: Fri Oct 29, 2010 12:18 pm
- Rank: KGS 1 dan
- GD Posts: 0
- KGS: AVAVT
- Has thanked: 10 times
- Been thanked: 1 time
Re: Ants
I'm dying a little bit inside seeing how my ants keep bumping into dead end and moving for/backward over and over again. And when I try to expand the path searching area my bot would time out >.<
This is my first time coding AI and the only thing I know is A* Algorithm suggested by the site.
Anyone kind enough to show me a good direction to follow? Even some reading material that I would find useful is good enough
This is my first time coding AI and the only thing I know is A* Algorithm suggested by the site.
Anyone kind enough to show me a good direction to follow? Even some reading material that I would find useful is good enough

- daniel_the_smith
- Gosei
- Posts: 2116
- Joined: Wed Apr 21, 2010 8:51 am
- Rank: 2d AGA
- GD Posts: 1193
- KGS: lavalamp
- Tygem: imapenguin
- IGS: lavalamp
- OGS: daniel_the_smith
- Location: Silicon Valley
- Has thanked: 152 times
- Been thanked: 330 times
- Contact:
Re: Ants
I thought about doing local fights via MCTS, but I just don't think I'll be able to get enough playouts for it to be useful. So far my only real accomplishment is an algorithm to split up the board into local fights in < 1ms. :/
AVAVT, you can modify A* to start from multiple sources. Depending on what you need to accomplish, you can also do multiple dests if you drop the heuristic (i.e., switch back to Dijkstra).
Lurking on their IRC channel is a good way to pick up strategy tips.
There is some good info on A* here: http://theory.stanford.edu/~amitp/GameP ... stics.html
AVAVT, you can modify A* to start from multiple sources. Depending on what you need to accomplish, you can also do multiple dests if you drop the heuristic (i.e., switch back to Dijkstra).
Lurking on their IRC channel is a good way to pick up strategy tips.
There is some good info on A* here: http://theory.stanford.edu/~amitp/GameP ... stics.html
That which can be destroyed by the truth should be.
--
My (sadly neglected, but not forgotten) project: http://dailyjoseki.com
--
My (sadly neglected, but not forgotten) project: http://dailyjoseki.com
-
hyperpape
- Tengen
- Posts: 4382
- Joined: Thu May 06, 2010 3:24 pm
- Rank: AGA 3k
- GD Posts: 65
- OGS: Hyperpape 4k
- Location: Caldas da Rainha, Portugal
- Has thanked: 499 times
- Been thanked: 727 times
Re: Ants
For the time being, I'm giving up on a real pathfinding algorithm and just trying to implement some dumb hacks that will avoid the worst behavior. Might be able to put up a new bot tonight.
- perceval
- Lives in gote
- Posts: 312
- Joined: Thu Aug 05, 2010 3:35 am
- Rank: 7K KGS
- GD Posts: 0
- KGS: tictac
- Has thanked: 52 times
- Been thanked: 41 times
Re: Ants
AVAVT wrote:I'm dying a little bit inside seeing how my ants keep bumping into dead end and moving for/backward over and over again. And when I try to expand the path searching area my bot would time out >.<
This is my first time coding AI and the only thing I know is A* Algorithm suggested by the site.
Anyone kind enough to show me a good direction to follow? Even some reading material that I would find useful is good enough
A* is supposed to be optimal. Its weird that it take so long, unless you try to go very very far are you sure you do not get a bug ? otherwise if you cant reach the location you need to explore more, head towards the closest unknown tile for example.
For myself i still cant submit or i'll die of shame but i begin to be happy with my data structs.
The basis is that all my path finding for food are done on a very small window (15 in mannathan dist by fly distance ie barely more than seeing distance) so usually there are few ants at that distance(i have code to keep ants appart and my A* are short as a result.
my reasoning is that if a food is farther chances are some other ant will get it before.
also i just send the closest ant (real dist not fly distance so i still do a multi source A * to determine that) because i suppose (but might be wrong) that the case where you have a lot of food and lot of ants close by is rare : with efficient bots most of the map should be covered quick and food harvested soon after appearance.
i also keep track of my ants long term goal and i recompute only if it disappears (in theory. right now if a food disappear the ant that goes to it just stop until its killed
i am struggling with dealing with collisions: if 2 ants want to go the same spot you need to change one, but which and to where ? so each ant have goal and i compute the distance with all 4 movements (+staying put), and if 2 ants need to go to the same place i try the second move. i guess in combat situation where all ants are close it might become complicated because you risk a secondary collisions
In theory, there is no difference between theory and practice. In practice, there is.
- perceval
- Lives in gote
- Posts: 312
- Joined: Thu Aug 05, 2010 3:35 am
- Rank: 7K KGS
- GD Posts: 0
- KGS: tictac
- Has thanked: 52 times
- Been thanked: 41 times
Re: Ants
daniel_the_smith wrote:
There is some good info on A* here: http://theory.stanford.edu/~amitp/GameP ... stics.html
Thanks for the link, i was unaware of the tie breaking trick, i think it will do wonder to speed things up in a non maze situation
In theory, there is no difference between theory and practice. In practice, there is.
The similarity between Go and computing is the seemingly infinite number of possibilities.