class Pitchcar::Pieces::Right
Constants
- IMAGE
Public Instance Methods
image()
click to toggle source
# File lib/pieces/right.rb, line 30 def image if north? IMAGE.rotate(90) elsif east? IMAGE.rotate(180) elsif west? IMAGE elsif south? IMAGE.rotate(270) end end
next_coordinate()
click to toggle source
# File lib/pieces/right.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/right.rb, line 6 def next_direction if north? DIRECTIONS[:EAST] elsif east? DIRECTIONS[:SOUTH] elsif west? DIRECTIONS[:NORTH] elsif south? DIRECTIONS[:WEST] end end
to_s()
click to toggle source
# File lib/pieces/right.rb, line 42 def to_s 'R' end