Sha256: 1a71b301aefb01bf1c6544e20b3d543f69cfa3aca3c25f69a2308d71c7759235
Contents?: true
Size: 766 Bytes
Versions: 1
Compression:
Stored size: 766 Bytes
Contents
require 'readline' require 'rainbow' 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 Rainbow('Correct').green else puts 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 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.1.4 | lib/hemlock/turn.rb |