public static double CalculateHarmoniousness(List <NeatPlayer> players) { var outputs = FitnessUtils.GetPitchOutput(players); var inputs = FitnessUtils.GetPitchInput(); int fitness = PERFECT_PITCH_SCORE; int outOfKey = OutOfKey(outputs) * 10; fitness -= outOfKey; int badPitch = BadPitch(outputs, inputs); fitness -= badPitch; int sameNote = SameNote(outputs) * 100; fitness -= sameNote; int idInput = IdentityInput(inputs, outputs) * 15; int idOutput = IdentityModules(outputs) * 10; fitness -= idOutput; fitness -= idInput; int tooBigGap = TooBigGap(outputs) * 10; fitness -= tooBigGap; return(fitness); }
public static double CalculateHarmoniousness(List <NeatPlayer> players) { var outputs = FitnessUtils.GetPitchOutput(players); var inputs = FitnessUtils.GetPitchInput(); int fitness = PERFECT_PITCH_SCORE; int outOfKey = OutOfKey(outputs) * 10; fitness -= outOfKey; int badPitch = BadPitch(outputs, inputs) * 100; fitness -= badPitch; int sameNote = SameNote(outputs) * 10; fitness -= sameNote; //////// //////////discourage the modules from playing the same things int idInput = IdentityInput(inputs, outputs) * 15; int idOutput = IdentityModules(outputs) * 10; fitness -= idOutput; fitness -= idInput; //////makes modules play in a hierarchy //////NOTE: Probably broken - module position in the fitness function isn't fixed, which this function assumes int lower = LowerThanPrevious(outputs); fitness -= lower; //// //////make sure the gap to the previous note is less than 7 semitones int tooBigGap = TooBigGap(outputs) * 10; fitness -= tooBigGap; int dissonanceInput = DissonanceInput(inputs, outputs) * 5; int dissonanceOutput = DissonanceModules(outputs) * 5; fitness -= dissonanceInput; fitness -= dissonanceOutput; int chord = Chord(outputs, FitnessUtils.GetChords()) * 5; fitness -= chord; return(fitness); }
public static double CalculateHarmoniousness(List <NeatPlayer> players) { var outputs = FitnessUtils.GetPitchOutput(players); var inputs = FitnessUtils.GetPitchInput(); int fitness = PERFECT_PITCH_SCORE; int outOfKey = OutOfKey(outputs) * 20; fitness -= outOfKey; int badPitch = BadPitch(outputs, inputs); fitness -= badPitch; int sameNote = SameNote(outputs) * 25; fitness -= sameNote; int idInput = IdentityInput(inputs, outputs) * 10; int idOutput = IdentityModules(outputs) * 5; fitness -= idOutput; fitness -= idInput; int tooBigGap = TooBigGap(outputs) * 10; fitness -= tooBigGap; int dissonanceInput = DissonanceInput(inputs, outputs) * 5; int dissonanceOutput = DissonanceModules(outputs) * 5; fitness -= dissonanceInput; fitness -= dissonanceOutput; int chord = Chord(outputs, FitnessUtils.GetChords()) * 10; fitness -= chord; int belowInput = BelowInput(inputs, outputs) * 5; fitness -= belowInput; return(fitness); }