To quote the readme:
These are the significant changes from ants.py in the official Python starter
-ants.map is now a 2D numpy array. Note that writing map[r,c] is a bit
faster than map[r][c]. More importantly, you can index by a position directly:
However, indexing a numpy array is sadly 10x slower than indexing a list of
lists, so it would be a good idea to copy the map back to a temporary list of
lists each turn if you want to do lots of indexing (and if you're not... well,
what are you doing?!).
-Tiles in ants.map are now UNSEEN instead of LAND if you've never seen them.
-ants.visible is a 2D numpy array of booleans, marking the tiles visible this
turn, instead of a function.
-The locations of food and of ant hills are now remembered even when they aren't
visible. They are automatically forgotten if their tile becomes visible but
-ants.turn tracks the turn number and ants.turns the turn limit.
-ants.neighbours and ants.neighbours_and_dirs return lists of the four tiles
surrounding a tile, or (position, direction) tuples.
-ants.render_text_map is improved; in the official package it doesn't
show anthills (or unseen tiles of course).
-ants.issue_order can now called like ants.issue_order(ant_loc, direction) or
ants.issue_order(ant_loc, destination) rather than just
-There's a debug() function in ants.py for convenience.
MyBot.py is identical.
See sample.py for some example usage of numpy. I'm not actually recommending you
use the BFS function therein directly for pathing to food, but it's a decent
start for a simple bot and at least one current top 10 bot is that stupid! You
might find some other use...
Statistics: Posted by tmc — Fri Oct 28, 2011 2:51 pm