-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
125 lines (104 loc) · 5.27 KB
/
Program.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
//------------------------------------------------------------------------------
// Name: LEO-Irabor Joshua
// Title: Who want's to be a Millionaire Game Model
// Date Started: 27th December 2013
// Date Finished: 29th December 2013
//
// Updates:
// 30th December 2013 --> Added the "Walk away" option.
//
//
//------------------------------------------------------------------------------
using System;
using System.IO;
using System.Diagnostics;
namespace WWTBAM
{
class Program
{
static void Main()
{
int count = 0;
Console.WriteLine("Who Wants to be A Millionaire");
Console.Write("Enter your name: ");
string playerName = Console.ReadLine();
string userInput;
bool stillInTheGame = true;
bool walkAway = false;
Player theplayer = new Player(playerName);
bool invaliid = false;
do
{
Console.Write("Hello {0}! Are you ready to play Who Wants to be a Millionaire? Y/N: ",
theplayer.userName.Trim());
string response = Console.ReadLine();
if(response.ToLower() == "n")
{
return;
}
else if(response.ToLower() == "y")
{
do
{
Console.Clear();
Console.WriteLine("------------------------------------------------------------------------------------");
Console.WriteLine(theplayer.money.ToString());
Console.WriteLine("------------------------------------------------------------------------------------");
Console.WriteLine(theplayer.userLifeLines.LifeLinesLeft());
Console.WriteLine("------------------------------------------------------------------------------------");
Console.WriteLine(theplayer.question.ToString());
Console.WriteLine("------------------------------------------------------------------------------------");
Console.WriteLine("Press (4) to walk away");
Console.WriteLine("------------------------------------------------------------------------------------");
userInput = Console.ReadLine();
walkAway = theplayer.WalkAway(userInput);
if(!walkAway)
{
stillInTheGame = theplayer.MarkAnswer(userInput);
if(stillInTheGame)
{
theplayer.money.CurrentLevel = theplayer.money.CurrentLevel.Next;
Console.WriteLine("You have won yourself ${0}", theplayer.money.CurrentLevel.Amount);
Console.WriteLine();
count++;
do
{
if(count != 9)
{
Console.WriteLine("Go to the next question? Y/N: ");
response = Console.ReadLine();
if(response.ToLower() == "n")
{
//To Do Something really cool right here
return;
}
else if(response.ToLower() != "n" && response.ToLower() != "y")
{
Console.WriteLine("Invalid Response");
}
}
}while (response.ToLower() != "n" && response.ToLower() != "y");
}
else
{
Console.WriteLine("You Leave with ${0}", theplayer.money.CurrentLevel.Group);
Console.WriteLine("GAME OVER !!!");
}
}
else
{
return;
}
Console.WriteLine("------------------------------------------------------------------------------------");
}while (stillInTheGame && count < 9);
}
else
{
Console.WriteLine("Invalid Response");
invaliid = true;
}
}
while(invaliid);
}
}
}