Class: Gobstones::Lang::Sur

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:



76
77
78
# File 'lib/gobstones/lang/literals/direction.rb', line 76

def can_move?(head)
  head.can_move_south?
end

#move(head) ⇒ Object



80
81
82
# File 'lib/gobstones/lang/literals/direction.rb', line 80

def move(head)
  head.move_south
end

#nextObject



92
93
94
# File 'lib/gobstones/lang/literals/direction.rb', line 92

def next
  Oeste.new
end

#oppositeObject



84
85
86
# File 'lib/gobstones/lang/literals/direction.rb', line 84

def opposite
  Norte.new
end

#previousObject



88
89
90
# File 'lib/gobstones/lang/literals/direction.rb', line 88

def previous
  Este.new
end

#to_sObject



96
97
98
# File 'lib/gobstones/lang/literals/direction.rb', line 96

def to_s
  'Sur'
end