Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

AI Challenge Fall 2011


Keebler Elf
 Share

Recommended Posts

I do not know how many of you have ever heard of this website but it is pretty cool. [http://aichallenge.org](http://aichallenge.org) It is a contest in which they take simple games and your goal is to create the best AI (bot) for that game. Almost any language you might want to use is supported. Anyone can enter as was clearly shown when I entered what I must say is a real horrible bot. It is still fun however and I suggest checking it out.
Link to comment
Share on other sites

I started with a very basic Java Bot. It just tell the ants to explore the unexplored tiles then loop it over and over. Then I tried VB. I wrote VB in VS 2010 but didn't work on their server with Mono. I'm not sure what's wrong cause I never do anything for Mono. It was something to do with HashTable. So I switched to a very basic Python for temporary. I don't know enough Python to keep going and make my Bot better so I went back to Java. I added food gathering as top priority and also avoid collision. I did not know that collision cause ants to die. Now I just need to do the pathfinding cause using getDirection cause the ants to get stuck in corners. Researching on A* Algorithm at the moment and will try to implement it in my Java Bot then it's ready to upload.

How are you guys doing?

Sincerely,
Rithy
Link to comment
Share on other sites

I am pretty new to programming. So the fact that c++ is my first language is not helping. I have a shitty python bot that crashes around halfway through most of its game. So I am working on a c++ one. Ya the A* algorithm is nice, however I am having trouble implimenting it, so I will probably just continue messing around for now.
Link to comment
Share on other sites

keeping data?

I have no Idea what you mean… >.<... maybe if you explained that a bit more x.x (sorry if that sounds stupid)

XD I'm just using a Blind-Bot that wonders aimlessly until it sees something, then it acts. All I have is a lightly modded VB starter pack.

* * *

Edit: I'm surprised my bot actually worked right… sorta... XD I messed up on the wondering part but its gather and attack hill logic RULES!

But since I know I'm on the right track I can make it WAY better >:D

* * *

Edit 2:

I don't see a lot of advanced attack risk checkers in other bots. They just attack if it's 2 against 1.

I'm making an attack-risk manager that will determine if my the local force of your ants is greater they attack, if not they retreat, no more Large army stand offs XD
Link to comment
Share on other sites

Well I'm keeping track of the orders I'm giving to each ants for each turn. I don't want to tell two ants to go for the same food location.

I also keep track of all ants hill found. Once I have enough ants, I send them in for the attack. I'm just not sure when to do that yet. There is no way for me to know how many ants the enemy have.

I'm also working on the exploring. I send ants to different part of the map to explore. Again, keep track of what's going on. I don't want to send ants to the same place.

As for the pathfinding, I'm probably also going to keep track of data again.

Sincerely,
Rithy
Link to comment
Share on other sites

If you want to know when to go for the kill I suggest attempting to keep the enemy hill visible and count the number of ants around it. Then start sending over ants until the number you have watching  the hill is greater then the number you can see near it. This is the strategy I have seen implimented in some games, it seems to work good if you ants can avoid the enemy ants while waiting.
Link to comment
Share on other sites

is there a way to see how many ants are near one of your ants?  If you know where your ants are, and you know how many ants are near you ants, you could make a rough estimate of how dense the enemy ant population is.

Once you form the 'gradient' of enemy ant density, you could make estimates and decisions based on it…

(just pondering while knowing nothing of what you can really do)
Link to comment
Share on other sites

I keep track of the enemy hill, however you can't really keep track of your enemy ants because it's always changing. Keep track of the ants near the hill is even harder. Unless you're keeping one ant to scout that hill. Instead, this is how I do things. I group the ants and once it's more than 50, all are going for the kill. I guess I can improve that "50" by changing it throughout the game. Still working on it.

Sincerely,
Rithy
Link to comment
Share on other sites

@LeaRae:

> is there a way to see how many ants are near one of your ants?  If you know where your ants are, and you know how many ants are near you ants, you could make a rough estimate of how dense the enemy ant population is.
>
> Once you form the 'gradient' of enemy ant density, you could make estimates and decisions based on it…
>
> (just pondering while knowing nothing of what you can really do)

If you are using VB.NET i can give you what I use to check my local ant numbers vs Enemy local numbers.

This Is the code I use to count the near-by ants, both mine and the enemy.

**as my bot is defunct with order reading, This has yet to be tested properly.
```
dim good as integer
dim bad as integer

                'Calculate Battle Risk
                For Each BadAnt As Location In a.EnemyAnts
                    If (BadAnt.Col >= antLoc.Col And (BadAnt.Col - antLoc.Col) <= a.ViewRadius2) Or (BadAnt.Col < antLoc.Col And (antLoc.Col - BadAnt.Col) <= a.ViewRadius2) Or (BadAnt.Row >= antLoc.Row And (BadAnt.Row - antLoc.Row) <= a.ViewRadius2) Or (BadAnt.Row < antLoc.Row And (antLoc.Row - BadAnt.Row) <= a.ViewRadius2) Then
                        bad = bad + 1
                    End If
                Next
                For Each GoodAnt As Location In a.MyAnts
                    If (GoodAnt.Col >= antLoc.Col And (GoodAnt.Col - antLoc.Col) <= a.ViewRadius2) Or (GoodAnt.Col < antLoc.Col And (antLoc.Col - GoodAnt.Col) <= a.ViewRadius2) Or (GoodAnt.Row >= antLoc.Row And (GoodAnt.Row - antLoc.Row) <= a.ViewRadius2) Or (GoodAnt.Row < antLoc.Row And (antLoc.Row - GoodAnt.Row) <= a.ViewRadius2) Then
                        good = good + 1
                    End If
                Next

```

@ Rithy:

just remember to limit the time you spend on reading your stored data, you only have a second for your turn. but your AI sounds like its getting better =D

* * *

as for me, I messed up my orders storage and check and then I could only move 1 ant at a time, I'm trying to fix this.

other than that I have ALL the basic AI down, including a pseudo problem solving that lets them move around obstacles in the way of its target.
Link to comment
Share on other sites

Seeing that people were looking for A*….

Here is a snippet of AStar in use with my game engine that I converted to this.  Note:  This code also acts as if ants are impassible.
[http://pastie.org/2802840](http://pastie.org/2802840)
Its just has a static method findPath(Ants ants, Tile start, Tile end) that returns an array of tiles.
Link to comment
Share on other sites

^_^

I finally won a match! Though its only because the enemy timed-out. XD

ANY WAY. I've been making my AI though trial and error. I finally created an AI capable of battle and path-finding!

;D Slowly it's getting there.

T_T sadly I cant run local test for the life of me… it's all online testing >.<
Link to comment
Share on other sites

[http://aichallenge.org/starter_packages.php](http://aichallenge.org/starter_packages.php)

> You will need to download the tools in addition to the starter pack. Choose [Windows](http://aichallenge.org/tools.zip) or [Linux / MacOS](http://aichallenge.org/tools.tar.bz2)

Download that, get yourself python, and run-game-once-live or whatever is in the tools folder.  If you want to use your *own* bot, then open up the script and find the code in the quotes.  EX: "python ""%~dp0sample_bots\python\LeftyBot.py""" and replace with the launch code for your own: "java -cp mybot MyBot"
Link to comment
Share on other sites

Hey, I understand the code, I don't understand the local testing.

Having the ability to write AI and the ability run a python program are 2 separate things.

I have understanding of the code, a way to test it, and understanding to improve the AI. There is no reason I shouldn't.
Link to comment
Share on other sites

I'm stealing Origin's AI system for my VB.Net AI and also using 314piwm for my Java AI.
Thanks for that.

Ryoku, using the local testing tools is easy. You need to install python and make sure you set up your environmental variable so terminal understand the command python. Then you just have to edit the arguments in Play_One_Game.cmd(or .bat. not sure) I'm guessing you're using VB.Net on Windows. So You just gotta change one of the "python ""…"" " to like "sample_bot\vb\MyBot.exe" with MyBot.exe being your compiled AI.

I'm using Mono on Ubuntu so not sure if I told you correctly. But you should look up on how the game engine work so you know how your AI and the game actually communicate.

Sincerely,
Rithy
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...