forked from coding-horror/basic-computer-games
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
43 lines (37 loc) · 1.07 KB
/
Copy pathProgram.cs
File metadata and controls
43 lines (37 loc) · 1.07 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
using System;
using System.Reflection;
using Games.Common.IO;
using Games.Common.Randomness;
namespace Target
{
class Program
{
static void Main()
{
var io = new ConsoleIO();
var game = new Game(io, new FiringRange(new RandomNumberGenerator()));
Play(game, io, () => true);
}
public static void Play(Game game, TextIO io, Func<bool> playAgain)
{
DisplayTitleAndInstructions(io);
while (playAgain())
{
game.Play();
io.WriteLine();
io.WriteLine();
io.WriteLine();
io.WriteLine();
io.WriteLine();
io.WriteLine("Next target...");
io.WriteLine();
}
}
private static void DisplayTitleAndInstructions(TextIO io)
{
using var stream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream("Target.Strings.TitleAndInstructions.txt");
io.Write(stream);
}
}
}