mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-19 08:11:14 -08:00
CSHARP-53 Create program sturcture
This commit is contained in:
28
53_King/csharp/Game.cs
Normal file
28
53_King/csharp/Game.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user