diff --git a/26_Chomp/csharp/Game.cs b/26_Chomp/csharp/Game.cs new file mode 100644 index 00000000..943eb95a --- /dev/null +++ b/26_Chomp/csharp/Game.cs @@ -0,0 +1,27 @@ +namespace Chomp; + +internal class Game +{ + private readonly IReadWrite _io; + + public Game(IReadWrite io) + { + _io = io; + } + + internal void Play() + { + _io.Write(Resource.Streams.Introduction); + if (_io.ReadNumber("Do you want the rules (1=Yes, 0=No!)") != 0) + { + _io.Write(Resource.Streams.Rules); + } + + while (true) + { + _io.Write(Resource.Streams.HereWeGo); + + if (_io.ReadNumber("Again (1=Yes, 0=No!)") != 1) { break; } + } + } +} \ No newline at end of file diff --git a/26_Chomp/csharp/Program.cs b/26_Chomp/csharp/Program.cs new file mode 100644 index 00000000..f541259c --- /dev/null +++ b/26_Chomp/csharp/Program.cs @@ -0,0 +1,5 @@ +global using Games.Common.IO; +global using Chomp.Resources; +using Chomp; + +new Game(new ConsoleIO()).Play(); \ No newline at end of file