示例#1
0
 private static void EraseCell(Coords gridCoords, CellState cellState)
 {
     if (GridCoordsAreWithinBounds(gridCoords))
     {
         DrawCharacter(gridCoords, ' ');
     }
 }
示例#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;
            }
        }
示例#3
0
 public Cell(CellState state)
 {
     State = state;
 }
示例#4
0
 public Cell(CellState state)
 {
     State = state;
 }
示例#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;
 }
示例#7
0
 public ReadOnlyCell(CellState cellCellState)
 {
     _cellCellState = cellCellState;
 }
示例#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;
 }
示例#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;
 }
示例#10
0
 /// <summary>
 /// Actually updates the cell state
 /// </summary>
 public void EndUpdate()
 {
     State      = _nextState;
     _nextState = CellState.Unknown;
 }
示例#11
0
		public Cell(string id, List<string> neighborsIds, CellState state = Alive)
		{
			this.Id = id;
			NeighborsIds = neighborsIds;
			State = state;
		}
示例#12
0
 public void RandomizeState()
 {
     State     = G.Rnd.NextDouble() > 0.7f ? CellState.Alive : CellState.Dead;
     NextState = State;
 }
示例#13
0
 public string Visualize(CellState state)
 {
     return(state == CellState.Alive ? "■" : " ");
 }
示例#14
0
 public Cell(CellState cellState)
 {
     CellState = cellState;
 }