-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHowToPlay.java
More file actions
55 lines (51 loc) · 3.45 KB
/
HowToPlay.java
File metadata and controls
55 lines (51 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
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
49
50
51
52
53
54
55
import java.io.*;
class HowToPlay
{
static void display()throws Exception
{
System.out.print("\u000C");
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
System.out.print("Mastermind is a code-breaking game for two players –");
System.out.println("a code maker and a code breaker.");
System.out.print("With four pegs and six colors, there are (6)^4 = ");
System.out.println("1296 different patterns (allowing duplicate colors).");
System.out.print("Varying the number of colors and the number of holes results in a ");
System.out.println("spectrum of Mastermind games of different levels of difficulty.\n");
System.out.println("In this program, computer plays the role of code maker and" +
"user plays the role of code breaker.");
System.out.print("Computer creates a code containing 4 or 5 colors, " +
"based on difficulty level, at specific positions,");
System.out.println("but does not reveal the code to code breaker (user).\n");
System.out.print("Code breaker tries to guess the pattern, in both order and color, ");
System.out.println("within ‘x’ turns, where x is determined by the difficulty level.");
System.out.println("The valid colour codes for each difficulty level are -");
System.out.println("\tLevel : Rookie - V, I, B, G, Y and O for Violet, Indigo, Blue," +
" Green, Yellow and Orange respectively.");
System.out.println("\tLevel : Pro - V, I, B, G, Y, O and R for Violet, Indigo, Blue," +
" Green, Yellow, Orange and Red respectively.");
System.out.println("\tLevel : Expert - V, I, B, G, Y, O, R, P and C for Violet, Indigo,"
+ "Blue, Green, Yellow, Orange, Red, Pink and Cyan respectively.\n");
System.out.println("\tLevel : Genius - V, I, B, G, Y, O, R, P, C and M for Violet, " +
"Indigo, Blue, Green, Yellow, Orange, Red, Pink, Cyan and Maroon " +
"respectively.\n");
System.out.println("Once code is typed, the code maker provides feedback by displaying "
+ "'m' B and 'n' W,");
System.out.println("where m and n can be a positive integer <= number of positions " +
"(for example 1 B, 2 W).");
System.out.println("B is displayed for each color from the guess which is correct in " +
"both color and position.");
System.out.println("W indicates the existence of a correct color, but placed in the " +
"wrong position.\n");
System.out.println("Once feedback is provided, another guess is made by the user;");
System.out.println("guesses and feedback continue to alternate until either the code " +
"breaker guesses correctly,");
System.out.println("or twelve (or ten) incorrect guesses are made, depending on the " +
"difficulty level. ");
System.out.println("Now that you know the rules, proceed to play this challenging, " +
"exciting and fascinating game.");
System.out.println("All the best!\n\nPress Enter key to continue...");
br.read();
Fill.load();
System.out.print("\u000C");
}
}