Пример #1
0
        public Environment(SimulationParameters simulationParams)
        {
            instance = this;

            firstCorner = simulationParams.environmentFirstCorner;
            secondCorner = simulationParams.environmentSecondCorner;

            BlastCellTotal = 0;
            FinalCellTotal = 0;
            MutatedCellTotal = 0;

            tissues = new List<Tissue>();
            foreach (SimulationParameters.TissueParameters tissueParam in simulationParams.tissueParams)
            {
                tissues.Add(new Tissue(tissueParam));
            }

            cells = new List<TissueCell>();
            newCells = new List<TissueCell>();
            dyingCells = new List<TissueCell>();

            signals = new List<Signal>();
            newSignals = new List<Signal>();
            expiredSignals = new List<Signal>();

            pressurePoints = new List<LocationContents>();

            Console.WriteLine("setting up environment matrix");
            environmentMatrix = new LocationContents[(int)secondCorner.X + 1, (int)secondCorner.Y + 1, (int)secondCorner.Z + 1];
            createMatrix(firstCorner, secondCorner);

            Console.WriteLine("setting up initial pressure around the [" + tissues.Count + "] tissue(s)");
            foreach(Tissue t in tissues)
                setupPressureAroundTissue(t, simulationParams.SectorPressureDistance, simulationParams.SectorPressureInitial, simulationParams.SectorPressureIncrement);

            Console.WriteLine("setting up sectors");
            sectorMap = new Sector[(int)secondCorner.X + 1, (int)secondCorner.Y + 1, (int)secondCorner.Z + 1];
            List<Sector> sectors = sectorSetup(simulationParams.SectorHeight, simulationParams.SectorWidth, simulationParams.SectorDepth);
            Console.WriteLine("there are [" + sectors.Count + "] total sectors");

            Console.WriteLine("creating location->sector map");
            CreateSectorMap(sectors);

            Console.WriteLine("initializing circulatory system");
            circulatorySystem = new CirculatorySystem(simulationParams.PipeParams, simulationParams.PipeCorners);

            Console.WriteLine("setting up initial pressue around the pipes");
            setupPressureAroundPipes(circulatorySystem, simulationParams.PipePressureDistance, simulationParams.PipePressureInitial, simulationParams.PipePressureIncrement);

            Console.WriteLine("initializing cells");
            Console.WriteLine("behavior: " + simulationParams.behaviorType);
            BlastCell.InitializeDivideProbabilities(simulationParams.cellParameters.BlastCellDivideIntoBlastProbability, simulationParams.cellParameters.BlastCellDivideIntoFinalProbability);
            initializeCells(simulationParams.startingCells, simulationParams.behaviorType);
        }
Пример #2
0
        public CirculatorySystem(SimulationParameters.PipeParameters pipeParams, SimulationParameters.PipeLocations pipeCorners)
        {
            instance = this;

            this.pipeShrinkRate = pipeParams.PipeShrink;

            pipeCells = new List<EndothelialCell>();
            hungryCells = new List<TissueCell>();
            growingPipes = new List<GrowingPipe>();

            maxNumGrowthsPerTurn = pipeParams.MaxGrowthPerTurn;

            EndothelialCell root = new EndothelialCell(pipeCorners.location, pipeParams.PipeRootOrientation, pipeParams.PipeStartingWidth, null);
            setupPipes(root, pipeCorners.children);
        }
Пример #3
0
        private void setupPressureAroundPipes(CirculatorySystem pipeSystem, int distance, int initialPressure, int pressureIncrement)
        {
            HashSet<Vector3> past = new HashSet<Vector3>();
            HashSet<Vector3> present = new HashSet<Vector3>();

            foreach(EndothelialCell pipePiece in pipeSystem.PipeCells)
                present.Add(pipePiece.CellLocation);

            sendPressureWave(past, present, distance, initialPressure, pressureIncrement);
        }