-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMagic8Ball.cs
86 lines (79 loc) · 2.16 KB
/
Magic8Ball.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using System;
using System.Collections.Generic;
class Magic8Ball{
static void Main(string[] args){
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("<------------Magic 8-Ball------------->");
Console.WriteLine("Created by Morasiu ([email protected])");
Console.WriteLine("Think about you question and press any key");
Console.ReadKey();
DisplayAnswer();
}
static void DisplayAnswer(){
Console.WriteLine(GetSpeechBubble(GetRandomAnswer()));
Console.Write(Get8Ball());
}
static string GetRandomAnswer(){
List<string> answers = new List<string>() {
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes definitely",
"You may rely on it",
"As I see it, yes",
"Most likely",
"Outlook good",
"Yep",
"Signs point to yes",
"Reply hazy try again",
"Ask again later",
"Better not tell you now",
"Cannot predict now",
"Concentrate and ask again",
"Don't count on it",
"My reply is no",
"My sources say no",
"Outlook not so good",
"Very doubtful"
};
Random rand = new Random();
return answers[rand.Next(0, answers.Count)];
}
static string GetSpeechBubble(string text){
string bubble = "";
string[] template = new string[3];
int textLength = text.Length;
template[0] += "/";
template[1] += "| " + text;
template[2] += "\";
for (int i = 0; i < textLength; i++){
template[0] += " ̄";
template[1] += " ";
template[2] += "__";
}
template[0] += "\";
template[1] += " |";
template[2] += "/";
bubble = template[0] + "\n" + template[1] + "\n" + template[2] + "\n" + " ∨";
return bubble;
}
static string Get8Ball(){
string ball = @"
_......._
.-:::::::::::-.
.:::::::::::::::::.
:::::::' .-. `:::::::
::::::: : : :::::::
:::::::: : : ::::::::
:::::::::._`-'_.:::::::::
:::::::::' .-. `:::::::::
:::::::: : : ::::::::
::::::: : : :::::::
:::::::._`-'_.:::::::
`:::::::::::::::::'
`-:::::::::::-'
`'''''''`'
";
return ball;
}
}