mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 15:16:33 -08:00
Display title and instructions
This commit is contained in:
25
16_Bug/csharp/Game.cs
Normal file
25
16_Bug/csharp/Game.cs
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
4
16_Bug/csharp/Program.cs
Normal file
4
16_Bug/csharp/Program.cs
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
using Games.Common.IO;
|
||||||
|
using Games.Common.Randomness;
|
||||||
|
|
||||||
|
new Game(new ConsoleIO(), new RandomNumberGenerator()).Play();
|
||||||
Reference in New Issue
Block a user