<< Back to Warzone Classic Forum   Search

Posts 201 - 220 of 565   <<Prev   1  2  3  ...  6  ...  10  11  12  ...  20  ...  28  29  Next >>   
WarLight AI Challenge: 2014-04-30 02:41:18


Norman 
Level 58
Report
What I meant was that you can't reach an insane high rating when playing against other bots far below your rating.
http://bzstats.strayer.de/bzinfo/elo/?lang=en
WarLight AI Challenge: 2014-04-30 08:09:13

{rp} pedrito 
Level 48
Report
Norman: This isn't Hollywood but real life. Here the bad boys win. There ain't no Superhero comming to save you from EXTERMINATION

You might want to work a little more on that extermination function...



Trogatrog: Hurts that I was 2900 ranked 3 days ago then crash, boom, bang and I can barely get a test game running

Don't worry too much, I don't think it takes very long for a bot that plays as well as your to climb all the way back to the top. The ratings seem very volatile overall.

Edited 4/30/2014 08:10:24
WarLight AI Challenge: 2014-04-30 10:44:27


125ch209 
Level 58
Report
It took me 1200 version to get my bot to stop crashing, and i dont even know why it stoped crashing. It drove me crazy
WarLight AI Challenge: 2014-04-30 10:58:57

{rp} pedrito 
Level 48
Report
Your persistence is admirable ;)
WarLight AI Challenge: 2014-04-30 12:22:43


Latnox 
Level 60
Report
WarLight AI Challenge: 2014-04-30 21:00:26


Trogatog
Level 52
Report
WarLight AI Challenge: 2014-05-01 13:02:12


125ch209 
Level 58
Report
i am reading a book about ants "civilization", and apparently they have a really cool way of finding the shortest path from a point A to a point B. when searching for the spot they are looking for, each ant emit some pheromone attracting other ants to follow their path. Since the pheromones are evaporating quickly, the closer you are from the anthill, the higher the pheromone density, so the shortest path between A (anthill) and B (food) is the one with the highest density of pheromone, thus attracting more ants, thus emitting more pheromone, etc, until all the ants uses the same (shortest) path to go from A to B. Apparently the computer engineers have adapted this system, using virtual ants and virtual pheromones to find the quickest path from a point A to a point B. So back to our bots, i was wondering if you guys had a method to find the shortest path from a region A to a region B, maybe using similar system? For example i had to code a specific situation: when i have Australia and i suspect the opponent to be expanding in Africa, i need to take Siam, India and Middle-East asap. But really a better and more general way to do this should be to find the shortest path from australia to africa and take this path.

Edited 5/1/2014 15:29:55
WarLight AI Challenge: 2014-05-01 14:09:06


Norman 
Level 58
Report
Hello

@125ch209: Your question regarding the shortest path suprises me. How do you move your armies to the borders if you don't know how to calculate a shortest path? Or are you looking for a fancy algorithm. Indeed I know of some fancy algorithms that are used for real world AI problems, for example:
- Pathfinding with Voronoi diagrams
- Rapidly Exploring Random Trees
- Potential field method
- I don't know about your ants thing. This looks a bit like the Monte Carlo localization

However since we are operating on a simple graph here non of those fancy algorithms are needed and we can rely on well defined mathematical algorithms. I calculate the shortest path by giving each region in Africa the distance 0. The regions bordering Africa get the value 1, and the regions bordering a value 1 region get the value 2... When I'm sitting in Australia then I look which neighboring region has the lowest value and this is the region I have to take to move towards Africa.
WarLight AI Challenge: 2014-05-01 15:25:35


125ch209 
Level 58
Report
thanks for the answer,your method is indeed way simpler. i actually didn't took the time to think about how to make a "find shortest path " method because since the map is very small, i didn`t really needed it. i move my armies to the borders by prioritizing all the available regions. if i own a SuperRegion, i just put the regions that are bordering this SuperRegion in different arrays, depending if the region is neutral or if i own the region and it is underAttack. i basically copy/past my "expanding" code ,my "attacking opponent" code or my "defending" code for every given array of regions in order of priority. i know it is not pretty and i probably could do it in a smarter way like all your fancy bots using heuristics and whatnot, but it is working well enough for this challenge.

Edited 5/1/2014 15:34:23
WarLight AI Challenge: 2014-05-01 15:33:23


