-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchess.py
27 lines (22 loc) · 782 Bytes
/
chess.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import time
my_compute_time = 5
opponent_compute_time = 55
opponents = 24
move_pairs = 30
def main(x):
# Loops 30 times to simulate both players making a move
for i in range(move_pairs):
print(f"Thinking of making a move on board {x}")
# We think for 5 seconds
time.sleep(my_compute_time)
print(f"Made a move on board {x}.")
# The opponent thinks for 5 seconds.
time.sleep(opponent_compute_time)
print(f"Opponent made move on board {x}")
print(f"Finished board {x}")
if __name__ == "__main__":
start_time = time.perf_counter()
# Loops 24 times because we are playing 24 opponents.
for j in range(opponents):
main(j)
print(f"Finished in {round(time.perf_counter() - start_time)} secs")