multimodalart HF Staff commited on
Commit
18d1836
·
verified ·
1 Parent(s): 0d88e1f

Raise match sub-step budget so first-to-2 matches finish; report result row

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -81,9 +81,9 @@ GAME_IFRAME = (
81
  SC = 0.8 # render scale: 800x500 table -> 640x400 video
82
  VW, VH = int(800 * SC), int(500 * SC)
83
  FPS = 40 # one frame per physics sub-step == real time
84
- MAX_FRAMES = 1600 # hard cap on rendered frames (40 s at 40 fps)
85
  POINT_SUBSTEP_CAP = 4500 # == the author's 1500-step rally limit
86
- MATCH_SUBSTEP_CAP = 4800 # keeps playback speed at 3x or below
87
  MAX_POINTS = 12 # safety net against endless draw sequences
88
 
89
 
@@ -224,12 +224,15 @@ def watch_match(opponent_name: str, points_to_win: int = 2,
224
  stride = max(1, math.ceil(len(states) / MAX_FRAMES))
225
  speed_label = "real time" if stride == 1 else f"{stride}x speed"
226
 
227
- if score_a > score_b:
228
- banner = f"MR. PONG WINS {score_a}-{score_b}"
229
- elif score_b > score_a:
 
230
  banner = f"{opponent_name.upper()} WINS {score_b}-{score_a}"
 
231
  else:
232
  banner = f"{score_a}-{score_b} — TIME LIMIT"
 
233
 
234
  t1 = time.perf_counter()
235
  frames, trail = [], []
@@ -252,6 +255,7 @@ def watch_match(opponent_name: str, points_to_win: int = 2,
252
  stats = (
253
  f"### Mr. Pong **{score_a} – {score_b}** {opponent_name}\n"
254
  f"| | |\n|---|---|\n"
 
255
  f"| Points played | {len(rallies)} |\n"
256
  f"| Longest rally | {max(rallies)} hits |\n"
257
  f"| Average rally | {np.mean(rallies):.1f} hits |\n"
 
81
  SC = 0.8 # render scale: 800x500 table -> 640x400 video
82
  VW, VH = int(800 * SC), int(500 * SC)
83
  FPS = 40 # one frame per physics sub-step == real time
84
+ MAX_FRAMES = 1400 # hard cap on rendered frames (35 s at 40 fps)
85
  POINT_SUBSTEP_CAP = 4500 # == the author's 1500-step rally limit
86
+ MATCH_SUBSTEP_CAP = 12000 # enough for a first-to-2 to finish vs any beatable baseline
87
  MAX_POINTS = 12 # safety net against endless draw sequences
88
 
89
 
 
224
  stride = max(1, math.ceil(len(states) / MAX_FRAMES))
225
  speed_label = "real time" if stride == 1 else f"{stride}x speed"
226
 
227
+ decided = max(score_a, score_b) >= points_to_win
228
+ if decided and score_a > score_b:
229
+ banner, result = f"MR. PONG WINS {score_a}-{score_b}", "Mr. Pong takes the match"
230
+ elif decided:
231
  banner = f"{opponent_name.upper()} WINS {score_b}-{score_a}"
232
+ result = f"{opponent_name} takes the match"
233
  else:
234
  banner = f"{score_a}-{score_b} — TIME LIMIT"
235
+ result = "stopped at the clip time limit (no side reached the target)"
236
 
237
  t1 = time.perf_counter()
238
  frames, trail = [], []
 
255
  stats = (
256
  f"### Mr. Pong **{score_a} – {score_b}** {opponent_name}\n"
257
  f"| | |\n|---|---|\n"
258
+ f"| Result | {result} |\n"
259
  f"| Points played | {len(rallies)} |\n"
260
  f"| Longest rally | {max(rallies)} hits |\n"
261
  f"| Average rally | {np.mean(rallies):.1f} hits |\n"