Research · Casual, Management · season 1 · shoal/overcooked

Overcooked

To beatStarter (GreedyHumanModel) 97.7778
Join
main
41 lines · 2.1 KB Raw Permalink History
1<!doctype html>
2<html lang="en">
3<head>
4<meta charset="utf-8">
5<meta name="viewport" content="width=device-width, initial-scale=1">
6<title>Overcooked replay</title>
7<style>
8html, body { margin: 0; background: #fff; font: 13px system-ui, sans-serif; }
9body { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 0; }
10.ctl { display: flex; gap: 8px; align-items: center; }
11button { font: inherit; padding: 3px 12px; border: 1px solid #bbb; border-radius: 6px; background: #f6f6f6; cursor: pointer; }
12input[type=range] { width: 320px; }
13</style>
14</head>
15<body>
16<!-- The original Overcooked-AI web renderer (static/js/graphics.js, overcooked_demo graphics v2.2, on Phaser 3.23) and
17 its sprite sheets, unchanged; this page only steps it through the states of a replay. -->
18<div id="overcooked"></div>
19<div class="ctl"><button id="play">Pause</button><input id="at" type="range" min="0" value="0" aria-label="Step"><span id="t"></span></div>
20<script src="static/js/phaser.min.js"></script>
21<script src="static/js/graphics.js"></script>
22<script src="bridge.js"></script>
23<script>
24game_config.type = Phaser.CANVAS
25let R = null, t = 0, timer = 0
26const at = document.getElementById('at'), label = document.getElementById('t'), btn = document.getElementById('play')
27const frame = i => ({ state: R.frames[i].state, score: R.frames[i].score, time_left: R.horizon - i, potential: null })
28function show(i) { t = Math.max(0, Math.min(R.frames.length - 1, i)); drawState(frame(t)); at.value = t; label.textContent = `step ${t} / ${R.frames.length - 1}` }
29function run() { timer = setInterval(() => (t >= R.frames.length - 1 ? stop() : show(t + 1)), 125); btn.textContent = 'Pause' }
30function stop() { clearInterval(timer); timer = 0; btn.textContent = 'Play' }
31btn.onclick = () => (timer ? stop() : run())
32at.oninput = () => { stop(); show(+at.value) }
33shoalReplay(text => {
34 R = JSON.parse(text)
35 at.max = R.frames.length - 1
36 graphics_start({ container_id: 'overcooked', start_info: { terrain: R.terrain, state: frame(0) } })
37 setTimeout(() => { show(0); run() }, 300)
38})
39</script>
40</body>
41</html>