Sha256: 4b5c5d84a3bccc0aff759daa2fae9d8cdd1484c4af2795d577531f26404c6089
Contents?: true
Size: 769 Bytes
Versions: 1
Compression:
Stored size: 769 Bytes
Contents
require 'readline' module Hemlock class Turn def initialize(flashcard) @flashcard = flashcard end def take_turn puts @flashcard.question guess = Readline.readline('>> ', false) if @flashcard.correct?(guess) puts printf Rainbow('Correct').green else puts printf Rainbow('You must submit to the quarries').red punishment end end private def punishment i = 1 while i < 3 do puts @flashcard.question puts @flashcard.answer guess = Readline.readline('>> ', true) if @flashcard.correct?(guess) i += 1 else puts printf Rainbow('Who are you? Sisyphus?!').red redo end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hemlock-0.0.9 | lib/hemlock/turn.rb |