<< Back to Warzone Classic Forum   Search

Posts 41 - 55 of 55   <<Prev   1  2  3  
Warlighter's Bots for AI challenge: 3/26/2014 01:52:40


Odin 
Level 60
Report
The game engine uses the following method to play a round:


public void playRound()
{
getMoves(player1.getBot().getPlaceArmiesMoves(2000), player1);
getMoves(player2.getBot().getPlaceArmiesMoves(2000), player2);

executePlaceArmies();

getMoves(player1.getBot().getAttackTransferMoves(2000), player1);
getMoves(player2.getBot().getAttackTransferMoves(2000), player2);

executeAttackTransfer();

...


The three methods getPreferredStartingRegions, getPlaceArmiesMoves, getAttackTransferMoves are all defined in the bot interface. I think you need to have all of those methods separate. You can, however, make your calculations during the getPlaceArmiesMoves method call, place the results somewhere (in the state, for instance), and just load them from the state reference during getAttackTransferMoves method call.
Warlighter's Bots for AI challenge: 3/26/2014 11:59:19


125ch209 
Level 58
Report
thanks, thats what i want to do, but how do i place the results in the state?
Warlighter's Bots for AI challenge: 3/26/2014 12:24:42

Fizzer 
Level 64

Warzone Creator
Report
how do i place the results in the state?

He means make a variable and assign to it during getPlaceArmiesMoves(). Then all getAttackTransferMoves() does is return that variable.
Warlighter's Bots for AI challenge: 3/26/2014 12:37:10


125ch209 
Level 58
Report
so i put a variable attackTransferMoves in the State file, then in the getPlaceArmiesMoves method in the starter i can do this:

in the BotState:
public ArrayList<AttackTransferMove> attackTransferMoves = new ArrayList<AttackTransferMove>() ;

in the BotStarter getPlaceArmiesMoves method:

(state.attackTransferMoves).add(new AttackTransferMove(myName, fromRegion, toRegion, armies));

would that work?

Edited 3/26/2014 12:37:58
Warlighter's Bots for AI challenge: 3/26/2014 13:09:33


Odin 
Level 60
Report
Yes, that would work. Of course,
(state.attackTransferMoves).add(new AttackTransferMove(myName, fromRegion, toRegion, armies));

will only add one attack/transfer order to the list.

Also, you could declare attackTransferMoves private, with public getters and setters.

The BotStarter's getAttackTransferMoves method, then, only contains one line:
"return state.getAttackTransferMoves();"

Edited 3/26/2014 13:14:54
Warlighter's Bots for AI challenge: 3/26/2014 13:19:12


125ch209 
Level 58
Report
yes, i'll declare it private and put a public setter & getter. Thank you very much!
Warlighter's Bots for AI challenge: 3/26/2014 13:44:18


ps 
Level 61
Report
125: what i been doing in c# is to create a new list called schedule attacks fill it up during the deployment phase with things that make sense happen, and then on the attack phase go through it and execute it.
Warlighter's Bots for AI challenge: 3/26/2014 13:57:00


125ch209 
Level 58
Report
ps: yes that is what i want to do, but i didn't know how to access a list declared in the PlaceArmiesMoves method from the AttackTransferMoves method...turns out you can't, that's why i need to put this schedule attacks list in the BotState. I'll give it a try tonight, i hope it'll work :)
Warlighter's Bots for AI challenge: 3/26/2014 13:58:30


ps 
Level 61
Report
125: ok. can you update my link on the main page? i changed the name of my bot:
http://theaigames.com/competitions/warlight-ai-challenge/game-log/pswarlighter/
Warlighter's Bots for AI challenge: 3/26/2014 22:37:29


zach 
Level 56
Report
I don't know how you do it Norman.
Warlighter's Bots for AI challenge: 3/28/2014 04:47:34


Norman 
Level 58
Report
I don't know how you do it Norman.

SupremeDalek being at number 1 is at present not a sign that he is extremely smart but that the competition is extremely weak. My bot isn't even working properly due to one serious design mistake (SupremeDalek planning the deployment and attack moves in two phases instead of looking at the whole picture at the beginning of the turn) and one strange bug that is maybe caused from compiler optimizations. I even just added some debug code for important variables like the expected opponent deployment. This debug code is probably even smarter like what some other player seem to do, expecting the opponent deploying his full income on each and every territory...

However, since I have some experience in writing a warlight bot now I'm sure that given enough time I could make SupremeDalek smart enough to battle medium level warlight players in 1v1 (medium level = 50% winrate). It's quite easy making your bot going for solid decisions while it's hard inserting the special magic of a high level player.

Some tips on how I recommend writing a warlight bot:
- Correct algorithms (for example for the fog of war): Before some wild guessing first calculate the things that you really know for sure. Lost picks give intel for example. Also the opponents visible deployment gives intel. Let's say you have africa and australia and border him only in south america. Him then deploying 8 visible gives you the intel that he has North America (but no intel on South America). So you can add all territories in North America into your KnownOpponentsSpots list. (My bot isn't that smart at present)

- Simplification: Sometimes you see my bot performing some 'smart' moves like breaking an opponent bonus, defending an own bonus or even flanking an opponent bonus when a full force attack isn't possible. Look in following game how my bot takes africa on round 12:
http://theaigames.com/competitions/warlight-ai-challenge/games/5334d32f4b5ab22823394ef0
I didn't write any code telling him that the opponent is probably in South America and at present he isn't using the intel from losing his South America picks. What I do is giving each territory a value. If a territory is bordering a bonus on which I have no intel I add some value to that territoriy. So all my bot does is using his armies to go for the territory with the highest value each and every turn. If this isn't possible due to the opponent having a big stack there the bot will go for priority two. If I then add some value to a territory for each border to an opponent bonus you will see some smart flanking moves. I also add some value to my own territories for each army I have there to ensure that my bot won't build multiple small stacks. Working with territory values is much simpler than writing thousands of error prone if-then-else statements resulting in unwanted behavior. Nice about working with territory values is that you can just change some numbers to make your bot act differently, and maybe even outsource these values into a seperate file.

However, I probably won't have enough time to make my bot smart enough to compete with some serious competition. A good warlight players with enough coding skills taking this competition seriously and following the principle of my bot design should easily be able to steamroll the current ladder including the current version of my bot.
Warlighter's Bots for AI challenge: 4/10/2014 01:52:35

Andy
Level 44
Report
I'm in here as wandrew in the AI Games! Not doing too bad so far.
Warlighter's Bots for AI challenge: 4/10/2014 02:29:10

JSA 
Level 60
Report
I watched that game with Norman's bot and I must say, it's pretty impressive. This competition could lead to 10 different levels of AI's on warlight. Level 1 is like the current one. Level 5 is average. Level 8 would be a good player. Level 10 would be a top player. Granted, this won't happen any time soon I think. But I would say Norman's bot is already Level 4ish and they're only gonna get better. If I could code at all, I would definitely be trying this. Keep up the good work guys!
Warlighter's Bots for AI challenge: 4/10/2014 08:38:15

{rp} pedrito 
Level 48
Report
Warlighter's Bots for AI challenge: 4/10/2014 15:55:35


Trogatog
Level 52
Report
Posts 41 - 55 of 55   <<Prev   1  2  3