mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 23:26:40 -08:00
Add main game logic
This commit is contained in:
14
30_Cube/csharp/RandomExtensions.cs
Normal file
14
30_Cube/csharp/RandomExtensions.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Cube;
|
||||
|
||||
internal static class RandomExtensions
|
||||
{
|
||||
internal static (float, float, float) NextLocation(this IRandom random, (int, int, int) bias)
|
||||
=> (random.NextCoordinate(bias.Item1), random.NextCoordinate(bias.Item2), random.NextCoordinate(bias.Item3));
|
||||
|
||||
private static float NextCoordinate(this IRandom random, int bias)
|
||||
{
|
||||
var value = random.Next(3);
|
||||
if (value == 0) { value = bias; }
|
||||
return value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user