Fix: indent await send(full, peer) inside STATE_FULL if block to resolve SyntaxError
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from __future__ import annotations
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from dataclasses import dataclass
|
||||
@@ -136,7 +136,7 @@ class GameServer:
|
||||
# --- Simulation ---
|
||||
|
||||
def _consume_input_for_snake(self, s: Snake) -> None:
|
||||
# Consume at most one input; skip 180° turns when length>1
|
||||
# Consume at most one input; skip 180° turns when length>1
|
||||
while s.input_buf:
|
||||
nd = s.input_buf[0]
|
||||
# 180-degree check
|
||||
@@ -452,7 +452,7 @@ class GameServer:
|
||||
full = pack_header(
|
||||
self.runtime.version, PacketType.STATE_FULL, 0, self.runtime.next_seq(), self.runtime.state.tick & 0xFFFF
|
||||
) + body
|
||||
await self.transport.send(full, peer)
|
||||
await self.transport.send(full, peer)
|
||||
else:
|
||||
# Partition by packing whole snakes first, apples only in first part; chunk a single oversized snake using 2-bit chunks
|
||||
update_id = self.runtime.next_update_id()
|
||||
@@ -507,7 +507,7 @@ class GameServer:
|
||||
dir_capacity_bytes = max(0, budget - overhead)
|
||||
if dir_capacity_bytes <= 0:
|
||||
break
|
||||
# Convert capacity bytes to number of directions (each 2 bits → 4 dirs per byte)
|
||||
# Convert capacity bytes to number of directions (each 2 bits → 4 dirs per byte)
|
||||
dir_capacity = dir_capacity_bytes * 4
|
||||
if dir_capacity <= 0:
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user