Class: ShortAnswerGame

Inherits:
Object
  • Object
show all
Defined in:
lib/learn-japanese/game/short-answer-game.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(level = 1) ⇒ ShortAnswerGame

Returns a new instance of ShortAnswerGame.



8
9
10
11
12
13
14
15
16
# File 'lib/learn-japanese/game/short-answer-game.rb', line 8

def initialize(level=1)
  @level = level
  @score = 1
  @max_score = 10

  @silabario = Hiragana.group1
  @silabario.merge! Hiragana.group2 if @level > 1
  @keys = @silabario.keys
end

Class Method Details

.show_help(level = 1) ⇒ Object



18
19
20
# File 'lib/learn-japanese/game/short-answer-game.rb', line 18

def self.show_help(level=1)
  Hiragana.show_help(level)
end

Instance Method Details

#runObject



22
23
24
25
26
27
28
# File 'lib/learn-japanese/game/short-answer-game.rb', line 22

def run
  Debug.puts_line
  while @score < @max_score
    @keys.shuffle!
    @keys.each { |key| guess_japanise_symbol(key) }
  end
end