//Evaluation private int ReEvaluateAdjacency(ref Agent agent) { int __adjFitness = 0; int __directionSize = System.Enum.GetNames(typeof(Directions)).Length; for (int i = 0; i < agent.Count; i++) { for (int j = 0; j < agent[i].Count; j++) { InterestMatrix __adjMatrix = new InterestMatrix(agent[i][j].type); __adjMatrix = InterestMatrix.RotateMatrix(__adjMatrix, (int)agent[i][j].direction); for (int direction = 0; direction < __directionSize; direction++) { DirectionCoord __direction = new DirectionCoord((Directions)i); if (__adjMatrix.ValidAtIndex(__direction)) { if (i + __direction.X >= 0 && i + __direction.X < agent.Count) { if (j + __direction.Y >= 0 && j + __direction.Y < agent[i].Count) { __adjFitness += ScoreAdjacency(agent[i][j], agent[i + __direction.X][j + __direction.Y], __direction.Dir, true); } } } } } } return(__adjFitness); }
public bool ValidAtIndex(DirectionCoord coord) { return(_self[coord.X + 1, coord.Y + 1] >= 1 ? true : false); }
public bool ValidAtIndex(Directions dir) { Vector2 __coord = DirectionCoord.Coordinates(dir); return(_self[(int)__coord.x + 1, (int)__coord.y + 1] >= 1 ? true : false); }