public DefaultCellMap(Cell[,] array, int square_size)
        {
            this.array = array;

            counter = 0;
            this.square_size = square_size;
            ColorAdapter dead = new ColorAdapter(Color.Black);
            color_adapters = new DefaultColorAdapterDictionary(new List<KeyValuePair<string, ColorAdapter>>(), dead);
            color_adapters.Add("NoNeighbor", new ColorAdapter(Color.OrangeRed));
            color_adapters.Add("OneNeighbor",  new ColorAdapter(Color.Yellow));
            color_adapters.Add("TwoNeighbors",  new ColorAdapter(Color.Orange));
            color_adapters.Add("ThreeNeighbors",  new ColorAdapter(Color.LightYellow));
            color_adapters.Add("MoreThanThreeNeighbors",  new ColorAdapter(Color.LightGreen));
            color_adapters.Add("AlmostDead",  new ColorAdapter(Color.DimGray));
            color_adapters.Add("Dead",  dead);
            color_adapters.Add("Default",  new ColorAdapter(Color.White));
            color_adapters.Add("Side", new ColorAdapter(Color.White));
        }
        public bool visit(Cell cell)
        {
            if (cell.hasChanged())
            {
                ColorAdapter adapter        = color_adapters.Get("Default");
                int          neighbor_count = map.get_neighbor_count_of(cell);
                if (cell.state == CellState.Live)
                {
                    if (neighbor_count > 3)
                    {
                        adapter = color_adapters.Get("NoNeighbor");
                    }
                    if (neighbor_count == 3)
                    {
                        adapter = color_adapters.Get("ThreeNeighbors");
                    }
                    if (neighbor_count == 2)
                    {
                        adapter = color_adapters.Get("TwoNeighbors");
                    }
                    if (neighbor_count == 1)
                    {
                        adapter = color_adapters.Get("OneNeighbor");
                    }
                    if (neighbor_count == 0)
                    {
                        adapter = color_adapters.Get("NoNeighbor");
                    }
                }
                else if (cell.state == CellState.AlmostDead)
                {
                    adapter = color_adapters.Get("Dead");
                }
                else
                {
                    adapter = color_adapters.Get("Dead");
                }

//                if (cell.location.x == 0 || cell.location.x == map.height() ||
//                    cell.location.y == 0 || cell.location.y == map.width()) adapter = color_adapters.Get("Side");
                graphics.FillPie(adapter.Brush(), cell.location.x * square_size, cell.location.y * square_size, square_size, square_size, 0, 360);
            }
            return(true);
        }
 public void Add(string key, ColorAdapter adapter)
 {
     adapters.Add(new KeyValuePair <string, ColorAdapter>(key, adapter));
 }
 public DefaultColorAdapterDictionary(IList <KeyValuePair <string, ColorAdapter> > adapters, ColorAdapter dead_adapter)
 {
     this.adapters = adapters;
     special_case  = dead_adapter;
 }