예제 #1
0
    Vector2 MutateInput(Vector2 inputToMutate, InputEvaluation eval)
    {
        switch (eval)
        {
        case InputEvaluation.facingWall:
            return(Vector2.zero);

        case InputEvaluation.wallToRight:
            return(inputToMutate.Rotate(degreesPerInputMutation));

        case InputEvaluation.wallToLeft:
            return(inputToMutate.Rotate(-degreesPerInputMutation));

        case InputEvaluation.valid:
            print("trying to mutate valid input");
            return(inputToMutate);

        default:
            throw new ArgumentOutOfRangeException(nameof(eval), eval, null);
        }
    }
예제 #2
0
 void TestInput(Vector2 thisInput)
 {
     if (testsThisFrame < maxTestsPerFrame)
     {
         testsThisFrame++;
         // distances = CastRays(GetRays(thisInput));
         currentInputEvaluation = EvaluateInput(distances);
         if (currentInputEvaluation == InputEvaluation.valid)
         {
             currentInput = thisInput;
         }
         else
         {
             TestInput(MutateInput(thisInput, currentInputEvaluation));
         }
     }
     else
     {
         print("reached max tests per frame");
         currentInput = thisInput;
     }
 }