Found the issue. Rather obvious actually... Since lists are mutable I change newPairings and bestPairings when doing pairings.pop() . My easyfix was to change newPairings = self.calculateTotalPenalty(newPairings)
newPairings = self.calculateTotalPenalty(newPairings).copy()
Annoying little bug.
I am trying to develop a swiss tournament pairing algorithm and I am essentially using a backtracking algorithm that gives a value for each terminal position based on how well it has matched the players. It seems to mostly be working but it will for some reason allow an empty pairing list with a...