NAME
Game::Direction - Direction, with the ability to turn and move in the direction.
SYNOPSIS
Nah...
PROPERTIES
direction
The direction.
left
right
up
down
Die on invalid input.
METHODS
new([$direction = "left"])
Create new Direction.
Die on invalid input
oMove($oLocation)
Return new Game::Location object with the new location after a move of one step from $oLocation in the current direction.
Return 1 on success, else 0.
turn($direction)
Turn in the $direction
left
right
Set new direction().
Return new direction. Die on invalid input.
turnDifference($oDirection)
Figure out the difference between the direction of $self and $oDirection, expressed as a turn ("left"/"right").
"How should $self turn in order to for $self to be the same as $oDirection?"
Only a single turning motion is allowed, not a 180o turn.
Return the turn ("left"/"right"), else "" if no turn is good.