Module: Gobgems::Direction

Included in:
Program
Defined in:
lib/gobgems/direction.rb

Class Method Summary collapse

Class Method Details

.allObject



19
20
21
# File 'lib/gobgems/direction.rb', line 19

def all
  [east, west, south, north]
end

.eastObject



3
4
5
# File 'lib/gobgems/direction.rb', line 3

def east
  @east ||= -> (x, y) { [x, y+1] }
end

.northObject



11
12
13
# File 'lib/gobgems/direction.rb', line 11

def north
  @north ||= -> (x, y) { [x-1, y] }
end

.southObject



15
16
17
# File 'lib/gobgems/direction.rb', line 15

def south
  @south ||= -> (x, y) { [x+1, y] }
end

.westObject



7
8
9
# File 'lib/gobgems/direction.rb', line 7

def west
  @west ||= -> (x, y) { [x, y-1] }
end