Package nflgame :: Module game :: Class FieldPosition
[frames] | no frames]

Class FieldPosition

source code

object --+
         |
        FieldPosition

Represents field position.

The representation here is an integer offset where the 50 yard line corresponds to '0'. Being in the own territory corresponds to a negative offset while being in the opponent's territory corresponds to a positive offset.

e.g., NE has the ball on the NE 45, the offset is -5. e.g., NE has the ball on the NYG 2, the offset is 48.

This representation allows for gains in any particular play to be added to the field offset to get the new field position as the result of the play.

Instance Methods
 
__init__(self, pos_team=None, yardline=None, offset=None)
pos_team is the team on offense, and yardline is a string formatted like 'team-territory yard-line'.
source code
 
__cmp__(self, other) source code
 
__str__(self)
str(x)
source code
 
add_yards(self, yards)
Returns a new field position with the yards added to self.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Static Methods
a new object with type S, a subtype of T
__new__(cls, pos_team=None, yardline=None, offset=None) source code
Properties

Inherited from object: __class__

Method Details

__new__(cls, pos_team=None, yardline=None, offset=None)
Static Method

source code 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__
(inherited documentation)

__init__(self, pos_team=None, yardline=None, offset=None)
(Constructor)

source code 

pos_team is the team on offense, and yardline is a string formatted like 'team-territory yard-line'. e.g., "NE 32".

An offset can be given directly by specifying an integer for offset.

Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

add_yards(self, yards)

source code 

Returns a new field position with the yards added to self. Yards may be negative.