cw 0.0.12 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.codeclimate.yml +15 -0
- data/.travis.yml +6 -0
- data/README.md +60 -9
- data/cw.gemspec +1 -1
- data/daily.rb +2 -2
- data/example.rb +0 -2
- data/lib/cw/audio_player.rb +3 -1
- data/lib/cw/book.rb +22 -14
- data/lib/cw/book_details.rb +3 -3
- data/lib/cw/cw_encoding.rb +67 -51
- data/lib/cw/print.rb +24 -19
- data/lib/cw/repeat_word.rb +1 -6
- data/lib/cw/rss.rb +1 -1
- data/lib/cw/stream.rb +29 -17
- data/lib/cw/test_letters.rb +1 -15
- data/lib/cw/test_words.rb +1 -14
- data/lib/cw/tester.rb +16 -0
- data/lib/cw/tone_generator.rb +4 -4
- metadata +3 -52
- data/data/text/tom_sawyer.txt +0 -6477
- data/lib/cw/monitor.rb +0 -36
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 72ccadeafd51d75edae90d0f494a0ccfe735ab1a
         | 
| 4 | 
            +
              data.tar.gz: 1a975942e7a54e6db6745b2d5b5cd5a3fae176a1
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 025e1005cadcac8a29d9f31b2c50498c757749982ee32d78045dd1a71ada9b3a005b403076c49c91f2a87fd15734d87c9d4b848a871cb4d2ca2d4cfc1a1177a5
         | 