ps 
Level 61
Report
I'm familiar with ant colony optimization algorythms (i studied optimization algorythms a few years ago when i was taking my masters). i think it will be overkill for this specific scenario of finding the shortest path though. A more simple A* path finding algorythm is easier to implement and gives you what you want (the shortest path). Ant colony optimization would have big advantages to calculate new routes when something is blocked (it's used heavily in network traffic balancing for example) i guess in warlight this could be when your opponent has a large enough stack protecting a key area, which might be better to go around it instead of going through it, but in this particular map it would backfire on you, the opponent would use the stack to keep expanding against you while you're wasting armies attacking neutrals trying to flank him. so, no, i think ant colony would not be your best option.

I recently implemented a simpler version of a star on my bot. I use it to figure out where to expand into next (following the list of suspected places the enemy started in), and i only apply it when there is no enemy in sight. the c# code is online (like the rest of my bot, which is all open source (https://github.com/psenough/warlight_ai_challenge), even though it's becoming an ugly spaghetti code from hell after all the hacks i been throwing at it trying to debug different problems).

Anyways, the code i implemented attempts to figure out what bordering neutral to attack next on the shortest way to unknown territory with id dest. It's in C#:


        public int FindNextStep(int dest)
        {
            // reset
            foreach (Region reg in fullMap.regions)
            {
                reg.tempSortValue = 0;
            }

            // initial list
            List<Region> list = new List<Region>();
            foreach (Region reg in FullMap.GetRegion(dest).Neighbors)
            {
                list.Add(reg);
            }

            // first iteration
            int it = 1;

            while ( list.Count > 0 )
            {
                List<Region> newlist = new List<Region>();
                foreach (Region testRegion in list)
                {
                    Region reg = fullMap.GetRegion(testRegion.Id);
                    if (reg.OwnedByPlayer(myName))
                    {
                        // found home, now backtrack to find which neighbour to attack, should be the one with lowest it that is not 0
                        int lowest = 50;
                        int index = -1;
                        foreach (Region neigh in reg.Neighbors)
                        {
                            Region regn = fullMap.GetRegion(neigh.Id);
                            if ((regn.tempSortValue < lowest) && (regn.tempSortValue != 0)) index = regn.Id;
                        }
                        return index;
                    }
                    else
                    {
                        // havent found home yet, prepare next iteration
                        if (reg.tempSortValue == 0)
                        {
                            reg.tempSortValue = it;
                            foreach(Region neigh in reg.Neighbors) {
                                newlist.Add(neigh);
                            }
                        }
                    }
                }
                
                list.Clear();
                foreach (Region nl in newlist)
                {
                    list.Add(nl);
                }

                it++;
            }

            return -1; // failed to find home
        }


It's giving each region of the map an initial temp value of 0, then starting from the target is checks all the neighbours to see if any of them belongs to us, if it doesn't, it stores all the neighbours of that region (disregarding the ones that have already been checked) and proceeds to the next iteration. Until it either finds something or has run out of areas to check.

I haven't tested this algorythm properly in the wild yet with the C# bug affecting the server and all. But i think it was working (can't remember for sure anymore to tell you the truth). I recall i wanted to check it working on real games, but then never managed to get around to it, not sure if it was to check how well it did or if it was working at all.

Anyways, if it's of any use to anyone, knock yourself out porting it to java or whatever you're using.

Edited 5/1/2014 15:59:23
WarLight AI Challenge: 2014-05-01 15:43:39


ps 
Level 61
Report
looking at the code again now i think it's still missing some optimization to disregard evaluating duplicate neighbours or that have already been checked. not sure if it's bugged or not. have to test when i find the time.
WarLight AI Challenge: 2014-05-01 15:56:17


ps 
Level 61
Report
but going back to ant colony optimization, the algorythm is based on doing certain random moves now and again (letting some ants drift apart from the best path) in hopes of finding something better, evaluating that result and then use that certainty to decide to keep at it or not. Usually in a dynamic setting, where food will likely run out from one place, so you should already be investing on trying to find your next supply.

So for warlight expansion in itself it wouldn't really prove useful imho, but for certain decision heuristics it might:

Deciding to attack all possible enemy territories of 1 with 2 armies for example, some bots deploy on all enemy neighbours, while others focus deployment only on the most important strategic region, so it would be nice to have an adaptative model that tries something, measures how that went and if it did well it tries again, else tries something different.

Same goes for deciding where to deploy and to attack or not on the first turns for example.

This doesn't necessarily require ant colony optimization algorhythms per se. It's transversal to machine learning models and optimization algorythms.
WarLight AI Challenge: 2014-05-01 16:32:01


Trogatog
Level 52
Report
Here's a simpler way if you want to know how to get from point a to point b. Now, I expect all of you to hard code "Lose to Trogabot" for giving you this info :)

