Esempio n. 1
0
        public GameField()
        {
            Cells = new Cell[FieldSize][];
            for(int i = 0; i < FieldSize; i++)
            {
                Cells[i] = new Cell[FieldSize];
            }

            Rand = new Random((int)(DateTime.Now.Ticks % 182741696739112));
        }
Esempio n. 2
0
        public void GenerateNewRandomField()
        {
            int randomPosition;
            while (true)
            {
                randomPosition = Rand.Next()%16;
                int x = randomPosition/4;
                int y = randomPosition%4;

                if (Cells[x][y] != null){
                    Cells[x][y] = new Cell();
                    break;
                }
            }
        }