-
Notifications
You must be signed in to change notification settings - Fork 0
/
TerminalService.cs
70 lines (61 loc) · 2.09 KB
/
TerminalService.cs
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
namespace terminal
{
class TerminalService
{
public TerminalService(){}
//get an input from the user to set the difficulty level for the game
public int difficulty()
{
do{
Console.WriteLine("Please select a difficulty level (type only the number): ");
Console.WriteLine("1. Easy");
Console.WriteLine("2. Medium");
Console.WriteLine("3. Hard");
string input = Console.ReadLine();
int difficulty = Convert.ToInt32(input);
if (difficulty < 1 || difficulty > 3)
{
Console.WriteLine("Invalid input. Please try again.");
}
else
{
return difficulty;
}
} while (true);
}
//gets the guess from the user and return it to the director class
public char guess()
{
Console.WriteLine("Guess a letter: ");
char guess = char.Parse(Console.ReadLine());
guess = char.ToLower(guess);
return guess;
}
//tells the user that their guess was incorrect
public void print_wrong_guesses(string incorrect_guesses)
{
Console.WriteLine($"{incorrect_guesses}");
}
//tells the user that their guess was correct and prints the current state of the word
public void display_correct_guesses(char[] correct_array_string)
{
Console.Write("So far you have:");
Console.WriteLine(correct_array_string);
}
//tells the user that they have won the game
public void print_win()
{
Console.WriteLine("You win!");
}
//tells the user that they have lost the game
public void print_lose()
{
Console.WriteLine("You lose! Don't do a big dumb next time");
}
//print the input to the terminal
public void print(string words)
{
Console.WriteLine(words);
}
}
}