public static double CountActivation(PojazdPolozenie vehicle, List <int> xGroup, List <int> yGroup, List <int> angleGroup) { var xActivation = GetGroupActivation(xGroup, vehicle.x); var yActivation = GetGroupActivation(yGroup, vehicle.y); var angleActivation = GetGroupActivation(angleGroup, vehicle.kat); if (xActivation > yActivation) { if (yActivation > angleActivation) { return(angleActivation); } else { return(yActivation); } } else { if (xActivation > angleActivation) { return(angleActivation); } else { return(xActivation); } } }
public static void zwroc_odpowiedz(PojazdPolozenie polozenie, out int obrot) { List <double> activations = new List <double>(); foreach (var XGroup in XGroups.Select(g => g.Value)) { foreach (var YGroup in YGroups.Select(g => g.Value)) { foreach (var AngleGroup in AngleGroups.Select(g => g.Value)) { var activation = CountActivation(polozenie, XGroup, YGroup, AngleGroup); activations.Add(activation); } } } double activationSpinCalculus = 0; for (int i = 0; i < activations.Count; i++) { activationSpinCalculus += spins[i] * activations[i]; } var sum = activations.Sum(); var toReturn = activationSpinCalculus / sum; obrot = (int)toReturn; }