// Constructor static GameDice() { DieStructs = new DieStruct [5]; for (int i = 0; i < 5; i++) { DieStructs [i] = new DieStruct(); } }
/// <summary> /// Old version swapped the dies in Dice from low to high. /// New version: same, but add a Die ID for each die. /// </summary> static void SortDice() { int _max = 4; bool _unsorted = true; var _swapStruct = new DieStruct(); // Sort the dice by face value. while (_unsorted) { _unsorted = false; for (int i = 0; i < _max; i++) { if (DieStructs [i].FaceValue > DieStructs [i + 1].FaceValue) { _unsorted = true; _swapStruct = DieStructs [i]; DieStructs [i] = DieStructs [i + 1]; DieStructs [i + 1] = _swapStruct; } } _max--; } }