Class: Lekanmastermind::Messages

Inherits:
Object
  • Object
show all
Defined in:
lib/lekanmastermind/messages.rb

Instance Method Summary collapse

Instance Method Details

#congratulation(player, trial, time) ⇒ Object



71
72
73
74
75
76
77
78
79
80
# File 'lib/lekanmastermind/messages.rb', line 71

def congratulation(player, trial, time)
  <<-EOS
         *********************************************************
                 Congratulation #{player.name}!!
             You guessed the correct sequence '#{player.guess}'
               in #{trial} trial(s) over #{time / 3600}hrs
                    #{time / 60} min #{time % 60} secs.
        *********************************************************
  EOS
end

#error_inputObject



33
34
35
36
37
38
39
# File 'lib/lekanmastermind/messages.rb', line 33

def error_input
  <<-EOS
    ************************************************************************
    * You've entered an invalid letter. Read the instruction and try again *
    ************************************************************************
  EOS
end

#go_to_menuObject



67
68
69
# File 'lib/lekanmastermind/messages.rb', line 67

def go_to_menu
  "Enter menu to back to the menu"
end

#goodbyeObject



111
112
113
# File 'lib/lekanmastermind/messages.rb', line 111

def goodbye
  'Thanks for playing Master Mind. See you soon'
end

#guess_process_message(guess, exact, partial, chances) ⇒ Object



94
95
96
97
98
99
100
101
# File 'lib/lekanmastermind/messages.rb', line 94

def guess_process_message(guess, exact, partial, chances)
  <<-EOS
       *****************************************************************
        '#{guess.upcase}' has #{exact} exacts and #{partial} partials
              #{12 - chances} chances left
       *****************************************************************
  EOS
end

#instructionsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/lekanmastermind/messages.rb', line 17

def instructions
  <<-EOS
           **************************************************
           *      This is MASTERMIND game v0.1.0            *
           *            By Olalekan Eyiowuawi               *
           *      Enjoy and expect the next version         *
           *      Press q at anytime to quit the game.      *
           *      Enter your level and number of players    *
           *      beginner, intermediate, advanced          *
           *   To view guess history, enter h at any time   *
           *         when the game starts                   *
           *      Press Menu to go back to the menu.        *
           **************************************************
  EOS
end

#level_welcome(level, comp_handler) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'lib/lekanmastermind/messages.rb', line 56

def level_welcome(level, comp_handler)
  <<-EOS
      *********************************************************************
          You are playing the #{level} level. You can choose
        #{comp_handler.number_of_character} colors from the following colors
          #{comp_handler.level_colors} To enter a sequence,
               Enter just the first letters of your color sequence
      ***********************************************************************
  EOS
end

#number_of_playersObject



52
53
54
# File 'lib/lekanmastermind/messages.rb', line 52

def number_of_players
  'Enter the number of players'
end

#out_of_chanceObject



107
108
109
# File 'lib/lekanmastermind/messages.rb', line 107

def out_of_chance
  "GAME OVER!! You're out of Trials!"
end

#replay_optionObject



90
91
92
# File 'lib/lekanmastermind/messages.rb', line 90

def replay_option
  'Do you want to play again? Press Y or N'
end

#save_recordObject



82
83
84
# File 'lib/lekanmastermind/messages.rb', line 82

def save_record
  'Do you want to save your record? y/n'
end

#select_levelObject



41
42
43
44
45
46
47
48
49
50
# File 'lib/lekanmastermind/messages.rb', line 41

def select_level
  <<-EOS
         *********************************************************
         *       Select Your preferred level of difficulty       *
         *          Enter 'beginner' for beginner level          *
         *          Enter 'intermediate' for intermediate        *
         *          Enter 'advanced'  for advanced level         *
         *********************************************************
  EOS
end

#top_tenObject



103
104
105
# File 'lib/lekanmastermind/messages.rb', line 103

def top_ten
  '========= TOP TEN ========='
end

#view_top_scoresObject



86
87
88
# File 'lib/lekanmastermind/messages.rb', line 86

def view_top_scores
  'Do you want to view top scores? y/n'
end

#welcomeObject



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/lekanmastermind/messages.rb', line 3

def welcome
   <<-EOS
           *************************************************
           *          Welcome to mastermind                *
           *                                               *
           *      Press p(lay) to start a new game         *
           *      Press (i)nstruction to load a saved game *
           *      Press (t)op to view Top scores           *
           *      Press (q)uit to quit the game at anytime *
           *      >                                        *
           *************************************************
  EOS
end