Class: PaitinHangman::Message

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

Class Method Summary collapse

Class Method Details

.end_gamesObject



71
72
73
# File 'lib/paitin_hangman/messages.rb', line 71

def self.end_games
  puts "Press 'r' to restart the game or 'q' to quit."
end

.game_introObject

> game logic



46
47
48
49
# File 'lib/paitin_hangman/messages.rb', line 46

def self.game_intro
  puts "Now that you have chosen to play".green
  print "What is your name: ".green
end

.game_typeObject

> game logic



58
59
60
61
# File 'lib/paitin_hangman/messages.rb', line 58

def self.game_type
  puts "1)\tPlay against a Human Player, press 1\n"\
  "2)\tPlay against Computer, press 2"
end

.instructionObject

> The instruction tells the user what the game is about



20
21
22
23
24
25
26
27
# File 'lib/paitin_hangman/messages.rb', line 20

def self.instruction
  puts "\tThe word to guess is represented by a row of dashes
  These dashes represent each letter of the word.
  Words you cannot use include proper nouns such as names, places, and brands.
  If the guessing player suggests a letter which occurs in the word,
  the other player writes it in all its correct positions.".yellow
  Message.instruction_continue
end

.instruction_continueObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/paitin_hangman/messages.rb', line 29

def self.instruction_continue
  puts "\tThe guessing player wins the game if he gets all letters correctly
  within number of chances afforded. He loses if he exhausts all his chances
  without getting all the letters of the word completely".yellow
  puts "\tNow decide whether you want to 'p'lay or 'q'uit.
  Please do keep in mind that you can press ':h' or 'history' at any time
  during the game to show your guess history or ':q'/'quit' to exit the game
  While quitting the game, you may quit directly or decide to save your
  session to resume at a later time at which point you must press 's'".yellow
end

.level_choiceObject

informs the player of the levels available & their respective difficulties



64
65
66
67
68
69
# File 'lib/paitin_hangman/messages.rb', line 64

def self.level_choice
  puts "    Enter the Level you would like to play. You may press...
  1 for Beginner (4 - 8 character word)
  2 for Intermediate (9 - 12 character word)
  3 for Advanced (word has above 12 characters)".yellow
end

.valid_optionObject

> This method basically instructs the player to pick a valid option



41
42
43
# File 'lib/paitin_hangman/messages.rb', line 41

def self.valid_option
  puts "Try and enter a valid option: 'p', 'i', 'l' or 'q'".yellow
end

.verify_nameObject

> Instructs the user to enter a valid name



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

def self.verify_name
  puts "Please enter your real name, I don't think it is just a".red
  puts "space or it contains numbers.".red
end

.welcomeObject

> The welcome message introduces the game to the player



9
10
11
12
13
14
15
16
17
# File 'lib/paitin_hangman/messages.rb', line 9

def self.welcome
  puts "\tWelcome to Hangman, the no-nonsense game
  Be smart, then you live. if not, you'll have to die by Hanging.
  You have a couple of options to pick from.....
  Press 'P' or 'play' if you think you are ready for the challenge,
  You may press 'I' or 'instructions' for a short explanation of how to play
  You may continue a previously saved game by pressing 'L' or 'load'
  Or you could just quit by pressing a 'Q' or typing 'quit'".green
end