sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from cobradraughts.core.DraughtsBrain import DraughtsBrain weights1 = {'PIECE':400, 'KING':1200, 'BACK':10, 'KBACK':10, 'CENTER':30, 'KCENTER':30, 'FRONT':60, 'KFRONT':60, 'MOB':0} weights2 = {'PIECE':400, 'KING':800, 'BACK':40, 'KBACK':40, 'CENTER':40, 'KCENTER':40, 'FRONT':60, 'KFRONT':60, 'MOB':0} # This is an usage example. It's easy! D = DraughtsBrain(weights1, 2, weights2,verbose=True) D.run_self() print("The winner is %s!" % D.winner)
weights2 = {'PIECE':400, 'KING':800, 'BACK':40, 'KBACK':40, 'CENTER':40, 'KCENTER':40, 'FRONT':60, 'KFRONT':60, 'MOB':0} # This is an usage example. It's easy! counter = 0 draws = 0 average = float(0) for value in range(100): D = DraughtsBrain(weights1, 4, weights2,verbose=False) t1 = time.time() D.run_self() t2 = time.time() average = (((average * value) + (t2 - t1)) / float(value + 1)) #print '%s took %0.3f ms' % ("game", (t2-t1)*1000.0) if D.winner == 'DARK': counter = counter + 1 if D.winner == 'DRAW': draws = draws + 1 print("non killer") print(average) print(draws) print(counter) counter = 0 draws = 0