reset password
Author Message
rabbott
Posts: 1649
Posted 22:10 May 20, 2012 |

I have cleaned up the code in W7.bot. It does search and explore quite well. It still has no combat skills. 

If you want to use some of the pieces, they are available. If you use them, adapt them to your own system or use them as components of your larger strategy. Don't just copy my code as a whole and put your name on it.  

With that in mind, this is how to make you way around in it.

Besides the top-level MyBot class, there are three packages.

stateInfo contains basic classes to keep track of the game state. The primary interface is the GameState class.  That class also has a public static gameState variable that stores the current GameState.

utilities contains, as you would guess, utility classes. 

gamePlay contains the classes that play the game.

  • TurnManager manages a turn at the top level. It reads the input, calls gameState to update the state, and then calls a Strategy instance to generate moves. 
  • Strategy decides which moves to make, i.e., which orders to give.
  • BFS provides a generic bread-first search.  It is used by Strategy to search backwards, e.g., from food to ants. This is the way John does his searches.
  • MoveManager takes care of the details of orders. It ensures that ants don't step on each other. Use assignOrder( ) to assign an order to an ant. After assigning all the orders you want to assign, call findValidMovesForRemainingAnts( ) to make sure that ants don't step on each other.  After that call issueOrders( ) to print out the orders for the game engine.

The current exploration strategy is to explore the space outward from the ant's own hills. (This is an adaptation of Scott's approach.) Once the entire space is explored, it looks for cells that it hasn't seen recently.

The gamePlay package contains a combat sub-package. It has the battle identification and genetic algorithm code. None of it is currently used.

If you have questions, feel free to ask.

-- Russ Abbott


rabbott
Posts: 1649
Posted 19:34 May 21, 2012 |

To make W7.Bot easier to build, I downloaded the Guava source code (in the package com.google.common) along with a couple of other required classes (in the packages sun.misc and sun.reflect). The W7.Bot code along with Guava and the other classes are in W7G.Bot project under src.  If you create an eclipse project with that source code, it should compile and run with no classpath/buildpath additions.

rabbott
Posts: 1649
Posted 20:55 May 21, 2012 |

Besides the packages com.google.common, sun.misc, and sun.reflect the package javax.annotation has also been added to W7G.Bot.