mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-23 07:29:02 -08:00
Simplify Craps (C#) folder structure
This commit is contained in:
23
29_Craps/csharp/Craps/Dice.cs
Normal file
23
29_Craps/csharp/Craps/Dice.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
|
||||
|
||||
namespace Craps
|
||||
{
|
||||
public class Dice
|
||||
{
|
||||
private Random rand = new Random();
|
||||
public readonly int sides;
|
||||
|
||||
public Dice()
|
||||
{
|
||||
sides = 6;
|
||||
}
|
||||
|
||||
public Dice(int sides)
|
||||
{
|
||||
this.sides = sides;
|
||||
}
|
||||
|
||||
public int Roll() => rand.Next(1, sides + 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user