Skip to content

Commit

Permalink
Fix IndexError
Browse files Browse the repository at this point in the history
  • Loading branch information
gbtami committed Jan 10, 2025
1 parent e6c1f9d commit 1493c89
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions server/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,22 +1055,10 @@ def create_steps(self):

if len(self.clocks_w) > 1 and not self.corr:
move_number = ((ply + 1) // 2) + (1 if ply % 2 == 0 else 0)
if ply >= 2:
if ply % 2 == 0:
step["clocks"] = (
self.clocks_w[move_number],
self.clocks_b[move_number - 1],
)
else:
step["clocks"] = (
self.clocks_w[move_number],
self.clocks_b[move_number],
)
else:
step["clocks"] = (
self.clocks_w[move_number],
self.clocks_b[move_number],
)
step["clocks"] = (
self.clocks_w[move_number],
self.clocks_b[move_number - 1 if ply % 2 == 0 else move_number],
)

self.steps.append(step)

Expand Down

0 comments on commit 1493c89

Please sign in to comment.