Example #1
0
        public void AddCell(ValueTuple <ushort, ushort, ushort> location, CAGraphCell cell)
        {
            var thisCell = GetCell(location);

            if (Cells.GetLength(0) >= location.Item1 && Cells.GetLength(1) >= location.Item2 && Cells.GetLength(2) >= location.Item3)
            {
                Cells[location.Item1, location.Item2, location.Item3] = cell;
            }
        }
Example #2
0
        //List<double> times = new List<double>();
        //System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

        public CAGraph(CA parent, ValueTuple <ushort, ushort, ushort> size, GridShape shape) : base(CAEntityType.Graph)
        {
            this.Parent = parent;
            this.Shape  = shape;
            AgentCells  = new List <ValueTuple <ushort, ushort, ushort> >();
            Updates     = new List <ValueTuple <ushort, ushort, ushort> >();
            Dimensions  = new ValueTuple <ushort, ushort, ushort>(size.Item1, size.Item2, size.Item3);
            Cells       = new CAGraphCell[size.Item1, size.Item2, size.Item3];
            for (ushort i = 0; i < Cells.GetLength(0); i++)
            {
                for (ushort j = 0; j < Cells.GetLength(1); j++)
                {
                    for (ushort k = 0; k < Cells.GetLength(2); k++)
                    {
                        Cells[i, j, k] = new CAGraphCell(this, new ValueTuple <ushort, ushort, ushort>(i, j, k));
                    }
                }
            }
        }
Example #3
0
 public CAGraph(CA parent, ValueTuple <ushort, ushort, ushort> size, GridShape shape, List <ValueTuple <ushort, ushort, ushort> > agents, CAGraphCell[,,] cells, Dictionary <string, dynamic> properties) : base(CAEntityType.Graph, properties)
 {
     Parent     = parent;
     Shape      = shape;
     AgentCells = agents.ConvertAll(x => new ValueTuple <ushort, ushort, ushort>(x.Item1, x.Item2, x.Item3));
     Updates    = new List <ValueTuple <ushort, ushort, ushort> >();
     Dimensions = new ValueTuple <ushort, ushort, ushort>(size.Item1, size.Item2, size.Item3);
     Cells      = new CAGraphCell[size.Item1, size.Item2, size.Item3];
     for (ushort i = 0; i < size.Item1; i++)
     {
         for (ushort j = 0; j < size.Item2; j++)
         {
             for (ushort k = 0; k < size.Item3; k++)
             {
                 //if(i == 500 && j == 500)
                 //{
                 //    Console.WriteLine();
                 //}
                 Cells[i, j, k] = cells[i, j, k].Copy(this);
             }
         }
     }
 }
        public CAGraphCellAgent Copy(CAGraphCell cell)
        {
            var agent = new CAGraphCellAgent(cell, this.Properties);

            return(agent);
        }
 public CAGraphCellAgent(CAGraphCell parent, Dictionary <string, dynamic> properties) : base(CAEntityType.Agent, properties)
 {
     this.Parent = parent;
 }
        //System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

        public CAGraphCellAgent(CAGraphCell parent, ushort state) : base(CAEntityType.Agent)
        {
            this.Parent = parent;
            AddProperty(("state", state));
        }
        public CAGraphCell Copy(CAGraph graph)
        {
            var cell = new CAGraphCell(graph, this.Position, this.Properties, this.Agent);

            return(cell);
        }