| 7 | 
            +
              data.tar.gz: 6aadbbecd1d18c43a864e29c12a066491bba27443ef411db412a2a92afe30ce9fefa55f3fa6279f8e76df461599c0bfb422a072bfee717cb5d3b2c14a41e9902
         | 
    
        data/.codeclimate.yml
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -1,14 +1,19 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            [](https://badge.fury.io/rb/cw)
         | 
| 2 | 
            +
            [](https://travis-ci.org/mjago/CW)
         | 
| 3 | 
            +
            [](https://codeclimate.com/github/mjago/CW)
         | 
| 2 4 |  | 
| 3 | 
            -
            CW | 
| 4 | 
            -
            real-time learning and testing of Morse Code.
         | 
| 5 | 
            +
            ## CW
         | 
| 5 6 |  | 
| 6 | 
            -
            CW  | 
| 7 | 
            -
             | 
| 8 | 
            -
            (i.e. words_beginning_with 'v')
         | 
| 7 | 
            +
            CW is a DSL written in the [Ruby](https://www.ruby-lang.org/en/downloads/) language for generating audible morse - allowing for
         | 
| 8 | 
            +
            real-time learning and testing of Morse Code. Great emphasis is placed on enabling tests to use fresh material each test run, rather than the constant repetition of old material.
         | 
| 9 9 |  | 
| 10 | 
            -
            CW  | 
| 11 | 
            -
             | 
| 10 | 
            +
            CW can read books (and remember where you are), rss feeds (your daily quotation for instance), common phrases, QSO codes etc, in
         | 
| 11 | 
            +
            addition to generating random words, letters, and numbers that possibly match some required pattern
         | 
| 12 | 
            +
            (i.e. words_beginning_with 'v').
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            CW also allows for real-time progress marking by indicating correct and incorrect characters and words copied in real-time. A follow mode also exists which prints the output just after it has played it (for `in head' practice).
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            Documentation to follow...
         | 
| 12 17 |  | 
| 13 18 | 
             
            # Installation:
         | 
| 14 19 |  | 
| @@ -27,7 +32,7 @@ ruby test/test_cw.rb | |
| 27 32 |  | 
| 28 33 | 
             
            ```
         | 
| 29 34 |  | 
| 30 | 
            -
              | 
| 35 | 
            +
             * Note: Currently only tested on OS X, and Ruby v2.0.0 and greater.
         | 
| 31 36 |  | 
| 32 37 | 
             
            ```ruby
         | 
| 33 38 |  | 
| @@ -70,6 +75,52 @@ ruby test/test_cw.rb | |
| 70 75 | 
             
                shuffle
         | 
| 71 76 | 
             
              end
         | 
| 72 77 |  | 
| 78 | 
            +
             | 
| 79 | 
            +
            # ...or instantiate CW...
         | 
| 80 | 
            +
             | 
| 81 | 
            +
            wpm = 16
         | 
| 82 | 
            +
             | 
| 83 | 
            +
            test = CW.new
         | 
| 84 | 
            +
            test.comment 'test words beginning with b (repeat word)'
         | 
| 85 | 
            +
            test.shuffle
         | 
| 86 | 
            +
            test.wpm             wpm
         | 
| 87 | 
            +
            test.beginning_with  'b'
         | 
| 88 | 
            +
            test.word_size        4
         | 
| 89 | 
            +
            test.word_count       2
         | 
| 90 | 
            +
            puts test.to_s
         | 
| 91 | 
            +
            test.repeat_word
         | 
| 92 | 
            +
             | 
| 93 | 
            +
            test = CW.new
         | 
| 94 | 
            +
            test.comment 'test words beginning with b (test letters)'
         | 
| 95 | 
            +
            test.shuffle
         | 
| 96 | 
            +
            test.wpm             wpm
         | 
| 97 | 
            +
            test.beginning_with  'b'
         | 
| 98 | 
            +
            test.word_size        4
         | 
| 99 | 
            +
            test.word_count       2
         | 
| 100 | 
            +
            puts test.to_s
         | 
| 101 | 
            +
            test.test_letters
         | 
| 102 | 
            +
             | 
| 103 | 
            +
            test = CW.new
         | 
| 104 | 
            +
            test.comment 'test words beginning with b (test words)'
         | 
| 105 | 
            +
            test.shuffle
         | 
| 106 | 
            +
            test.wpm             wpm
         | 
| 107 | 
            +
            test.beginning_with  'b'
         | 
| 108 | 
            +
            test.word_size        4
         | 
| 109 | 
            +
            test.word_count       2
         | 
| 110 | 
            +
            puts test.to_s
         | 
| 111 | 
            +
            test.test_words
         | 
| 112 | 
            +
             | 
| 113 | 
            +
            test = CW.new
         | 
| 114 | 
            +
            test.comment 'test words beginning with b (print letters)'
         | 
| 115 | 
            +
            test.shuffle
         | 
| 116 | 
            +
            test.wpm             wpm
         | 
| 117 | 
            +
            test.beginning_with  'b'
         | 
| 118 | 
            +
            test.word_size        4
         | 
| 119 | 
            +
            test.word_count       2
         | 
| 120 | 
            +
            puts test.to_s
         | 
| 121 | 
            +
            test.print_letters
         | 
| 122 | 
            +
            test.test_letters
         | 
| 123 | 
            +
             | 
| 73 124 | 
             
            ```
         | 
| 74 125 |  | 
| 75 126 | 
             
            # Options:
         | 
    
        data/cw.gemspec
    CHANGED
    
    | @@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | |
| 4 4 |  | 
| 5 5 | 
             
            Gem::Specification.new do |spec|
         | 
| 6 6 | 
             
              spec.name        = 'cw'
         | 
| 7 | 
            -
              spec.version     = '0.0 | 
| 7 | 
            +
              spec.version     = '0.1.0'
         | 
| 8 8 | 
             
              spec.date        = '2016-05-21'
         | 
| 9 9 | 
             
              spec.authors     = ["Martyn Jago"]
         | 
| 10 10 | 
             
              spec.email       = ["martyn.jago@btinternet.com"]
         | 
    
        data/daily.rb
    CHANGED
    
    | @@ -16,7 +16,7 @@ end | |
| 16 16 |  | 
| 17 17 | 
             
            CW.new do
         | 
| 18 18 | 
             
              shuffle
         | 
| 19 | 
            -
              wpm | 
| 19 | 
            +
              wpm speed
         | 
| 20 20 | 
             
              word_count 15
         | 
| 21 21 | 
             
              test_letters
         | 
| 22 22 | 
             
            end
         | 
| @@ -90,7 +90,7 @@ speed -= 10 | |
| 90 90 |  | 
| 91 91 | 
             
            CW.new do
         | 
| 92 92 | 
             
              load_words 'data/text/cw_conversation.txt'
         | 
| 93 | 
            -
              wpm | 
| 93 | 
            +
              wpm speed
         | 
| 94 94 | 
             
              print_letters
         | 
| 95 95 | 
             
            end
         | 
| 96 96 |  | 
    
        data/example.rb
    CHANGED
    
    | @@ -87,7 +87,6 @@ loop do | |
| 87 87 | 
             
              test.word_count      4
         | 
| 88 88 | 
             
              puts test.to_s
         | 
| 89 89 | 
             
              test.test_words
         | 
| 90 | 
            -
              test = nil
         | 
| 91 90 |  | 
| 92 91 | 
             
              test = CW.new
         | 
| 93 92 | 
             
              test.comment 'test words including ing'
         | 
| @@ -98,7 +97,6 @@ loop do | |
| 98 97 | 
             
              test.including       'ing'
         | 
| 99 98 | 
             
              test.word_count      5
         | 
| 100 99 | 
             
              test.test_words
         | 
| 101 | 
            -
              test = nil
         | 
| 102 100 |  | 
| 103 101 | 
             
              #  test = CW.new
         | 
| 104 102 | 
             
              #  test.comment         'test ing'
         | 
    
        data/lib/cw/audio_player.rb
    CHANGED
    
    | @@ -15,7 +15,7 @@ class AudioPlayer | |
| 15 15 | 
             
              end
         | 
| 16 16 |  | 
| 17 17 | 
             
              def convert_words_with_ebook2cw words
         | 
| 18 | 
            -
                words = words. | 
| 18 | 
            +
                words = words.delete("\n")
         | 
| 19 19 | 
             
                cl = Cl.new.cl_echo(words)
         | 
| 20 20 | 
             
                ! @dry_run ? `#{cl}` : cl
         | 
| 21 21 | 
             
              end
         | 
| @@ -40,6 +40,8 @@ class AudioPlayer | |
| 40 40 | 
             
                  Process.kill(:TERM, @pid)
         | 
| 41 41 | 
             
                  Process.wait(@pid)
         | 
| 42 42 | 
             
                rescue
         | 
| 43 | 
            +
                  puts 'Error: Failed to kill pid ' + @pid
         | 
| 44 | 
            +
                  exit 1
         | 
| 43 45 | 
             
                end
         | 
| 44 46 | 
             
              end
         | 
| 45 47 |  | 
    
        data/lib/cw/book.rb
    CHANGED
    
    | @@ -151,24 +151,32 @@ class Book < FileDetails | |
| 151 151 | 
             
                end
         | 
| 152 152 | 
             
              end
         | 
| 153 153 |  | 
| 154 | 
            -
              def  | 
| 155 | 
            -
                 | 
| 154 | 
            +
              def process_letters letr
         | 
| 155 | 
            +
                loop do
         | 
| 156 | 
            +
                  process_space_maybe(letr) unless @book_details.args[:output] == :letter
         | 
| 157 | 
            +
                  process_word_maybe
         | 
| 158 | 
            +
                  if change_repeat_or_quit?
         | 
| 159 | 
            +
                    break
         | 
| 160 | 
            +
                  end
         | 
| 161 | 
            +
                  break if timing.char_delay_timeout?
         | 
| 162 | 
            +
                end
         | 
| 163 | 
            +
              end
         | 
| 164 | 
            +
             | 
| 165 | 
            +
              def process_words words
         | 
| 156 166 | 
             
                (words + space).each_char do |letr|
         | 
| 157 167 | 
             
                  process_letter letr
         | 
| 158 168 | 
             
                  stream.add_char(letr) if @book_details.args[:output] == :letter
         | 
| 159 | 
            -
                   | 
| 160 | 
            -
                    process_space_maybe(letr) unless @book_details.args[:output] == :letter
         | 
| 161 | 
            -
                    process_word_maybe
         | 
| 162 | 
            -
                    if change_repeat_or_quit?
         | 
| 163 | 
            -
                      break
         | 
| 164 | 
            -
                    end
         | 
| 165 | 
            -
                    break if timing.char_delay_timeout?
         | 
| 166 | 
            -
                  end
         | 
| 169 | 
            +
                  process_letters letr
         | 
| 167 170 | 
             
                  print.prn letr if print_letters?
         | 
| 168 171 | 
             
                  break if change_repeat_or_quit?
         | 
| 169 172 | 
             
                end
         | 
| 170 173 | 
             
              end
         | 
| 171 174 |  | 
| 175 | 
            +
              def print_words words
         | 
| 176 | 
            +
                timing.init_char_timer
         | 
| 177 | 
            +
                process_words words
         | 
| 178 | 
            +
              end
         | 
| 179 | 
            +
             | 
| 172 180 | 
             
              def print_words_for_current_sentence
         | 
| 173 181 | 
             
            #    puts current_sentence
         | 
| 174 182 | 
             
                print_words current_sentence
         | 
| @@ -185,7 +193,7 @@ class Book < FileDetails | |
| 185 193 | 
             
              def play_sentences_until_quit
         | 
| 186 194 | 
             
                get_book_progress
         | 
| 187 195 | 
             
                loop do
         | 
| 188 | 
            -
                  check_sentence_count | 
| 196 | 
            +
                  check_sentence_count
         | 
| 189 197 | 
             
                  sync_with_print
         | 
| 190 198 | 
             
                  audio_play_repeat_tone_maybe
         | 
| 191 199 | 
             
                  reset_sentence_flags
         | 
| @@ -196,8 +204,8 @@ class Book < FileDetails | |
| 196 204 | 
             
                print_words_exit unless @print_letters
         | 
| 197 205 | 
             
              end
         | 
| 198 206 |  | 
| 199 | 
            -
              def check_sentence_count | 
| 200 | 
            -
                if @book_details.session_finished? | 
| 207 | 
            +
              def check_sentence_count
         | 
| 208 | 
            +
                if @book_details.session_finished?
         | 
| 201 209 | 
             
                  audio_stop
         | 
| 202 210 | 
             
                  quit
         | 
| 203 211 | 
             
                  reset_stdin
         | 
| @@ -207,7 +215,7 @@ class Book < FileDetails | |
| 207 215 |  | 
| 208 216 | 
             
              def print_sentences_until_quit
         | 
| 209 217 | 
             
                loop do
         | 
| 210 | 
            -
                  check_sentence_count | 
| 218 | 
            +
                  check_sentence_count
         | 
| 211 219 | 
             
                  sync_with_play
         | 
| 212 220 | 
             
                  break if quit?
         | 
| 213 221 | 
             
                  sync_with_audio_player
         | 
    
        data/lib/cw/book_details.rb
    CHANGED
    
    | @@ -25,11 +25,11 @@ class BookDetails | |
| 25 25 | 
             
                end
         | 
| 26 26 | 
             
              end
         | 
| 27 27 |  | 
| 28 | 
            -
              def session_finished? | 
| 29 | 
            -
                sentences_complete? | 
| 28 | 
            +
              def session_finished?
         | 
| 29 | 
            +
                sentences_complete? || book_timeout?
         | 
| 30 30 | 
             
              end
         | 
| 31 31 |  | 
| 32 | 
            -
              def sentences_complete? | 
| 32 | 
            +
              def sentences_complete?
         | 
| 33 33 | 
             
                if @args.has_key?(:sentences) &&  @args[:sentences].is_a?(Fixnum)
         | 
| 34 34 | 
             
                  if @sentence_count_source
         | 
| 35 35 | 
             
                    @sentence_count_source = nil
         | 
    
        data/lib/cw/cw_encoding.rb
    CHANGED
    
    | @@ -1,56 +1,72 @@ | |
| 1 | 
            -
            # encoding: utf-8
         | 
| 1 | 
            +
              # encoding: utf-8
         | 
| 2 2 |  | 
| 3 | 
            -
            class CwEncoding
         | 
| 3 | 
            +
              class CwEncoding
         | 
| 4 4 |  | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 5 | 
            +
                def fetch char
         | 
| 6 | 
            +
                  encode(char)
         | 
| 7 | 
            +
                end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                def encode char
         | 
| 10 | 
            +
                  e = encode_a_n().merge!(encode_0_2);
         | 
| 11 | 
            +
                  (e.merge(encode_3_space))[char]
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                def encode_a_n
         | 
| 15 | 
            +
                  {
         | 
| 16 | 
            +
                    'a' => [:dot, :dash],
         | 
| 17 | 
            +
                    'b' => [:dash, :dot, :dot, :dot],
         | 
| 18 | 
            +
                    'c' => [:dash, :dot, :dash, :dot],
         | 
| 19 | 
            +
                    'd' => [:dash, :dot, :dot],
         | 
| 20 | 
            +
                    'e' => [:dot],
         | 
| 21 | 
            +
                    'f' => [:dot, :dot, :dash, :dot],
         | 
| 22 | 
            +
                    'g' => [:dash, :dash, :dot],
         | 
| 23 | 
            +
                    'h' => [:dot, :dot, :dot, :dot],
         | 
| 24 | 
            +
                    'i' => [:dot, :dot],
         | 
| 25 | 
            +
                    'j' => [:dot, :dash, :dash, :dash],
         | 
| 26 | 
            +
                    'k' => [:dash, :dot, :dash],
         | 
| 27 | 
            +
                    'l' => [:dot, :dash, :dot, :dot],
         | 
| 28 | 
            +
                    'm' => [:dash, :dash],
         | 
| 29 | 
            +
                    'n' => [:dash, :dot]
         | 
| 30 | 
            +
                  }
         | 
| 31 | 
            +
                end
         | 
| 8 32 |  | 
| 9 | 
            -
             | 
| 33 | 
            +
                def encode_0_2
         | 
| 10 34 | 
             
                  {
         | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
                   | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
                   | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
                   | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
                  ',' => [:dash, :dash, :dot, :dot, :dash, :dash],
         | 
| 49 | 
            -
                  '=' => [:dash, :dot, :dot,:dot, :dash],
         | 
| 50 | 
            -
                  '!' => [:dot, :dot, :dash, :dash, :dot],
         | 
| 51 | 
            -
                  '/' => [:dash, :dot, :dot, :dash, :dot],
         | 
| 52 | 
            -
                  '?' => [:dot, :dot, :dash, :dash, :dot, :dot],
         | 
| 53 | 
            -
                  ' ' => []
         | 
| 54 | 
            -
                }
         | 
| 35 | 
            +
                    'o' => [:dash, :dash, :dash],
         | 
| 36 | 
            +
                    'p' => [:dot, :dash, :dash, :dot],
         | 
| 37 | 
            +
                    'q' => [:dash, :dash, :dot, :dash],
         | 
| 38 | 
            +
                    'r' => [:dot, :dash, :dot],
         | 
| 39 | 
            +
                    's' => [:dot, :dot, :dot],
         | 
| 40 | 
            +
                    't' => [:dash],
         | 
| 41 | 
            +
                    'u' => [:dot, :dot, :dash],
         | 
| 42 | 
            +
                    'v' => [:dot, :dot, :dot, :dash],
         | 
| 43 | 
            +
                    'w' => [:dot, :dash, :dash],
         | 
| 44 | 
            +
                    'x' => [:dash, :dot, :dot, :dash],
         | 
| 45 | 
            +
                    'y' => [:dash, :dot, :dash, :dash],
         | 
| 46 | 
            +
                    'z' => [:dash, :dash, :dot, :dot],
         | 
| 47 | 
            +
                    '1' => [:dot, :dash, :dash, :dash, :dash],
         | 
| 48 | 
            +
                    '2' => [:dot, :dot, :dash, :dash, :dash]
         | 
| 49 | 
            +
                  }
         | 
| 50 | 
            +
                end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                def encode_3_space
         | 
| 53 | 
            +
                  {
         | 
| 54 | 
            +
                    '3' => [:dot, :dot, :dot, :dash, :dash],
         | 
| 55 | 
            +
                    '4' => [:dot, :dot, :dot, :dot, :dash],
         | 
| 56 | 
            +
                    '5' => [:dot, :dot, :dot, :dot, :dot],
         | 
| 57 | 
            +
                    '6' => [:dash, :dot, :dot, :dot, :dot],
         | 
| 58 | 
            +
                    '7' => [:dash, :dash, :dot, :dot, :dot],
         | 
| 59 | 
            +
                    '8' => [:dash, :dash, :dash, :dot, :dot],
         | 
| 60 | 
            +
                    '9' => [:dash, :dash, :dash, :dash, :dot],
         | 
| 61 | 
            +
                    '0' => [:dash, :dash, :dash, :dash, :dash],
         | 
| 62 | 
            +
                    '.' => [:dot, :dash, :dot, :dash, :dot, :dash],
         | 
| 63 | 
            +
                    ',' => [:dash, :dash, :dot, :dot, :dash, :dash],
         | 
| 64 | 
            +
                    '=' => [:dash, :dot, :dot,:dot, :dash],
         | 
| 65 | 
            +
                    '!' => [:dot, :dot, :dash, :dash, :dot],
         | 
| 66 | 
            +
                    '/' => [:dash, :dot, :dot, :dash, :dot],
         | 
| 67 | 
            +
                    '?' => [:dot, :dot, :dash, :dash, :dot, :dot],
         | 
| 68 | 
            +
                    ' ' => []
         | 
| 69 | 
            +
                  }
         | 
| 70 | 
            +
                end
         | 
| 71 | 
            +
             | 
| 55 72 | 
             
              end
         | 
| 56 | 
            -
            end
         | 
    
        data/lib/cw/print.rb
    CHANGED
    
    | @@ -81,57 +81,62 @@ class Print | |
| 81 81 | 
             
                end
         | 
| 82 82 | 
             
              end
         | 
| 83 83 |  | 
| 84 | 
            -
              def  | 
| 85 | 
            -
                 | 
| 86 | 
            -
             | 
| 87 | 
            -
                  success = popped[:success]
         | 
| 84 | 
            +
              def paint(value, colour)
         | 
| 85 | 
            +
                Paint[value, colour]
         | 
| 86 | 
            +
              end
         | 
| 88 87 |  | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 88 | 
            +
              def paint_success_failure(popped)
         | 
| 89 | 
            +
                print paint(popped[:value], :blue) if popped[:success]
         | 
| 90 | 
            +
                print paint(popped[:value], :red ) unless popped[:success]
         | 
| 91 | 
            +
              end
         | 
| 92 | 
            +
             | 
| 93 | 
            +
              def char_result popped
         | 
| 94 | 
            +
                unless newline_maybe popped[:value]
         | 
| 95 | 
            +
                  popped[:value] = '_' if((popped[:value] == ' ') && (popped[:success] != true))
         | 
| 96 | 
            +
                  paint_success_failure(popped)
         | 
| 97 | 
            +
                  return true
         | 
| 96 98 | 
             
                end
         | 
| 97 99 | 
             
              end
         | 
| 98 100 |  | 
| 99 101 | 
             
              def heading
         | 
| 100 | 
            -
                 | 
| 102 | 
            +
                "Current Sentence is     duration:    secs".length.times do
         | 
| 103 | 
            +
                  print '*'
         | 
| 104 | 
            +
                  puts
         | 
| 105 | 
            +
                end
         | 
| 101 106 | 
             
              end
         | 
| 102 107 |  | 
| 103 108 | 
             
              def print_blue(word)
         | 
| 104 | 
            -
                print  | 
| 109 | 
            +
                print paint(word, :blue)
         | 
| 105 110 | 
             
                cursor_pos = word.size
         | 
| 106 111 | 
             
                (12 - cursor_pos).times{print ' '}
         | 
| 107 112 | 
             
              end
         | 
| 108 113 |  | 
| 109 114 | 
             
              def print_green(word)
         | 
| 110 115 | 
             
                print_blue(word)
         | 
| 111 | 
            -
                print  | 
| 116 | 
            +
                print paint("#{word} \r\n", :green)
         | 
| 112 117 | 
             
              end
         | 
| 113 118 |  | 
| 114 119 | 
             
              def print_red word
         | 
| 115 | 
            -
                print  | 
| 120 | 
            +
                print paint("#{word }\r\n", :red)
         | 
| 116 121 | 
             
              end
         | 
| 117 122 |  | 
| 118 123 | 
             
              def prn_red word
         | 
| 119 | 
            -
                print  | 
| 124 | 
            +
                print paint("#{word}", :red)
         | 
| 120 125 | 
             
              end
         | 
| 121 126 |  | 
| 122 127 | 
             
              def print_fail(word, attempt)
         | 
| 123 128 | 
             
                print_blue(word)
         | 
| 124 | 
            -
                print  | 
| 129 | 
            +
                print paint("#{attempt }\r\n", :red)
         | 
| 125 130 | 
             
              end
         | 
| 126 131 |  | 
| 127 132 | 
             
              def prn(word)
         | 
| 128 133 | 
             
                newline_maybe word
         | 
| 129 134 | 
             
                return if(@print_count == 0 && word == ' ')
         | 
| 130 | 
            -
                print  | 
| 135 | 
            +
                print paint("#{word}", :blue)
         | 
| 131 136 | 
             
              end
         | 
| 132 137 |  | 
| 133 138 | 
             
              def print_advice name
         | 
| 134 | 
            -
                puts "#{name | 
| 139 | 
            +
                puts "#{name}: Press Q 4 times to Exit"
         | 
| 135 140 | 
             
              end
         | 
| 136 141 |  | 
| 137 142 | 
             
            end
         |