Initial commit: you can play single player against an "always-turn-right" opponent.
[troncode.git] / player_turnright.py
blobe5d06bb0836020b584fc2d0a09db765a6cbf0e28
1 from troncode_values import *
3 class TurnRightPlayer( object ):
5 def __init__( self ):
6 pass
8 def GetColour( self ):
9 return ( 160, 160, 255 )
11 def GetName():
12 return "Turn Right Player"
13 GetName = staticmethod( GetName )
15 def GetDir( self, position, direction, gameboard ):
16 """Turn right if there is a pixel directly in front."""
18 if gameboard.GetRelativePixel( position, direction, 1, 0 ) > 0:
19 return gameboard.TurnRight( direction )
20 else:
21 return direction