mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 07:10:42 -08:00
44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|