class Pitchcar::Pieces::Left
Constants
- IMAGE
Public Instance Methods
image()
click to toggle source
# File lib/pieces/left.rb, line 30 def image if north? IMAGE.rotate(180) elsif east? IMAGE.rotate(270) elsif west? IMAGE.rotate(90) elsif south? IMAGE end end
next_coordinate()
click to toggle source
# File lib/pieces/left.rb, line 18 def next_coordinate if north? { x: x - 1, y: y } elsif east? { x: x, y: y + 1 } elsif west? { x: x, y: y - 1 } elsif south? { x: x + 1, y: y } end end
next_direction()
click to toggle source
# File lib/pieces/left.rb, line 6 def next_direction if north? DIRECTIONS[:WEST] elsif east? DIRECTIONS[:NORTH] elsif west? DIRECTIONS[:SOUTH] elsif south? DIRECTIONS[:EAST] end end
to_s()
click to toggle source
# File lib/pieces/left.rb, line 42 def to_s 'L' end