I'd be interested in the distance in squares from the marshall to the flag.

I found the distance the marshal has to travel to capture his own flag. So if the flag was in the bottom left corner and the marshal was in the top right corner, it would take the marshal 12 moves to get to his flag. Just subtract 1 from the averages if you want to know how many moves to get next to a piece.

Average distance for Marshal to take Flag:

total game setups analyze 84956

sum of all distances 351350

average distance away 4.135670229295164

Average distance for General to take Flag: 4.952834408399642

Average distance for Spy to take Flag: 4.184201233579736

Average distance for General to take Spy: 2.4310937426432506

Average distance for Marshal to take Spy: 3.6485592542021754

Average distance for Marshal to take General: 3.954505861857903

Here's the python code:

def moves(x, y):

x1 = x[0]

x2 = x[1]

y1 = y[0]

y2 = y[1]

answer = abs(x1 - y1) + abs(x2 - y2)

return(answer)

gameboard = {0: (0, 0), 1: (0, 1), 2: (0, 2), 3: (0, 3), 4: (0, 4), 5: (0, 5), 6: (0, 6), 7: (0, 7), 8: (0, 8), 9: (0, 9), 10: (1, 0), 11: (1, 1), 12: (1, 2), 13: (1, 3), 14: (1, 4), 15: (1, 5), 16: (1, 6), 17: (1, 7), 18: (1, 8), 19: (

1, 9), 20: (2, 0), 21: (2, 1), 22: (2, 2), 23: (2, 3), 24: (2, 4), 25: (2, 5), 26: (2, 6), 27: (2, 7), 28: (2, 8), 29: (2, 9), 30: (3, 0), 31: (3, 1), 32: (3, 2), 33: (3, 3), 34: (3, 4), 35: (3, 5), 36: (3, 6), 37: (3, 7), 38: (3, 8), 39: (3, 9)}

numgames = 0

sumdis = 0

with open('test.txt', 'r') as f:

for line in f:

numgames += 1

flag = (line.index("M"))

mar = (line.index("L"))

x = gameboard[flag]

y = gameboard[mar]

print(x, y)

distance = moves(x, y)

sumdis = sumdis + distance

print("total game setups analyze ", numgames)

print("sum of all distances ", sumdis)

print("average distance away ", sumdis / numgames)

Here's a link to the data file. It takes awhile to load. Then you can run the python script on the file.

M = Flag

L = Marshal

K = General

C = Spy

**Edited by Dobby125, 29 August 2016 - 01:04 PM.**