Class: Te4cher::Teacher

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

Constant Summary collapse

@@word_list =
['Ruby', 'Red', 'Awesome', 'Burzum', 
'Help', 'Blood', 'Emergency', 'Death', 
'Morse', 'SOS', 'SQL', 'Wreck', 'Ship', 
'You', 'Us', 'America', 'Boat', 'Hello', 
'Amazed', 'Python', 'Life', 'acme', 
'antiseptically', 'boudoir', 'cesium', 'circumscribing', 
'collegians', 'confessionals', 'erectly', 'finagler', 
'hostelries', 'howdah', 'impetigo', 'lampposts', 'lisle', 
'mestizos', 'overcooked', 'slippage', 'slouchiest', 
'strumpet', 'terabyte', 'transfiguration', 'twill', 
'undersold', 'unsheathed', 'whelps', 'adlumidine', 
'alinasal', 'aramina', 'begreen', 'bembixes', 
'boundly', 'cannibalean', 'chondrinous', 'colickiest', 
'cullas', 'hartake', 'interchangings', 'marquito', 
'miscegenationists', 'peremption', 'quesitive', 'ragnarok', 
'reconciliated', 'sepsine', 'sickless', 'sigillaria', 
'staphyledema', 'undelible', 'unruth', 'yaourti', 
'avoid', 'bottle', 'briefly', 'bug', 
'dedicated', 'establish', 'everything', 'goes', 
'harm', 'inferior', 'killed', 'leader', 
'noticed', 'quicker', 'recovered', 'reflects', 
'retain', 'self', 'should', 'signal', 
'simultaneously', 'stayed', 'tomorrow', 'virtue', 
'weird', 'adlumidine', 'alinasal', 'aramina', 
'begreen', 'bembixes', 'boundly', 'cannibalean', 
'chondrinous', 'colickiest', 'cullas', 'hartake', 
'interchangings', 'marquito', 'miscegenationists', 'peremption', 
'quesitive', 'ragnarok', 'reconciliated', 'sepsine', 
'sickless', 'sigillaria', 'staphyledema', 'undelible', 'unruth', 'yaourti']

Class Method Summary collapse

Class Method Details

.hangmanObject



53
54
55
56
# File 'lib/teacher/teacher.rb', line 53

def self.hangman
  Hangman.choose_word(@@word_list)
  Hangman.main
end

.practiceObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/teacher/teacher.rb', line 36

def self.practice  
  while true
    random_word = @@word_list.sample.upcase!
    correct_answer = Morse.text_to_morse(random_word)
    puts "translate ---> #{random_word}"
    print 'Your answer: '
    user_answer = gets.chomp.strip
    if user_answer == correct_answer
      puts 'Correct! Moving to the next word...'
      sleep(2)
    else
      puts "Wrong! The correct answer was: #{correct_answer} \nmoving to the next word..."
      sleep(2)
     end
  end
end

.show_hashesObject



58
59
60
61
62
# File 'lib/teacher/teacher.rb', line 58

def self.show_hashes
  for char, morse in @@asciitomorse
    print char, ' --> ', morse, '  '
  end; 'Morse Alphabet'
end