diff --git a/30_Cube/csharp/Program.cs b/30_Cube/csharp/Program.cs index f22208ac..803a569a 100644 --- a/30_Cube/csharp/Program.cs +++ b/30_Cube/csharp/Program.cs @@ -5,4 +5,6 @@ global using static Cube.Resources.Resource; using Cube; -new Game(new ConsoleIO(), new RandomNumberGenerator()).Play(); +IRandom random = args.Contains("--non-random") ? new ZerosGenerator() : new RandomNumberGenerator(); + +new Game(new ConsoleIO(), random).Play(); diff --git a/30_Cube/csharp/README.md b/30_Cube/csharp/README.md index 9100e6f8..7bea3d88 100644 --- a/30_Cube/csharp/README.md +++ b/30_Cube/csharp/README.md @@ -9,4 +9,4 @@ allows the game to be run in a deterministic (non-random) mode. Running the C# port without command-line parameters will play the game with random mine locations. -Running the port with a `-d` command-line switch will run the game with non-random mine locations. +Running the port with a `--non-random` command-line switch will run the game with non-random mine locations. diff --git a/30_Cube/csharp/ZerosGenerator.cs b/30_Cube/csharp/ZerosGenerator.cs new file mode 100644 index 00000000..4490f606 --- /dev/null +++ b/30_Cube/csharp/ZerosGenerator.cs @@ -0,0 +1,10 @@ +namespace Cube; + +internal class ZerosGenerator : IRandom +{ + public float NextFloat() => 0; + + public float PreviousFloat() => 0; + + public void Reseed(int seed) { } +} \ No newline at end of file