|  | @@ -0,0 +1,53 @@
 | 
	
		
			
				|  |  | +import subprocess
 | 
	
		
			
				|  |  | +import time
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +def do_timing():
 | 
	
		
			
				|  |  | +    bis = subprocess.Popen(['cargo', 'run', '--release'], 
 | 
	
		
			
				|  |  | +                            stdout=subprocess.PIPE,
 | 
	
		
			
				|  |  | +                            stdin=subprocess.PIPE)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    bis.stdin.write(b'isready\n')
 | 
	
		
			
				|  |  | +    bis.stdin.flush()
 | 
	
		
			
				|  |  | +    for line in bis.stdout:
 | 
	
		
			
				|  |  | +        if line[:7] == b'readyok':
 | 
	
		
			
				|  |  | +            break
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    bis.stdin.write(b'position fen r3kb1r/pppqn1p1/2n4p/5b2/3PQ3/5NP1/PPP2PBP/R1B2RK1 w kq - 1 13\n')
 | 
	
		
			
				|  |  | +    bis.stdin.write(b'go depth 8\n')
 | 
	
		
			
				|  |  | +    bis.stdin.flush()
 | 
	
		
			
				|  |  | +    start = time.time()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    for line in bis.stdout:
 | 
	
		
			
				|  |  | +        print("line: " + str(line))
 | 
	
		
			
				|  |  | +        if line[:8] == b'bestmove':
 | 
	
		
			
				|  |  | +            break
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    bis.stdin.write(b'position fen 3r4/2p2r1k/p5p1/Pp5p/3BRP2/bqP4P/6PK/2Q1R3 w - - 6 40\n')
 | 
	
		
			
				|  |  | +    bis.stdin.write(b'go depth 7\n')
 | 
	
		
			
				|  |  | +    bis.stdin.flush()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    for line in bis.stdout:
 | 
	
		
			
				|  |  | +        print("line: " + str(line))
 | 
	
		
			
				|  |  | +        if line[:8] == b'bestmove':
 | 
	
		
			
				|  |  | +            break
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    bis.stdin.write(b'position fen 8/6k1/7N/5p2/1R1P1B1P/2P5/4PP1P/6K1 w - - 0 52\n')
 | 
	
		
			
				|  |  | +    bis.stdin.write(b'go depth 9\n')
 | 
	
		
			
				|  |  | +    bis.stdin.flush()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    for line in bis.stdout:
 | 
	
		
			
				|  |  | +        print("line: " + str(line))
 | 
	
		
			
				|  |  | +        if line[:8] == b'bestmove':
 | 
	
		
			
				|  |  | +            break
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +    end = time.time()
 | 
	
		
			
				|  |  | +    return end - start
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +measure = 0
 | 
	
		
			
				|  |  | +nMes = 3
 | 
	
		
			
				|  |  | +for i in range(0, nMes):
 | 
	
		
			
				|  |  | +    measure = measure + do_timing()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +measure = measure / nMes
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +print(f"finished in {round(measure, 3)} s")
 |