nhl.rink

Module Attributes

LENGTH

Rink length (ft)

WIDTH

Rink width (ft)

DX

Delta length from center ice (ft)

DY

Delta width from center ice (ft)

BLUE_LINE_X

Blue line x-position from center ice (ft)

GOAL_LINE_X

Goal line x-position from center ice (ft)

NZ_FACEOFF_DOT_X

Neutral zone faceoff dot x-position from center ice (ft)

OZ_FACEOFF_DOT_X

Offensive zone faceoff dot x-position from center ice (ft)

FACEOFF_DOT_Y

All faceoff dot y-position from center ice (ft)

FACEOFF_DOTS

Tuple of faceoff dots (x, y)

Classes

Location(*args, **kwargs)

NHL location object.

class nhl.rink.Location(*args, **kwargs)[source]

Bases: nhl.flyweight.Flyweight

NHL location object.

This is the detailed docstring.

distance(other)[source]

Measure distance between current location and another on-ice location.

Parameters

other (Location) – location to measure distance from

Returns

distance (ft)

Return type

float

classmethod from_key(x, y)[source]

Return flyweight object with specified key, if it has already been created.

Returns

Previously constructed flyweight object with given key or None if key not found

Return type

cls or None

classmethod has_key(x, y)[source]

Check whether flyweight object with specified key has already been created.

Returns

True if already created, False if not

Return type

bool

x: int

Rink position in ft along x-axis (length) [-100, 100]

Type

int

y: int

Rink position in ft along y-axis (breadth) [-42, 42]

Type

int

nhl.rink.BLUE_LINE_X = 25

Blue line x-position from center ice (ft)

nhl.rink.DX = 100.0

Delta length from center ice (ft)

nhl.rink.DY = 42.5

Delta width from center ice (ft)

nhl.rink.FACEOFF_DOTS = ((0, 0), (20, 22), (20, -22), (-20, 22), (-20, -22), (69, 22), (69, -22), (-69, 22), (-69, -22))

Tuple of faceoff dots (x, y)

nhl.rink.FACEOFF_DOT_Y = 22

All faceoff dot y-position from center ice (ft)

nhl.rink.GOAL_LINE_X = 89

Goal line x-position from center ice (ft)

nhl.rink.LENGTH = 200

Rink length (ft)

nhl.rink.NZ_FACEOFF_DOT_X = 20

Neutral zone faceoff dot x-position from center ice (ft)

nhl.rink.OZ_FACEOFF_DOT_X = 69

Offensive zone faceoff dot x-position from center ice (ft)

nhl.rink.WIDTH = 85

Rink width (ft)