[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/bbcode.php on line 112: 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 112: 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 - Tell us your secrets, unleash your bot's code!

It is currently Wed Jan 17, 2018 11:04 am Advanced search

Tell us your secrets, unleash your bot's code!

Share and discuss ideas for your entries here.

Unleash your code - learn from eachother

Postby Error323 » Sun Nov 28, 2010 10:10 am

Last edited by Error323 on Sun Nov 28, 2010 10:51 am, edited 2 times in total.
Error323
Cadet
 
Posts: 2
Joined: Wed Oct 06, 2010 3:27 pm

Re: Unleash your code - learn from eachother

Postby antimatroid » Sun Nov 28, 2010 10:15 am

This is my code, exactly as submitted: https://github.com/amstan/antimatroid Edit: The bot was written in c++.

There is a bit of a description of it in the spill your secrets thread.
Last edited by antimatroid on Sun Nov 28, 2010 3:57 pm, edited 2 times in total.
antimatroid
Brigadier-General
 
Posts: 126
Joined: Tue Feb 16, 2010 7:41 am

Re: Unleash your code - learn from eachother

Postby siconize » Sun Nov 28, 2010 10:17 am

Last edited by siconize on Sun Nov 28, 2010 10:58 am, edited 1 time in total.
siconize
Captain
 
Posts: 27
Joined: Wed Oct 20, 2010 9:48 pm

Re: Unleash your code - learn from eachother

Postby Mistmanov » Sun Nov 28, 2010 10:57 am

Botname:
unofficial rank: was hovering around ~50 the last few days
language: c++, all english commentary (I think..)

features:
- Pretty solid defensive strategy described here: viewtopic.php?f=17&t=990
- stuff.
Attachments
Mistmanovbot.zip
(16.1 KiB) Downloaded 167 times
Last edited by Mistmanov on Sun Nov 28, 2010 4:00 pm, edited 1 time in total.
Mistmanov
Colonel
 
Posts: 70
Joined: Fri Sep 24, 2010 6:50 pm

Re: Unleash your code - learn from eachother

Postby mogron » Sun Nov 28, 2010 11:05 am

https://github.com/mogron/googleaibot

Language: C++
Last ranking when I looked yesterday: ~60
Most important file: MyBot.cc
uses albertz framework and an a*-library.

It's very ugly. The only thing I really like is the aggressive supply mechanism (supply() and setExpansionTargets()). And the panic() and dominating-stuff, which can make endgames more interesting. Other than that it's just: create a list of non-horrible orders (for single planets and pairs of planets), evaluate them (just use current predictions and how those would be affected by the orders), optimize the best found order, send.
mogron
Lieutenant
 
Posts: 18
Joined: Mon Sep 20, 2010 9:07 am

Re: Unleash your code - learn from eachother

Postby Ice_Harley » Sun Nov 28, 2010 11:06 am

Source code:
Language: C#
Unofficial rank: between 20 and 50

My bot has some "advisers":
- AttackAdviser
- DefendAdviser
- InvadeAdviser
- StealAdviser - you call it "snipe", but i am more fair :)
- FirstMoveAdviser - makes full brute force for first move combinations with antiRageBot defend, considering close planets can return some ships before enemy arrive
- AntiCrisisAdviser - if in stalematу in losing position "calls Chuck Norris". Disabled in last versions, because makes position worse in many cases
- SupplyAdviser

MyBot class selects combination of advises that have highest score. But scoring seems to be weakest side of my bot.
Last edited by Ice_Harley on Sun Nov 28, 2010 6:16 pm, edited 1 time in total.
Ice_Harley
Captain
 
Posts: 25
Joined: Fri Sep 17, 2010 7:14 pm

Re: Tell us your secrets

Postby narnach » Sun Nov 28, 2010 12:42 pm

