Skip to content

analytics.py

Damon Getsman edited this page Nov 18, 2018 · 2 revisions

analytics.py holds, of course, the methods and objects required for analyzing different facets of the game play in order to determine the best moves possible. There may be some overlap with seek_n_nav.py, we'll have to see when analysis of the code has gone that far.

Information on objects contained within follows:

MapChunk

The MapChunk was proposed by a different GitHub user here in order to handle some of the navigation and other local area game play details for short-term analysis. For example, each particular ship could have a 3x3 MapChunk detailing the important bits about the local environment; ie best halite source, whether or not it is occupied, whether or not there are any enemies in the local environment, structures present, etc. This could, potentially, be used for subdividing the entire map for chunk analysis to compare things, but I've not really gotten far enough into that to do much, yet. However, if it becomes possible in the future to analyze for local maxima, chunk analysis around each particular maxima site could make mining much more profitable, as well as keep the ships close enough together to potentially reap rewards from each others' presence, if I remember that rule of bonuses in the new game play correctly.

object details

fields

  • Width
  • Height
  • x_start
  • y_start
  • cell_data - a 2 dimensional array holding the halite content of each x/y position
  • has_shipyard
  • has_dropoff

instance methods

  • __init__ - takes the x_init and y_init arguments as positions to begin when breaking off this particular map chunk and initializes the rest of the data
  • mark_devoid_cells - goes through and marks any cells that have no halite as 'unsafe' for usage with naive_navigate's routines on a per-ship basis
  • create_centered_chunk - creates a chunk (with an odd # of cells in width & height) centered around the current ship's position

HaliteAnalysis

Contains different static methods for analyzing the halite content of the map in general and other non-MapChunk situations. I'm not sure at this point, but all of this may be better placed under the current MapChunk object structure, especially if history is going to be saved for potential deep learning usage later on in the iterations once the dumb routines are figured out.

methods

  • find_best_dir - method will use the ship's position and scan the 4 cardinal directions for the most profitable halite move. Returns the direction of that most profitable cell. This takes into account whether or not that cell is currently occupied.
Clone this wiki locally