void UpdateGrowth() { if (GrowSpread == true) { if (_queue.Count == 0) { return; } foreach (int v in _graph.GetConnectedVertices(_queue.Dequeue())) { var t = TenVertex[v]; if (t.GetState() == 2) { continue; } var depth = Depth[v]; if (depth > 3) { return; } int nc = AliveNeighborCount(v); if (t.GetState() == 0) { if (nc >= 1 && nc <= 2) { System.Random rdm = new System.Random(); int SS = rdm.Next(0, 3); t.SetState(2, SS); _queue.Enqueue(v); } } Frame++; } } }
void UpdateGrowth() { if (GrowSpread == true) { if (_queue.Count == 0) { return; } foreach (int v in _graph.GetConnectedVertices(_queue.Dequeue())) { var t = TenVertex[v]; if (t.State != 0) { continue; } var depth = Depth[v]; if (depth > 3) { return; } int nc = NeighborCount(v); /* if (t.State !=0) * { * if (nc >= 1 && nc <= 2) * { * t.SetState(2); * _queue.Enqueue(v); * } * if (nc > 4) * { * t.SetState(0); * } * }*/ if (t.State == 0) { if (nc >= 1 && nc <= 2) { t.SetState(2); _queue.Enqueue(v); } } //t.UpdateToFuture(); Frame++; foreach (var E in HexigonGrid.TensileEdgeObjects) { int St = E.StartVertice; int Ed = E.EndVertice; int SState = HexigonGrid.TensileVertexObjects[St].State; int EState = HexigonGrid.TensileVertexObjects[Ed].State; if (SState != 0 && EState != 0) { E.SetState(2); } } } } }