2 class AbstractGameBoard( object ):
3 def __init__( self
, gamestate
):
6 def GetRelativePixel( self
, start_pos
, facing_dir
,
7 offset_fwd
, offset_right
):
8 """Given a position to stand in the arena, and a direction to face,
9 return the status (0 for empty, >0 for non-empty) of a pixel that
10 is offset_fwd pixels in front, and offset_right pixels to the right
11 (negative values may be used to go backwards or left respectively).
12 Pixels outside the arena also return >0."""
15 def GetAbsolutePixel( self
, (x
, y
) ):
16 """Return 0 if the absolute position specified does not contain
17 a pixel, and >0 if it does. Pixels outside the arena also
21 def GetArenaSize( self
):
22 """Return the size of the arena as a tuple (width, height)."""
25 def GetPlayerPositions( self
, pos_to_exclude
= None ):
26 """Returns a list of pairs (pos, dir) for each player on screen.
27 Excludes the player at the position specified if pos_to_exclude
31 def TurnRight( self
, direction
):
32 """Return the direction found by turning 90 degrees right from
33 the supplied direction."""
36 def TurnLeft( self
, direction
):
37 """Return the direction found by turning 90 degrees left from
38 the supplied direction."""