1 from troncode_values
import *
3 class TurnRightPlayer( object ):
4 """An example player to get you started on writing your own. This player
5 goes straight until it hits a wall, and then it turns right."""
8 """Do any required setup here."""
11 def GetColour( self
):
12 """Return the colour this light cycle should be displayed on screen."""
13 return ( 160, 160, 255 )
16 """Return the name of this player as it should be displayed."""
18 GetName
= staticmethod( GetName
)
20 def GetDir( self
, position
, direction
, gameboard
):
21 """Turn right if there is a pixel directly in front.
22 position is my location - a point (x,y) in the arena
23 direction is my direction: DIR_UP, DIR_DOWN, DIR_LEFT or DIR_RIGHT
24 gameboard is an AbstractGameBoard which has useful methods on it."""
26 if gameboard
.GetRelativePixel( position
, direction
, 1, 0 ) > 0:
27 return gameboard
.TurnRight( direction
)