In order to make it easy to extend and tweak my bot, it has a list of strategies that it will move through in turn. These strategies usually iterate through all my planets and then for each possible target other planet decide to either send a fleet, do nothing or explicitly assign defending ships that can not be used to form fleets.

By executing my defensive strategy relatively early and reserving planets to defend against inbound fleets and potential attacks from nearby enemy planets, my offensive strategies can be as greedy as then want without endangering my planets too much. The defensive strategy predicts the future far enough into the future that all inbound ships have arrived and resolved their battles. It also keeps enough reserves that if the nearest enemy planet would attack this turn, it would not capture the planet. All ships not assigned as defenders are available to attack.

My main bot, Sniperbot, actually started as a bot that only sniped targets. Because nearby neutral planets are ofter a better choice than planets on the other side of the map, I added a strategy to attack targets of opportunity. After that I added defensive strategies and heavily tweaked the target selection algorithms. Then followed supply lines and strategies to deal with global game state: if I'm ahead of my enemy in terms of total ships and planet growth, bleed them for ships until the other strategies choose to capture their planets. If I'm way behind in terms of total ships and planet growth, perform a desperate all out attack. If you're certain to lose, better try to go for that 1% chance to still win. This has actually managed to turn the tables in a couple of games on the live server.

My target selection has changed over time, with me trying to find a more optimal way to evaluate which planets to attack and which to leave alone. The most recent code accounts for return on investment, nearest enemy fleet (sniping potential) and defensibility of the planet (closer to my planets or the enemy?).

When the maps were changed from 23 planet point symmetry to max 30 planets point or line symmetry, my bot just kept on working without changes. However, since I had optimized my bot based on matches played on the older maps, a number of optimizations were no longer effective. The bot that was live before the switch was version 16, but, after a big local tournament between the last 10 submitted versions, it appeared that version 12 was more effective on the new maps. A lot had changed in my bot between v12 and v16, so I kinda lost the motivation to backport the v12 strategies to the v16 codebase and continue development.

I learned a lot from reading the forums and watching how my bot behaves against opponents on the live and TCP server and in the local tournaments I organize between my bots. I think I may have spent about as much time working on tools to suppport my bot development as on the bots themselves, and I must admit it was a lot of fun to do so!

An interesting observation. At first I thought that my bot would be slow and I explicitly added a 'time left' method that is used in all logging calls and I checked it each step of iterations to determine if I should just stop instead of running out of time. But that never happened: most of my turns finished in under 10ms, even though just about all my code keeps iterating through collections and all distances calculations are done on the fly each and every time it is required.
So much for Ruby being a 'slow' language: fast enough is fast enough.

My code is now available at https://github.com/Narnach/ai-contest-ruby

My bot's live server performance: http://ai-contest.com/profile.php?user_id=11428
The v12 code that runs on the live server: https://github.com/Narnach/ai-contest-ruby/tree/v12
narnach
Cadet
 
Posts: 6
Joined: Sat Nov 13, 2010 1:56 pm

Re: Unleash your code - learn from eachother

Postby smloh1 » Sun Nov 28, 2010 12:46 pm

Bot name: smloh1
Language: Java
Unofficial rank: hovered around the high teens (with a fluke moment in number 1!)

My code is slightly messy due to the number of tweaks/tunings/abandoned approaches contained within, but I will try to run over the main ideas in my bot:

a) Calculation using "potentials" for conquerability/defendability:
Using
- World model : calculates future expected state of each planet at each point in time
- Ship potentials : number of my/enemy ships that could potentially reach each planet at each point in the future. My potential ships are limited if needed for defense of planet they are sent from.
- World model with potentials : expected future state of each planet if both me and enemy send all potential ships at it
From the last model, we can tell whether we can attack/defend a planet for certain, without the enemy being able to send enough ships to interfere. This is the check we use to identify potential planets to attack.

