Class: Waylon::Skills::Wordle

Inherits:
Waylon::Skill
  • Object
show all
Defined in:
lib/waylon/skills/wordle.rb

Overview

A Waylon Skill for solving Wordle

Instance Method Summary collapse

Instance Method Details

#spoil_wordleObject



45
46
47
48
49
50
51
52
# File 'lib/waylon/skills/wordle.rb', line 45

def spoil_wordle
  threaded_reply("Here's what my attempt looked like...")
  threaded_reply(
    codify(
      JSON.pretty_generate(solve_todays_wordle.attempts.map { |w| w[:word].upcase })
    )
  )
end

#todays_wordleObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/waylon/skills/wordle.rb', line 25

def todays_wordle
  solution = solve_todays_wordle
  case solution.attempts.size
  when 1..2
    reply("I got *really* lucky today!")
  when 3
    reply("I did pretty well.")
  when 4..5
    reply("I managed to figure it out.")
  when 6
    if solution.last_attempted_word == Waylon::Wordle.for_today
      reply("I barely solved it!")
    else
      reply("Unfortunately, I didn't solve it.")
    end
  end

  reply(formatted_wordle_score(solution.attempts.map { _1[:result] }))
end