code-battles 1.5.8 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +3 -3
- package/dist/code_battles/__init__.py +31 -0
- package/dist/code_battles/__pycache__/__init__.cpython-312.pyc +0 -0
- package/dist/code_battles/__pycache__/battles.cpython-312.pyc +0 -0
- package/dist/code_battles/__pycache__/utilities.cpython-312.pyc +0 -0
- package/dist/code_battles/battles.py +1024 -0
- package/dist/code_battles/js.pyi +136 -0
- package/dist/code_battles/pyodide/ffi/__init__.pyi +2 -0
- package/dist/code_battles/pyscript/__init__.pyi +4 -0
- package/dist/code_battles/pyscript/ffi/__init__.pyi +3 -0
- package/dist/code_battles/utilities.py +327 -0
- package/dist/esm/index.js +3 -3
- package/dist/pyscript/codemirror-BEtcgaoQ.js +2 -0
- package/dist/pyscript/codemirror-BEtcgaoQ.js.map +1 -0
- package/dist/pyscript/codemirror_commands-DDxffOmd.js +2 -0
- package/dist/pyscript/codemirror_commands-DDxffOmd.js.map +1 -0
- package/dist/pyscript/codemirror_lang-python-CnWnFqxD.js +2 -0
- package/dist/pyscript/codemirror_lang-python-CnWnFqxD.js.map +1 -0
- package/dist/pyscript/codemirror_language-CjmvX4ix.js +2 -0
- package/dist/pyscript/codemirror_language-CjmvX4ix.js.map +1 -0
- package/dist/pyscript/codemirror_state-D1qTXrff.js +2 -0
- package/dist/pyscript/codemirror_state-D1qTXrff.js.map +1 -0
- package/dist/pyscript/codemirror_view-DVb8uYMr.js +2 -0
- package/dist/pyscript/codemirror_view-DVb8uYMr.js.map +1 -0
- package/dist/pyscript/core-CjO3FOKB.js +2 -0
- package/dist/pyscript/core-CjO3FOKB.js.map +1 -0
- package/dist/pyscript/core.css +1 -0
- package/dist/pyscript/core.js +2 -0
- package/dist/pyscript/core.js.map +1 -0
- package/dist/pyscript/deprecations-manager-pFtn19mE.js +2 -0
- package/dist/pyscript/deprecations-manager-pFtn19mE.js.map +1 -0
- package/dist/pyscript/error-tq-z48YI.js +2 -0
- package/dist/pyscript/error-tq-z48YI.js.map +1 -0
- package/dist/pyscript/index-S1Do43bx.js +2 -0
- package/dist/pyscript/index-S1Do43bx.js.map +1 -0
- package/dist/pyscript/mpy-DovD7Qjy.js +2 -0
- package/dist/pyscript/mpy-DovD7Qjy.js.map +1 -0
- package/dist/pyscript/py-BUsUWVJg.js +2 -0
- package/dist/pyscript/py-BUsUWVJg.js.map +1 -0
- package/dist/pyscript/py-editor-CeySmmer.js +2 -0
- package/dist/pyscript/py-editor-CeySmmer.js.map +1 -0
- package/dist/pyscript/py-terminal-CH_wV7wQ.js +2 -0
- package/dist/pyscript/py-terminal-CH_wV7wQ.js.map +1 -0
- package/dist/pyscript/storage.js +2 -0
- package/dist/pyscript/storage.js.map +1 -0
- package/dist/pyscript/toml-CvAfdf9_.js +3 -0
- package/dist/pyscript/toml-CvAfdf9_.js.map +1 -0
- package/dist/pyscript/toml-DiUM0_qs.js +3 -0
- package/dist/pyscript/toml-DiUM0_qs.js.map +1 -0
- package/dist/pyscript/xterm-BY7uk_OU.js +2 -0
- package/dist/pyscript/xterm-BY7uk_OU.js.map +1 -0
- package/dist/pyscript/xterm-readline-CZfBw7ic.js +2 -0
- package/dist/pyscript/xterm-readline-CZfBw7ic.js.map +1 -0
- package/dist/pyscript/xterm.css +7 -0
- package/dist/pyscript/xterm_addon-fit--gyF3PcZ.js +2 -0
- package/dist/pyscript/xterm_addon-fit--gyF3PcZ.js.map +1 -0
- package/dist/pyscript/xterm_addon-web-links-Cnej-nJ6.js +2 -0
- package/dist/pyscript/xterm_addon-web-links-Cnej-nJ6.js.map +1 -0
- package/dist/pyscript/zip-DrwYHuF9.js +2 -0
- package/dist/pyscript/zip-DrwYHuF9.js.map +1 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2520,7 +2520,7 @@ const RunSimulationBlock = () => {
|
|
|
2520
2520
|
};
|
|
2521
2521
|
const startRunNoUI = () => {
|
|
2522
2522
|
setRunningNoUI(true);
|
|
2523
|
-
runNoUI(map, apis, playerBots, seed.toString(),
|
|
2523
|
+
runNoUI(map, apis, playerBots, seed.toString(), false);
|
|
2524
2524
|
};
|
|
2525
2525
|
const startRunNoUIN = (n) => {
|
|
2526
2526
|
setLocalStorage("Results", {});
|
|
@@ -14575,7 +14575,7 @@ const Round = () => {
|
|
|
14575
14575
|
React.createElement(core.Button, { leftSection: React.createElement("i", { className: "fa-solid fa-play" }), size: "xs", onClick: () => navigate(`/simulation/${round.map.replaceAll(" ", "-")}/${round.players.join("-")}?showcase=true`) }, "Simulate"),
|
|
14576
14576
|
React.createElement(core.Button, { leftSection: React.createElement("i", { className: "fa-solid fa-forward" }), size: "xs", onClick: () => {
|
|
14577
14577
|
if (roundIterations === 1) {
|
|
14578
|
-
runNoUI(round.map, apis, round.players, "",
|
|
14578
|
+
runNoUI(round.map, apis, round.players, "", false);
|
|
14579
14579
|
}
|
|
14580
14580
|
else {
|
|
14581
14581
|
currentMap = round.map;
|
|
@@ -16086,7 +16086,7 @@ const Simulation = () => {
|
|
|
16086
16086
|
React.createElement(PlayPauseButton, null),
|
|
16087
16087
|
downloadBytes && (React.createElement(core.Button, { ml: "xs", radius: "20px", leftSection: React.createElement("i", { className: "fa-solid fa-download" }), color: "blue", onClick: () => downloadFile(`${playerNames.join("-")}.btl`, "text/plain",
|
|
16088
16088
|
// @ts-ignore
|
|
16089
|
-
window.simulationToDownload) }, "Download
|
|
16089
|
+
window.simulationToDownload) }, "Download"))),
|
|
16090
16090
|
showcaseMode && React.createElement("span", { id: "render-status" }),
|
|
16091
16091
|
React.createElement("p", { style: { margin: 0 } }, "Playback Speed"),
|
|
16092
16092
|
React.createElement(core.Slider, { style: { flex: "none" }, mb: 30, w: 500, maw: "85%", min: -2, defaultValue: 0, marks: [
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
from code_battles.utilities import GameCanvas, Alignment, is_web, is_worker
|
|
4
|
+
from code_battles.battles import CodeBattles
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def run_game(battles: CodeBattles):
|
|
8
|
+
"""
|
|
9
|
+
Binds the given code battles instance to the React code to enable all simulations.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
if is_web():
|
|
13
|
+
from js import window
|
|
14
|
+
from pyscript.ffi import create_proxy
|
|
15
|
+
|
|
16
|
+
window._startSimulation = create_proxy(battles._start_simulation)
|
|
17
|
+
window._startSimulationFromFile = create_proxy(
|
|
18
|
+
battles._start_simulation_from_file
|
|
19
|
+
)
|
|
20
|
+
elif is_worker():
|
|
21
|
+
setattr(
|
|
22
|
+
sys.modules["__main__"],
|
|
23
|
+
"_run_webworker_simulation",
|
|
24
|
+
battles._run_webworker_simulation,
|
|
25
|
+
)
|
|
26
|
+
setattr(sys.modules["__main__"], "__export__", ["_run_webworker_simulation"])
|
|
27
|
+
else:
|
|
28
|
+
battles._run_local_simulation()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
__all__ = ["CodeBattles", "GameCanvas", "Alignment", "run_game"]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|