remote_fireball: a slow fireball, sampled from one ctl process
The harness sampled the fireball from a new horizon-ctl process each time, 10-16 ticks apart on a loaded runner: the fireball (~2 blocks a tick) left the cleared corridor or the guest's tracking range before the sixth sample, and the harness failed. It now flies slowly (acceleration_power 0.02, under 0.4 blocks a tick) down a longer corridor, and the guest takes 16 samples in one ctl script (lan_e2e's Game.script returns every reply with every=True). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+4
-3
@@ -339,8 +339,9 @@ class Game:
|
||||
def wait(self, ticks):
|
||||
self.d('wait', ticks=ticks)
|
||||
|
||||
def script(self, lines):
|
||||
"""Keep tick-sensitive input in one ctl process, through the normal control commands."""
|
||||
def script(self, lines, every=False):
|
||||
"""Keep tick-sensitive input in one ctl process, through the normal control commands. Returns the last
|
||||
reply, or with every=True all of them in order."""
|
||||
result = subprocess.run(self.d.base + ['script'], input='\n'.join(lines) + '\n',
|
||||
cwd=self.work, env=self.d.env, capture_output=True, text=True,
|
||||
timeout=600)
|
||||
@@ -348,7 +349,7 @@ class Game:
|
||||
ticks = [r['ticks'] for r in replies if 'ticks' in r]
|
||||
print(f'[{self.name}] script {lines} -> {replies[-1] if replies else result.stderr[:400]}; ticks={ticks}')
|
||||
assert result.returncode == 0 and replies and not any('error' in r for r in replies), result.stdout
|
||||
return replies[-1]
|
||||
return replies if every else replies[-1]
|
||||
|
||||
def until(self, observe, predicate, ticks=100):
|
||||
"""Wait for an observable answer, within the existing tick budget."""
|
||||
|
||||
@@ -18,15 +18,19 @@ def check_motion(host, guest, out):
|
||||
for game in (host, guest):
|
||||
game('command', command='gamemode creative')
|
||||
tag = 'remote_fireball_parity'
|
||||
host('command', command=f'fill {x + 2} {y + 18} {z - 1} {x + 48} {y + 23} {z + 1} minecraft:air')
|
||||
# A slow fireball (acceleration_power 0.02: under 0.4 blocks a tick, against ~2 by default) stays in the cleared
|
||||
# corridor and in the guest's tracking range for every sample, however many ticks a loaded host takes to answer.
|
||||
host('command', command=f'fill {x + 2} {y + 18} {z - 1} {x + 96} {y + 23} {z + 1} minecraft:air')
|
||||
host('command', command=f'summon minecraft:fireball {x + 3.5} {y + 20} {z + 0.5} '
|
||||
f'{{Tags:["{tag}"],Motion:[0.1d,0.0d,0.0d]}}')
|
||||
f'{{Tags:["{tag}"],Motion:[0.1d,0.0d,0.0d],acceleration_power:0.02d}}')
|
||||
samples = []
|
||||
try:
|
||||
for _ in range(8):
|
||||
balls = [p for p in guest('status')['projectiles'] if p['kind'] == 'LargeFireball']
|
||||
# One ctl process for all samples: a ctl process per sample took 10-16 ticks on a loaded runner, by
|
||||
# which time the fireball had left the cleared corridor and exploded.
|
||||
replies = guest.script(['status', 'wait 1'] * 16, every=True)
|
||||
for status in (reply for reply in replies if 'projectiles' in reply):
|
||||
balls = [p for p in status['projectiles'] if p['kind'] == 'LargeFireball']
|
||||
samples.append(balls[0]['position'][0] if balls else None)
|
||||
guest.wait(2)
|
||||
finally:
|
||||
host('command', command=f'kill @e[tag={tag}]')
|
||||
seen = [p for p in samples if p is not None]
|
||||
|
||||
Reference in New Issue
Block a user