You'll want to start by adding a numeric property to Region called "MovesToOpponent":
public class Region
{
    public Region()
    {
        MovesToOpponent = int.MaxValue;
    }
    [...]
    public int MovesToOpponent { get; set; }
    [...]
}
Then put this in the function that is trying to figure out how to get to your opponent
foreach (Region region in /*the list of regions you suspect your opponent controls*/)
{
    region.MovesToOpponent = 0; //This is your opponent. 0 means his region
    IncrementNeighbors(gameState, region.Id, 1); //all of his neighbors are 1 away
}
Here's the method that does all the work.
private void IncrementNeighbors(BotState gameState, int regionId, int moveNumber)
{
    foreach (var neighbor in gameState.VisibleMap.GetRegion(regionId).Neighbors.Where(n => n.MovesToOpponent > moveNumber))
    {
        neighbor.MovesToOpponent = moveNumber; //set the neighbor's move number if it's less than what's currently on there
        IncrementNeighbors(gameState, neighbor.Id, moveNumber + 1);  //Recursion!!!
    }
}
It'll take a little work to fully implement that into your code, but I'm not giving everything away ;)

Share and enjoy!

-Troggy

Edited 5/1/2014 16:38:54
WarLight AI Challenge: 2014-05-01 17:14:59


ps 
Level 61
Report
wtf, just realized i'm number 2 today, shouldn't be, still isn't robust enough to beat the rest of you guys on a regular basis. weird. it's nice to notice the top 7 bots are all out of warlight though. seems i was wrong on my initial analysis that learning to play warlight would be easier for coders than leaning to code ai for warlight players. :)

Edited 5/1/2014 17:15:19
WarLight AI Challenge: 2014-05-01 18:18:45


Trogatog
Level 52
Report
I don't know wtf is up with the queue. I swear I watch everyone play at least 4-5 matches before I get queued up for one... Haven't been able to do much testing or debugging :( Also, my rank is barely moving anywhere since I can't get queued
WarLight AI Challenge: 2014-05-01 20:09:50

{rp} pedrito 
Level 48
Report
I use a simplified version of A* for pathing. Simplified as in: no estimated distance (H value) because the map is small.

Functions that use this pathing are:
- findNearestOwnedBy(start, owner) // to get to the enemy
- findNearestNotOwnedBy(start, owner) // to get out of my owned super-regions
- findPathTo(start, end) // to go break bonuses
WarLight AI Challenge: 2014-05-04 18:08:08


Trogatog
Level 52
Report
In case you missed it, this happened :)

WarLight AI Challenge: 2014-05-04 19:15:13


Norman 
Level 58
Report
Hello

Ah, yes, I saw you at 3000 points. I believe you also won a game that didn't give you any points against a 2500+X bot at your way.

What I see now with the top rated bots is that the fights get more and more like when humans play together. Humans don't take the whole board but they try to somehow gain a little income advantage or stack advantage and then they finish the opponent off. In the past my bot was the only one having the right idea about how to play the small earth map but now the competition is tougher. Trogabot wins his games by first trying to win in Australia. If he wins there then he is in the attacking position. Except for Gadzbot I don't know of any bots capable of playing South America. Most bots just stack in a random Africa spot giving a halfway decent bot a free win.

My last big attack was about 4 weaks ago with me completely changing the way my bot fights. I think I can spare enough free time for a next big attack. The times where one bot could completely dominate the battlefield are over though.

Edited 5/4/2014 19:16:35
WarLight AI Challenge: 2014-05-04 19:22:36


Trogatog
Level 52
Report
Trogabot wins his games by first trying to win in Australia

You're only 1/3 right. In our matches, yes, but that's because we have the same starting picks.

125ch209 uses such code (sorry, I peeked, was just curious) to pull off his counterpicks.
How do you have access to our code out of curiosity? Are you even eligible for the competition with such an advantage?

Edited 5/4/2014 19:36:25
WarLight AI Challenge: 2014-05-04 19:34:55


Norman 
Level 58
Report
You're only 1/3 right. In our matches, yes, but that's because we have the same picks.

That wasn't my whole statement ;). I also said that most (all?) bots don't know how to play South America. Here some random examples of when Trogabot get both his Australia picks and the opponent picks South America + Africa
http://theaigames.com/competitions/warlight-ai-challenge/games/53660f274b5ab235189fa76a
http://theaigames.com/competitions/warlight-ai-challenge/games/536694c34b5ab235189fb32c
http://theaigames.com/competitions/warlight-ai-challenge/games/536675484b5ab235189fb089
http://theaigames.com/competitions/warlight-ai-challenge/games/5365f4794b5ab235189fa522
Posts 201 - 220 of 565   <<Prev   1  2  3  ...  6  ...  10  11  12  ...  20  ...  28  29  Next >>