From ffc0b99fa3c57d8279c1334832893b7ffd27bf4f Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Wed, 6 Jul 2022 07:48:01 +1000 Subject: [PATCH] Display title and instructions --- 16_Bug/csharp/Game.cs | 25 +++++++++++++++++++++++++ 16_Bug/csharp/Program.cs | 4 ++++ 2 files changed, 29 insertions(+) create mode 100644 16_Bug/csharp/Game.cs create mode 100644 16_Bug/csharp/Program.cs diff --git a/16_Bug/csharp/Game.cs b/16_Bug/csharp/Game.cs new file mode 100644 index 00000000..b82c270d --- /dev/null +++ b/16_Bug/csharp/Game.cs @@ -0,0 +1,25 @@ +using Bug.Resources; +using Games.Common.IO; +using Games.Common.Randomness; + +internal class Game +{ + private readonly IReadWrite _io; + private readonly IRandom _random; + + public Game(IReadWrite io, IRandom random) + { + _io = io; + _random = random; + } + + public void Play() + { + _io.WriteLine(Resource.Streams.Introduction); + var response = _io.ReadString("Do you want instructions"); + if (!response.Equals("no", StringComparison.InvariantCultureIgnoreCase)) + { + _io.WriteLine(Resource.Streams.Instructions); + } + } +} \ No newline at end of file diff --git a/16_Bug/csharp/Program.cs b/16_Bug/csharp/Program.cs new file mode 100644 index 00000000..bb3d85aa --- /dev/null +++ b/16_Bug/csharp/Program.cs @@ -0,0 +1,4 @@ +using Games.Common.IO; +using Games.Common.Randomness; + +new Game(new ConsoleIO(), new RandomNumberGenerator()).Play();