Ejemplo n.º 1
0
 public Cell get_cell(int x, int y)
 {
     Cell cell = null;
     if (x >= 0 && y >= 0 && x <= array.GetLength(0) && y <= array.GetLength(1)) cell= array[x, y];
     if (cell == null) cell = new DefaultCell(x, y, CellState.Dead);
     return cell;
 }
        public override void setup_map()
        {
            Cell[,] array = new Cell[x_max, y_max];
            Random rnd = new Random();

            for (int x = 0; x < x_max; x++)
                for (int y = 0; y < y_max; y++)
                    array[x, y] = new DefaultCell(x, y, CellState.Dead);
            array[1, 5].state = CellState.Live;
            array[2, 5].state = CellState.Live;
            array[1, 6].state = CellState.Live;
            array[2, 6].state = CellState.Live;

            array[11, 5].state = CellState.Live;
            array[11, 6].state = CellState.Live;
            array[11, 7].state = CellState.Live;
            array[12, 4].state = CellState.Live;
            array[13, 3].state = CellState.Live;
            array[14, 3].state = CellState.Live;
            array[12, 8].state = CellState.Live;
            array[13, 9].state = CellState.Live;
            array[14, 9].state = CellState.Live;
            array[15, 6].state = CellState.Live;
            array[16, 4].state = CellState.Live;
            array[16, 8].state = CellState.Live;
            array[17, 5].state = CellState.Live;
            array[17, 6].state = CellState.Live;
            array[17, 7].state = CellState.Live;
            array[18, 6].state = CellState.Live;

            array[21, 3].state = CellState.Live;
            array[21, 4].state = CellState.Live;
            array[21, 5].state = CellState.Live;
            array[22, 3].state = CellState.Live;
            array[22, 4].state = CellState.Live;
            array[22, 5].state = CellState.Live;
            array[23, 2].state = CellState.Live;
            array[23, 6].state = CellState.Live;
            array[25, 1].state = CellState.Live;
            array[25, 2].state = CellState.Live;
            array[25, 6].state = CellState.Live;
            array[25, 7].state = CellState.Live;

            array[35, 3].state = CellState.Live;
            array[35, 4].state = CellState.Live;
            array[36, 3].state = CellState.Live;
            array[36, 4].state = CellState.Live;

            map = new DefaultCellMap(array, square_size);
        }
Ejemplo n.º 3
0
        public Cell get_cell(int x, int y)
        {
            Cell cell = null;

            if (x >= 0 && y >= 0 && x <= array.GetLength(0) && y <= array.GetLength(1))
            {
                cell = array[x, y];
            }
            if (cell == null)
            {
                cell = new DefaultCell(x, y, CellState.Dead);
            }
            return(cell);
        }
Ejemplo n.º 4
0
        public virtual void setup_map()
        {
            Cell[,] array = new Cell[x_max, y_max];

            for (int x = 0; x < x_max; x++)
                for (int y = 0; y < y_max; y++)
                {
                    CellState state = CellState.Dead;
                    if (x >= 1 && x <= x_max - 5 && y == decimal.Round(y_max / 2))
                    {
                        state = CellState.Live;
                    }
                    array[x, y] = new DefaultCell(x, y, state);
                }

            map = new DefaultCellMap(array, square_size);
        }
Ejemplo n.º 5
0
        public override void setup_map()
        {
            Cell[,] array = new Cell[x_max, y_max];

            for (int x = 0; x < x_max; x++)
                for (int y = 0; y < y_max; y++)
                {
                    CellState state = CellState.Dead;
                    if ((x-y)%2==1 )
                    {
                        state = CellState.Live;
                    }
                    array[x, y] = new DefaultCell(x, y, state);
                }

            map = new DefaultCellMap(array, square_size);
        }
        public override void setup_map()
        {
            Cell[,] array = new Cell[x_max, y_max];
            Random rnd = new Random();

            for (int x = 0; x < x_max; x++)
                for (int y = 0; y < y_max; y++)
                {
                    CellState state = CellState.Dead;
                    if ((x)%3==rnd.Next(1, 2))
                    {
                        state = CellState.Live;
                    }
                    array[x, y] = new DefaultCell(x, y, state);
                }

            map = new DefaultCellMap(array, square_size);
        }