Beispiel #1
0
        public void NewGameRandomColors(Row headerRow)
        {
            List <int> selectedNumbers = new List <int>();
            Random     r = new Random(DateTime.Now.Millisecond);

            while (true)
            {
                var number = r.Next(1, 6);

                if (!selectedNumbers.Contains(number) && number != 0)
                {
                    selectedNumbers.Add(number);
                }

                if (selectedNumbers.Count(x => x != 0) == 4)
                {
                    break;
                }
            }

            headerRow.Field1 = Field.NewField(1, colors[selectedNumbers[0]]);
            headerRow.Field2 = Field.NewField(2, colors[selectedNumbers[1]]);
            headerRow.Field3 = Field.NewField(3, colors[selectedNumbers[2]]);
            headerRow.Field4 = Field.NewField(4, colors[selectedNumbers[3]]);
        }
Beispiel #2
0
        public Row NewRow(byte id)
        {
            var row = new Row();

            row.Id = id;

            row.Field1 = Field.NewField(1);
            row.Field2 = Field.NewField(2);
            row.Field3 = Field.NewField(3);
            row.Field4 = Field.NewField(4);

            return(row);
        }