Exemplo n.º 1
0
 private static void EraseCell(Coords gridCoords, CellState cellState)
 {
     if (GridCoordsAreWithinBounds(gridCoords))
     {
         DrawCharacter(gridCoords, ' ');
     }
 }
Exemplo n.º 2
0
        private static void DrawCell(Coords gridCoords, CellState cellState)
        {
            if (GridCoordsAreWithinBounds(gridCoords))
            {
                var savedForegroundColor = Console.ForegroundColor;

                Console.ForegroundColor = cellState.IsZombie ? ConsoleColor.Magenta : ConsoleColor.Cyan;
                DrawCharacter(gridCoords, 'X');

                Console.ForegroundColor = savedForegroundColor;
            }
        }
Exemplo n.º 3
0
 public Cell(CellState state)
 {
     State = state;
 }
Exemplo n.º 4
0
 public Cell(CellState state)
 {
     State = state;
 }
Exemplo n.º 5
0
 public void ChangeCellState(CellState newCellState, int column, int row)
 {
     cellGrid.Cells[column, row].State = newCellState;
 }
 public Cell(Position position, CellState cellState)
 {
     this._position = position;
     this._cellState = cellState;
 }
Exemplo n.º 7
0
 public ReadOnlyCell(CellState cellCellState)
 {
     _cellCellState = cellCellState;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Copy constructor, used in history
 /// </summary>
 /// <param name="other">Cell object to copy from</param>
 public Cell(Cell other)
 {
     State     = other.State;
     _gridPos  = other._gridPos;
     StateTime = other.StateTime;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes the cell at the specified gird pos with the specified state
 /// </summary>
 /// <param name="state">The current state of the cell</param>
 /// <param name="gridPos">The grid position of the cell</param>
 public Cell(CellState state, Point gridPos)
 {
     State    = state;
     _gridPos = gridPos;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Actually updates the cell state
 /// </summary>
 public void EndUpdate()
 {
     State      = _nextState;
     _nextState = CellState.Unknown;
 }
Exemplo n.º 11
0
		public Cell(string id, List<string> neighborsIds, CellState state = Alive)
		{
			this.Id = id;
			NeighborsIds = neighborsIds;
			State = state;
		}
Exemplo n.º 12
0
 public void RandomizeState()
 {
     State     = G.Rnd.NextDouble() > 0.7f ? CellState.Alive : CellState.Dead;
     NextState = State;
 }
Exemplo n.º 13
0
 public string Visualize(CellState state)
 {
     return(state == CellState.Alive ? "■" : " ");
 }
Exemplo n.º 14
0
 public Cell(CellState cellState)
 {
     CellState = cellState;
 }