From 816b3bfc277dbdde0716fcd8946bb13440d67767 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Wed, 23 Feb 2022 22:30:36 +0100 Subject: show bot stderr --- web/pw-server/src/lib/components/OutputPane.svelte | 48 ++++++++++++++++++++++ web/pw-server/src/lib/components/SubmitPane.svelte | 31 ++++++++++++++ web/pw-server/src/lib/components/Visualizer.svelte | 13 +++++- 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 web/pw-server/src/lib/components/OutputPane.svelte create mode 100644 web/pw-server/src/lib/components/SubmitPane.svelte (limited to 'web/pw-server/src/lib/components') diff --git a/web/pw-server/src/lib/components/OutputPane.svelte b/web/pw-server/src/lib/components/OutputPane.svelte new file mode 100644 index 0000000..c72a22e --- /dev/null +++ b/web/pw-server/src/lib/components/OutputPane.svelte @@ -0,0 +1,48 @@ + + +
+ {#if botStdErr.length > 0} +

stderr:

+
+ {botStdErr} +
+ {/if} +
+ + diff --git a/web/pw-server/src/lib/components/SubmitPane.svelte b/web/pw-server/src/lib/components/SubmitPane.svelte new file mode 100644 index 0000000..eb4d3e4 --- /dev/null +++ b/web/pw-server/src/lib/components/SubmitPane.svelte @@ -0,0 +1,31 @@ + + +
+ Submit your bot to play a match + +
+ + diff --git a/web/pw-server/src/lib/components/Visualizer.svelte b/web/pw-server/src/lib/components/Visualizer.svelte index d53eb36..1e8d09f 100644 --- a/web/pw-server/src/lib/components/Visualizer.svelte +++ b/web/pw-server/src/lib/components/Visualizer.svelte @@ -19,10 +19,21 @@ if (matchLog === null) { visualizer.set_loading(true); } else { - visualizer.set_instance(matchLog); + console.log(matchLog); + let instanceLog = extractGameStates(matchLog); + visualizer.set_instance(instanceLog); visualizer.set_loading(false); } } + + function extractGameStates(matchLog: string): string { + // TODO: find a better way to do this + return matchLog + .split("\n") + .slice(0, -1) + .filter((line) => JSON.parse(line)["type"] == "gamestate") + .join("\n"); + }
-- cgit v1.2.3