====== ICFP 2004 - Finished and Improved ====== =====Finished Version===== Jörg has finished the ant program as described in [[..:ICFP2004#Our_Approach|Our Approach]]. The version can be downloaded from {{.:finished.tgz|here}} See [[.:Screenshots#f_s2|Screenshots]]. =====Improved Version===== I could not resist to improve the finished version. I have added a queen that will guard the food storage and some ants that maintain the hill and kill enemies. The new strategy is described below. You can download the source [[.:improved.tgz|here]] See [[.:Screenshots#i_f|Screenshots]] ====Global Strategy:==== There are 4 different kind of ants: * queen * mark paths -> become explorers later * explore & get food * stay-at-home ====Initial phase:==== * the initial phase it is decided which ant becomes what. * queen election: The ant that sees 3 non-home fields is the queen * mark paths: all ant at the border of the hill * the rest is divided with the ratio 7:1 in explore and stay-at-home ants ====Queen strategy:==== * go to center of hill * mark center as storage with Marker5 (reuse, since foodtracks are not used inside the hill) * stay of storage cell and look around for comming friends with food * clear the cell for very little time and go back. ==== mark path strategy:==== * turn to the outside of the hill * go straight and mark the passed cells with 3 2 1 periodicly * occasionally they go left or right but then the next time they go in the opposite side -> allways go away from the base * rocks and obstacles are avoided and the original direction is memorized * finish if the own cell and the cell ahead is marked and we see a rock * become explorer ==== explorer strategy:==== * go around until find food or food path * if at foodpath: follow it in the right way and decrement the foodpath strength by one * if at food: pickup and look for marked way * follow way to base * during carrying food mark the path with maximal food strength (3) and write the gradient 3 2 1 * if at home: drop at the inside border and explore ==== stay-at-home strategy:==== * go around the inside border of the hill * if see food: take it and follow the border until reach a corner * if at corner turn to center and try to access it and drop food there * during the whole time make sure to stay in the base and look for enemies * if see enemy try to follow him and stick at his ass! Occasionally try to change to relative position to the enemy to give other ants a better chance help surrounding. ====Results:==== On map 5 the Black colony has a clear disadvantage since the food is much more far away. The food-storage strategy with the queen and the killer ants shows its potential: <code> RED : Rewrite BLACK : Rewrite2 Map : sample5.world Iterations: 10000 Red colony won! Score: 203 : 62 (Red : Black) Killed: 1 : 0 (Red : Black) Iterations: 20000 Red colony won! Score: 236 : 148 (Red : Black) Killed: 2 : 1 (Red : Black) Iterations: 40000 Black colony won! Score: 202 : 269 (Red : Black) Killed: 5 : 1 (Red : Black) Finally: Iterations: 100000 Black colony won! Score: 0 : 632 (Red : Black) Killed: 50 : 1 (Red : Black) </code> Yeah! {{tag>computing programming_contests haskell}}


projects/icfp2004/finishedandimproved.txt · Last modified: 17.01.2009 14:31 (external edit)