List <double> Run(double bx, double by, double bvx, double bvy, double px, double py, double pv, bool train) { List <double> inputs = new List <double>(); List <double> outputs = new List <double>(); inputs.Add(bx); inputs.Add(by); inputs.Add(bvx); inputs.Add(bvy); inputs.Add(px); inputs.Add(py); outputs.Add(pv); if (train) { return(ann.Train(inputs, outputs)); } else { return(ann.CalcOutput(inputs, outputs)); } }
/// <summary> /// Run the perceptron work /// </summary> /// <param name="ballX"></param> /// <param name="ballY"></param> /// <param name="ballVelocityX"></param> /// <param name="ballVelocityY"></param> /// <param name="paddleX"></param> /// <param name="paddleY"></param> /// <param name="paddleVelocity"></param> /// <param name="train"></param> /// <returns></returns> List <double> Run(double ballX, double ballY, double ballVelocityX, double ballVelocityY, double paddleX, double paddleY, double paddleVelocity, bool train) { List <double> inputs = new List <double>(); List <double> outputs = new List <double>(); inputs.Add(ballX); inputs.Add(ballY); inputs.Add(ballVelocityX); inputs.Add(ballVelocityY); inputs.Add(paddleX); inputs.Add(paddleY); outputs.Add(paddleVelocity); if (train) { return(ann.Train(inputs, outputs)); } else { return(ann.CalcOutput(inputs, outputs)); } }