예제 #1
0
        public RuleModel(CellNeighborhoodTypeModel neighborhoodType)
        {
            Birth    = new NumberOfCellsForRulesModel[(int)neighborhoodType];
            Survival = new NumberOfCellsForRulesModel[(int)neighborhoodType];

            for (int i = 0; i < (int)neighborhoodType; i++)
            {
                Birth[i]    = new NumberOfCellsForRulesModel(i);
                Survival[i] = new NumberOfCellsForRulesModel(i);
            }
        }
예제 #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);
        }
 public RadialGrainCellNeighborhood(List <ICell> cells, CellNeighborhoodTypeModel type)
 {
     Type  = type;
     Cells = cells;
 }