// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace Yatzy { class Program { static void Main(string[] args) { for(int i = 0; i < 5; i++) { DiceCup1 MyCup1 = new DiceCup1(5); Console.Write("Multi Random 1: "); foreach(Dice1 d in MyCup1.Dices) { Console.Write(" " + d.Value); } Console.WriteLine(); DiceCup2 MyCup2 = new DiceCup2(5); Console.Write("Multi Random 2: "); foreach(Dice2 d in MyCup2.Dices) { Console.Write(" " + d.Value); } Console.WriteLine(); DiceCup3 MyCup3 = new DiceCup3(5); Console.Write("Single Random : "); foreach(Dice3 d in MyCup3.Dices) { Console.Write(" " + d.Value); } Console.WriteLine(); Thread.Sleep(100); } Console.ReadLine(); } } class Dice1 { private int _value; public Dice1() { ThrowDice(); } public void ThrowDice() { Random random = new Random(); _value = random.Next(1, 6); } public int Value { get { return _value; } } } class DiceCup1 { private List _dices = new List(); public List Dices { get { return _dices; } } public DiceCup1(int dices) { for(int i=0;i _dices = new List(); public List Dices { get { return _dices; } } public DiceCup2(int dices) { for(int i=0;i _dices = new List(); public List Dices { get { return _dices; } } public DiceCup3(int dices) { for(int i=0;i