Class: WordlSolver

Inherits:
Object
  • Object
show all
Defined in:
lib/wordl-solver.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWordlSolver

Returns a new instance of WordlSolver.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/wordl-solver.rb', line 15

def initialize
  @yellows = {
    0 => [],
    1 => [],
    2 => [],
    3 => [],
    4 => []
  }
  @greys = []
  @greens = {
    0 => nil,
    1 => nil,
    2 => nil,
    3 => nil,
    4 => nil
  }
end

Class Method Details

.runObject



33
34
35
# File 'lib/wordl-solver.rb', line 33

def self.run
  WordlSolver.new.run
end

Instance Method Details

#runObject



37
38
39
40
41
42
43
44
45
# File 'lib/wordl-solver.rb', line 37

def run
  answer = ""
  while answer != "y"
    ask_for_letters_and_colours
    find_possible_words
    puts "have you found it ? (y/n)"
    answer = gets.chomp
  end
end