Class: Path

Inherits:
Object
  • Object
show all
Defined in:
lib/delve/path/path.rb

Direct Known Subclasses

AStar

Constant Summary collapse

@@default_options =
{ topology: :eight }

Instance Method Summary collapse

Constructor Details

#initialize(to_x, to_y, free_checker, options = Hash.new) ⇒ Path

Returns a new instance of Path.


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/delve/path/path.rb', line 5

def initialize(to_x, to_y, free_checker, options = Hash.new)
  raise 'Cannot initialize path if to_x is nil' if to_x.nil?
  raise 'Cannot initialize path if to_y is nil' if to_y.nil?
  raise 'Cannot initialize path if free checker is nil' if free_checker.nil?
  raise 'Cannot initialize path if free checker does not respond to #free?' unless free_checker.respond_to? :free?

  @to_x = to_x
  @to_y = to_y
  @from_x = nil
  @from_y = nil
  @free_checker = free_checker
  @options = @@default_options.merge options

  @dirs = directions(options[:topology])
end

Instance Method Details

#compute(from_x, from_y) ⇒ Object


21
22
# File 'lib/delve/path/path.rb', line 21

def compute(from_x, from_y)
end