Sha256: 7a545db0d26e8971630364648f4a6c032246a9e640c3e315d5cb907a3d9c3e77
Contents?: true
Size: 772 Bytes
Versions: 1
Compression:
Stored size: 772 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) printf Rainbow('Correct').green else 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 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.1.0 | lib/hemlock/turn.rb |