예제 #1
0
    //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);
    }
예제 #2
0
 public bool ValidAtIndex(DirectionCoord coord)
 {
     return(_self[coord.X + 1, coord.Y + 1] >= 1 ? true : false);
 }
예제 #3
0
                public bool ValidAtIndex(Directions dir)
                {
                    Vector2 __coord = DirectionCoord.Coordinates(dir);

                    return(_self[(int)__coord.x + 1, (int)__coord.y + 1] >= 1 ? true : false);
                }