class BFS

Public Class Methods

new(options) click to toggle source
# File lib/rsearch/bfs.rb, line 5
def initialize(options)
  queue = []
  marked = Set.new
  marked << options[:start]
  scheduler = Proc.new do |states|
    states.each do |state|
      if !marked.include?(state)
        queue << state
        marked << state
      end
    end
    queue.shift
  end

  @search = Search.new(start: options[:start],
                       generator: options[:generator],
                       scheduler: scheduler)
end

Public Instance Methods

method_missing(meth, *args, &block) click to toggle source
# File lib/rsearch/bfs.rb, line 24
def method_missing(meth, *args, &block)
  @search.send(meth, *args, &block)
end