Class: DFS
- Inherits:
-
Object
- Object
- DFS
- Defined in:
- lib/rsearch/dfs.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ DFS
constructor
A new instance of DFS.
- #method_missing(meth, *args, &block) ⇒ Object
Constructor Details
#initialize(options) ⇒ DFS
Returns a new instance of DFS.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rsearch/dfs.rb', line 5 def initialize() stack = [] marked = Set.new marked << [:start] scheduler = Proc.new do |states| states.reverse.each do |state| stack << state if !marked.include?(state) marked << state end stack.pop end @search = Search.new(start: [:start], generator: [:generator], scheduler: scheduler) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
24 25 26 |
# File 'lib/rsearch/dfs.rb', line 24 def method_missing(meth, *args, &block) @search.send(meth, *args, &block) end |