Sha256: 58d49ff475dbf9f3f7c4e84493edbb742675b2c8910b964e862123599b04ca82
Contents?: true
Size: 651 Bytes
Versions: 1
Compression:
Stored size: 651 Bytes
Contents
class SimonGame < Adhearsion::CallController def run reset loop do say_number collect_attempt verify_attempt end end def random_number rand(10).to_s end def update_number @number << random_number end def say_number update_number speak @number end def collect_attempt @attempt = input @number.length end def verify_attempt if attempt_correct? speak 'good' else speak "#{@number.length - 1} times wrong, try again smarty" reset end end def attempt_correct? @attempt == @number end def reset @attempt, @number = '', '' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-2.0.0.alpha1 | lib/adhearsion/generators/app/templates/lib/simon_game.rb |