b) Calculation of world state value:
"Value" of a world state is calculated by calculating the difference between the number of our ships and enemy ships at some (distant) point in the future, in the World model with Potentials. By taking into account the current potential planet outcomes, it gives a pretty good gauge of each player's positioning for expansion/growth. This is used to choose planets to attack by comparing what the world state value would be if we attack, for each potential target planet.

c) Attack coordination:
When a planet is identified for an attack arriving at a certain point in the future, we try to perform the attack using the planets closest to the target. If some ships do not need to be sent out now to reach the planet in time, they are "reserved" so we do not allocate them to another attack this turn.

d) Defence:
We also identify when a planet could be made secure against an undefendable enemy attack, and send just enough ships from (supposedly, since we calculate by an approximate metric) less crucial planets, so that we can still send enough ships the next turn to keep the planet secure. Once again, we also check the "Value" calculation to see which defences are most important.

e) Reinforcement:
Using an approximate metric which judges how much "Value" would increase if each planet had more ships, we identify a close-by target planet for each planet to reinforce. This could turn out to be the planet itself, in which case we don't need to send any ships. If not, we try to determine the best amount of ships to send by testing the resultant "Value" for different numbers of ships.

f) Couple of other things:

- Sniping is handled in a non-disruptive way by calculating models using the most beneficial time for me/enemy to send ships to a planet at each point in time - by comparing resultant planet state if ships had been sent as available, or if all ships were sent only at that turn.

- Defendabality of planets we plan to attack, and planets we send ships from, is implicitly calculated (somewhat unreliably) through the use of "Value", which would fall if a move would result in lower expected future ship production.

- When attacking, the enemy can only respond to your moves in the next turn. Therefore, you have a first-mover advantage when attacking. This is considered using another World model with "delayed potentials" where the enemy is assumed to make no move this turn. Using this allows identification of planets which we could conquer IF the enemy did not just happen to be reinforcing them this very turn.

- Stopping over. Whenever moving ships from one planet to another, if a planet we own(or will own) is somewhere in between, where we can stop over and still keep the same total distance, stop over for more flexibility.


Thanks, everyone, especially admins, for a great time.
Attachments
SmlohBot.zip
Bot as submitted for smloh1
(20.34 KiB) Downloaded 210 times
smloh1
Cadet
 
Posts: 5
Joined: Tue Oct 19, 2010 8:11 pm

Re: Unleash your code - learn from eachother

Postby narnach » Sun Nov 28, 2010 12:50 pm

Source code: https://github.com/Narnach/ai-contest-ruby
Bot on live server: http://ai-contest.com/profile.php?user_id=11428
Language: Ruby
Final ranking pre-finals: 378
Ranking range pre-finals: 200-400
Writeup: viewtopic.php?f=17&t=1168&p=7821#p7821

I started with the Ruby starter kit and kept its game state parsing code because it was good enough and I did not feel like rewriting something that worked. For the rest I wrote multiple bots with different strategies and ran local tournaments to determine who was the strongest. The Rakefile contains code to run a local tournament between all bots and all past submissions to the live server.

Sniperbot is the main bot.
Last edited by narnach on Sun Nov 28, 2010 1:59 pm, edited 1 time in total.
narnach
Cadet
 
Posts: 6
Joined: Sat Nov 13, 2010 1:56 pm

Free the bots!

Postby PaganCyC » Sun Nov 28, 2010 1:44 pm

Now that submissions have ended, is there any reason not to encourage people to release the code for their bots?

I know I'm not the only one whose bot is far from 'done', and I'd like a few decent bots to test against locally.

[*EDIT*] I'm not a complete moron, this post was moved from another tread. ;-)
Last edited by PaganCyC on Sun Nov 28, 2010 5:34 pm, edited 1 time in total.
PaganCyC
Cadet
 
Posts: 1
Joined: Sun Nov 28, 2010 1:39 pm

PreviousNext

Return to Strategy

Who is online

Users browsing this forum: No registered users and 1 guest

cron