示例#1
0
 public CellGrid1DModel(int size, RuleModel rule, BoundaryConditionModel boundaryCondition)
 {
     Size              = size;
     LastCellId        = size - 1;
     Rule              = rule;
     BoundaryCondition = boundaryCondition;
     AddNewCells();
 }
示例#2
0
        public CellGrid2DModel(int columnCount, int rowCount, CellNeighborhoodTypeModel neighborhoodType,
                               RuleModel rule, BoundaryConditionModel boundaryCondition)
        {
            ColumnCount = columnCount;
            RowCount    = rowCount;
            ZeroState   = new CellStateModel();
            AliveState  = new CellStateModel(1);
            AliveState.SetColor(System.Windows.Media.Colors.RoyalBlue);
            NeighborhoodType  = neighborhoodType;
            Rule              = rule;
            BoundaryCondition = boundaryCondition;

            CurrentState  = new List <List <ICell> >();
            PreviousState = new List <List <ICell> >();
            CreateNewCellsForCurrentState();
            CreateRowsInPreviousState();
            AddNeighboringCellsToCellsState(CurrentState);
        }
        public GrainCellGrid2DModel(
            int columnCount,
            int rowCount,
            CellNeighborhoodTypeModel neighborhoodType,
            BoundaryConditionModel boundaryCondition,
            int cellNeighborhoodRadius = 0)
        {
            CreateNewStaticRandom();

            ColumnCount            = columnCount;
            RowCount               = rowCount;
            NeighborhoodType       = neighborhoodType;
            BoundaryCondition      = boundaryCondition;
            CellNeighborhoodRadius = cellNeighborhoodRadius;

            grains.Add(ZeroState);
            CurrentState  = new List <List <ICell> >();
            PreviousState = new List <List <ICell> >();

            CreateNewGrainCellsForCurrentState();
            CreateRowsInPreviousState();
            AddNeighboringCellsToCellsState(CurrentState);
        }