Class: Gobstones::Lang::Norte

Inherits:
Direction show all
Defined in:
lib/gobstones/lang/literals/direction.rb

Constant Summary

Constants inherited from Literal

Literal::OPERATORS_MAPPING

Instance Method Summary collapse

Methods inherited from Direction

#<, all, order, #return_type

Methods inherited from Literal

#<, #<=>, #==, #evaluate, #if_false, #if_true, #not, #return_type, #same_type_as, #true?

Methods inherited from Expression

#evaluate, #is_function_call?

Methods included from EqualityDefinition

#==, #equality_attributes

Instance Method Details

#can_move?(head) ⇒ Boolean

Returns:



24
25
26
# File 'lib/gobstones/lang/literals/direction.rb', line 24

def can_move?(head)
  head.can_move_north?
end

#move(head) ⇒ Object



28
29
30
# File 'lib/gobstones/lang/literals/direction.rb', line 28

def move(head)
  head.move_north
end

#nextObject



40
41
42
# File 'lib/gobstones/lang/literals/direction.rb', line 40

def next
  Este.new
end

#oppositeObject



32
33
34
# File 'lib/gobstones/lang/literals/direction.rb', line 32

def opposite
  Sur.new
end

#previousObject



36
37
38
# File 'lib/gobstones/lang/literals/direction.rb', line 36

def previous
  Oeste.new
end

#to_sObject



44
45
46
# File 'lib/gobstones/lang/literals/direction.rb', line 44

def to_s
  'Norte'
end