Commits

mcc  committed d7711ff

If an entire generation is impossible to complete, use the last winnable ancestor as winner1

  • Participants
  • Parent commits 1139f1c

Comments (0)

Files changed (1)

File server/server.py

 						return cmp(x.deaths, y.deaths)
 					return cmp(x.lastf, y.lastf) # Last ditch
 				sorted_old_specs_list = sorted(old_specs_list, cmp=fitness)
-				winner1 = sorted_old_specs_list[0]
-				winner2 = sorted_old_specs_list[1]
+				if sorted_old_specs_list[0].checked and sorted_old_specs_list[0].won:
+					winner1 = sorted_old_specs_list[0]
+					winner2 = sorted_old_specs_list[1]
+				else:
+					winner1 = self.last_valid
+					winner2 = randomfrom(sorted_old_specs_list)
 				candidate_specs_list = []
 				candidate_specs = {}
 				if options.debug > 1:
 					history_file.write(lo.toxml())
 					history_file.write("\n")
 					history_file.flush()
+					
 				candidate_specs_list.reverse()
 				new_specs_list = candidate_specs_list
 				new_specs = candidate_specs
+				self.last_valid = winner1
 			finally:
 				self.specs_stack = new_specs_list
 				self.specs = new_specs