CSHARP-53 Create program sturcture

This commit is contained in:
Andrew Cooper
2022-10-21 21:48:58 +11:00
parent 399a2a7e81
commit 9b471073b0
7 changed files with 110 additions and 0 deletions

28
53_King/csharp/Game.cs Normal file
View File

@@ -0,0 +1,28 @@
namespace King;
internal class Game
{
const int TermOfOffice = 8;
private readonly IReadWrite _io;
private readonly IRandom _random;
public Game(IReadWrite io, IRandom random)
{
_io = io;
_random = random;
}
public void Play()
{
_io.Write(Resource.Title);
var response = _io.ReadString(Resource.Instructions_Prompt).ToUpper();
if (!response.StartsWith('N'))
{
_io.Write(Resource.Instructions_Text(TermOfOffice));
}
_io.WriteLine();
}
}