[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 Mon Jul 16, 2018 9:01 am Advanced search

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

Share and discuss ideas for your entries here.

Re: Unleash your code - learn from eachother

Postby smiley1983 » Sun Nov 28, 2010 1:50 pm

botname: smiley1983
unofficial rank: 50 - 150
language: Objective Caml
Source:

The code is a mess. It has plenty of errors. :)
Here's a brief description of its algorithm, errors omitted:

Each turn:
- For each planet:
- - Build a table of future ship counts and fleet arrivals based on fleets currently in the air.
- - Build some tables of possible future ship arrivals, based on the predicted ownerships of other planets from table 1.
- - - Cases include what happens when we fight over the planet with appropriate leeching delay, and what happens if only one pours fleets in.
- generate requests for fleets to prevent planet losses (this includes Neutrals becoming enemy)
- call fill_requests with few safety constraints, but requiring that the fleets get there on time.
- add requests to capture enemy planets
- call fill_requests with strict safety constraints
- call fill_requests with slightly relaxed safety constraints (two steps ensuring safer attacks are given priority over more dangerous ones)
- add Neutral capture requests
- call fill_requests with appropriate safety constraints
- redistribute fleets toward frontline planets if they meet criteria
- redistribute fleets between frontline planets if they meet criteria
- submit orders.

The fill_requests function can draw fleets from multiple source planets.

Thankyou to everyone who participated in the contest, it has been lots of fun!
smiley1983
Colonel
 
Posts: 54
Joined: Tue Oct 05, 2010 6:28 pm

Re: Unleash your code - learn from eachother

Postby iouri_ » Sun Nov 28, 2010 2:41 pm

Last edited by iouri_ on Mon Nov 29, 2010 7:57 pm, edited 3 times in total.
iouri_
Brigadier-General
 
Posts: 105
Joined: Thu Feb 11, 2010 4:16 pm
Location: Toronto, Canada

Re: Unleash your code - learn from eachother

Postby bhasker » Sun Nov 28, 2010 3:07 pm

https://code.google.com/p/malazan-bot/source/checkout
https://code.google.com/p/malazan-bot/s ... trunk/0.23 (0.23 version)
My bot is mostly a pure heuristic bot and I don't even look at enemy moves. The code is kind of messy with lots of comments
hanging around, i will clean it up and upload a cleaner version later. This bot was holding to about 40-50 rank on official. I will
upload 0.23 version of this bot as well which was holding 40-50 as well but is slightly different in how it does things.

The basic logic of the code is somewhat like this
a) at Turn 1 do a knapsack based solution to decide planets to capture
b) 2-200 purely heuristic based and a lot of checks on when to attack neutrals, it will always attack an enemy planet
if it has enough ships to take it.

At start of every turn it calculates state of the game upto maxDistance*2+1 turns. It then uses this state object to evaluate
moves and score each move. It also uses this object to decide how many ships can be sent from a planet safely and how
many it will have available in the future etc ( this part is a bit buggy). It also uses this to decide how many ships need
to be sent to capture an enemy planet ( without considering other enemy planets ). This piece of code is a bit of a mess
because earlier I only used to calculate state upto the distance of the fleet furthest out. This lead to lot of hacky code,which
is now dead code.

The main bot logic goes like

doTurn
updateStateObj
buildShipAvailabilityQ
for each planet p:
generateMoves
optimizemoves
executeOptimizedOrder
updateStateObj
doRemainingShips # all staging/routing code at end of turn
Last edited by bhasker on Sun Nov 28, 2010 3:36 pm, edited 1 time in total.
bhasker
Lieutenant
 
Posts: 12
Joined: Tue Sep 14, 2010 2:17 am

Re: Tell us your secrets

Postby amstan » Sun Nov 28, 2010 3:14 pm

I'm merging this thread with the other. Please don't make new ones.
Alexandru M. Stan
Contest Organizer
User avatar
amstan
Contest Organizer
 
Posts: 691
Joined: Sun Jan 31, 2010 4:02 am
Location: Stoney Creek, Ontario

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

Postby murrayr » Sun Nov 28, 2010 3:46 pm

Bot name: murrayr
Unoficial rank: Top 20
Final rank: 67=
Language: C++
Source: attached

Greedy algorithm: Given the a state of the game, I calculate the future for each planet and its spare firepower above that required to hold the planet. Then I simulate a full firepower attack by both sides against each planet, with the enemy holding back one step when attacking neutrals to simulate sniping. These are scored from the gains (holding a planet for a turn) and losses (attacking neutrals), with a penalty of 10% per turn that it will take to capture the planet. The best scoring attack is selected with enough force to capture the planet for at least 3 turns. Then the calculations are redone until there are no more good planets to attack.

Now I want to guess out what the enemy is actually going to do this turn, so I can try to avoid silly moves and take advantage of things it might do. So I run the greedy algorithm for it, add its moves to the current state, then recalculate my moves. But that might give problems when the enemy does something else. So, for 0.5 seconds, I iterate between the enemy generating moves and me generating moves, each time running the greedy algorithm against all generated (relative)enemy moves, believing the worst score and highest number of ships required.

My bot still has problems with giving away planets too cheaply for a small gain, because it uses per-planet scoring. So during the start of a game with close first planets, it calculates firepower that has to be held for full defense.

If I was to do this again, I would like to try using iteration and simulated annealing to improve sets of missions with global scoring, and possibly with probabalistic modeling of enemy moves.
Attachments
galconPlayer.zip
(14.82 KiB) Downloaded 186 times
Last edited by murrayr on Thu Dec 02, 2010 7:17 pm, edited 1 time in total.
murrayr
Cadet
 
