Next, here is a code for the second exercise. When a square is printed type the 'brother' or 'corresponding' square and click enter.
from random import choice
from time import time
files = ['a','b','c','d','e','f','g','h']
rank = [str(i+1) for i in range(8)]
coordinates = {}
for i in range(8):
for j in range(8):
exec('coordinates.update('+files[i]+rank[j]+'=\''+files[7-i]+rank[7-j]+'\')')
print 'enter the corresponding square to the square printed'
start_time = time()
for i in range(15):
tmp = choice(coordinates.keys())
ans = coordinates[tmp]
Bogoliubon = 0
while Bogoliubon != ans:
Bogoliubon = raw_input(tmp+" ")
end_time = time()
print 'exercise finished in ', end_time-start_time, ' seconds.'
from random import choice
from time import time
files = ['a','b','c','d','e','f','g','h']
rank = [str(i+1) for i in range(8)]
coordinates = {}
for i in range(8):
for j in range(8):
exec('coordinates.update('+files[i]+rank[j]+'=\''+files[7-i]+rank[7-j]+'\')')
print 'enter the corresponding square to the square printed'
start_time = time()
for i in range(15):
tmp = choice(coordinates.keys())
ans = coordinates[tmp]
Bogoliubon = 0
while Bogoliubon != ans:
Bogoliubon = raw_input(tmp+" ")
end_time = time()
print 'exercise finished in ', end_time-start_time, ' seconds.'