Interface IDie
Represents a single die with a fixed number of sides.
public interface IDie
- Extension Methods
Examples
IDie die = new Die(20);
int result = die.Roll(); // a value in [1, 20]
Properties
MaxValue
The maximum value that can be rolled on the die. Equal to SideCount.
int MaxValue { get; }
Property Value
MinValue
The minimum value that can be rolled on the die. Always 1.
int MinValue { get; }
Property Value
SideCount
The number of sides on the die. Must be at least 2.
int SideCount { get; }
Property Value
Remarks
A value of 2 represents a coin toss, 3 represents a three-sided die, etc.
Methods
Roll()
Rolls the die and returns the value rolled.
int Roll()
Returns
ToString()
Returns a string representation of the die in the format "dY" where Y is the number of sides.
string ToString()
Returns
- string
The die in standard
dYnotation.