Posts: 1
Joined: Sun Nov 28, 2010 2:51 pm

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

Postby medrimonia » Sun Nov 28, 2010 7:13 pm

Bot name: Medrimonia
Unofficial Rank : Between 10 and 30
Language : Python
Source : Attached

My bot has a high priority to avoid the possibility of the enemy to take my planets: It's supposed to calcul the numbers of free_ships I have on each planet (ships I can move without risking to loose my planets) and after with this number it manages to:
- snipe the enemies attacks on neutrals (if the score I give them is good enough.
- attack the enemies if it can (this part of the program is old and can send more than the free_ships, destroying my defence system)
- Attacking neutrals to increase my growth (I'm trying to avoid the expands which would allow my opponent to have a better expand)
- Redistribute ships from my useless planets and to my endangered planets.

There's still a lot of issues like a big problem to deals with multiple fronts.

My code is really very dirty...

tout_en_un_r91.tar.gz
(18.8 KiB) Downloaded 194 times
medrimonia
Lieutenant
 
Posts: 10
Joined: Fri Sep 17, 2010 6:13 pm

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

Postby lakeweb » Sun Nov 28, 2010 8:11 pm

I only got to basic infrastructure even in my second bot. Outline:
Create a set of attacks on planets and stat the future of the planet.
Find what 'my' planets now and in the future that can take other planets.
Same to defend my planets at risk.
(at this point I had no aggressive plan.)
Create a graph to stream ships from back planets to front.
(This was somewhat working but needed work.)

My TODO was to clean up DoTurn, use more of the objects instead of top down. And get an overlord strategy in place.

Here it is:


Best, Dan.
lakeweb
Cadet
 
Posts: 3
Joined: Mon Sep 20, 2010 5:58 pm


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

Postby Hippo » Sun Nov 28, 2010 11:52 pm

I was not planning to make serious attempts in the contest, but I have writen heuristic bot.
It mades roughly 6 actions ... defending mine, "defending neutrals", colonize neutrals, centralize, attack exposed enemy, flow attack (when leading).
All (defences) were based on ships on the air arrival calculations. Colonizing used minimum return turn for selecting the best planet to attack and the attacks were planned to arrive to the neutral at the same turn. All ships were send directly to the target.

I have looked at the actual score and expected performance around 500. I was surprisingly rated around 80.
This encourages me. I have started codding of more serious bot using BItsets for planets the the given distance making plans for the whole game (but only with small horizon filled) with time management, reading input only till all infomation is known... calculating planet influence as a dimension for colonizaction optimization but I got time for programming only occassionally so the project was never compiled.

Instead I have looked at the prerformance of my heuristic bot and tried to improve the heuristics a bit. I have changed centralizing not to use one skip, but rather centralize with shorter flights (minimum of some cost function). This was done when I felt to position around 120 and the improvement moved me to position 35, then I start drifting to positions around 80.

After chaniging the map generator I started losing, as simple centralizacion to planet nearest opponent does not work well on line symmetry maps. (I was losing mostly on maps with frontline consisting of several planets till that).

I never considered planet sizes for my defense heuristics. I never considered opponent's options. Instead I have tried to calculate the number of ships required for defense if opponent issues an attack (my bot used same calculation for determining targets). I have added "shared reserve" calculations. I hav eposted the third version of bot with that and it returned to positions around 80.

Early after posting I find the calculation was wrong and it actually does not calculate required defense. I have removed the bug, but the bot was absolutely passive and won around 10% maps against the posted "buggy one". The situation when the bot performed well due not doing what was intended made me nervous and I have tried to made better version of it.

I wanted to modify the bot not to be as eager as it was I have added global measure ... when having greater total growth planned ... not to invest to other neutrals losing due to small total number of ships. Meanwhile I have found several other "bugs" in the code ... when capturing opponent's planet, I was not supporting it until turn it becomed mine. When I have planned to attack neutral later, I have started centralization to that planet. ... I had about 5 candidate bots each improved some way. Seems I have not chosen the best, as now I am around 250, while not changed bot's skipped me (and a lot of crazy moves could be visible ... so letting the buggy one was probably the best option :) ).
I modified colonization in the way ships are moved closed to the neutral to let them available elsewhere if the attack would be canceled.
There were other paths leading nowhere as well ... sending troops in path optimised to "as short" skips as possible does not improve the ship availability.
I have added ... attack nearest planet mode for the case I am "winning" (was intended for the case higher number of ships but smaller growth rate, but rarely invoked in that case). This mode probably requires shortening the fleet skips. It works better on maps with distant players.

My heuristics bot started every turn almost from scratch without considering previous turns.
This is why sometimes the capturing neutral plan is abandoned even with 0 neutrals on the planet :(.
Having buggy eager version is better than having "defender" version with bugs in the main line ...

I like the iouri's method how to not went to passivity. Just consider several options and calculate their best "investment return".

So ... next time I would probably not participate at all ... participation without serious time plan ...
Hippo
Lieutenant-Colonel
 
Posts: 49
Joined: Wed Mar 03, 2010 6:42 pm

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

Postby aerique » Mon Nov 29, 2010 8:46 am

aerique
Brigadier-General
 
Posts: 131
Joined: Fri Feb 05, 2010 3:23 pm
Location: Netherlands

PreviousNext

Return to Strategy

Who is online

Users browsing this forum: No registered users and 0 guests

cron