def main(): filename = '' while filename != 'quit': try: filename = input('>') cgw.showReplay('noteworthy/' + filename) except IOError as e: try: cfw.showReplay('noteworthy/' + filename) except IOError as f: try: cgw.showReplay(filename) except IOError as g: try: cfw.showReplay(filename) except IOError as h: print("Couldn't find file " + filename) except SyntaxError: print("Use quotes!") except NameError: print("Use quotes!")
def compete(p1, p2, display = False, recordThis = False, filename = '', time = 1000, fitnessFunction = ffSimple): result = CubeFightingWorld.simulateCompetition(p1.dna, p2.dna, display, recordThis, filename, time) fits = fitnessFunction(result[0], result[1]) p1.fitness = p1.fitness + fits[0] p2.fitness = p2.fitness + fits[1] return (fits[0], fits[1], result[2])
def playReplay2(filename): CubeFightingWorld.showReplay(filename)