code-battles 1.7.1 → 1.7.2
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 -2
- package/dist/code_battles/battles.py +6 -9
- package/dist/esm/index.js +3 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -3033,6 +3033,7 @@ const Round = () => {
|
|
|
3033
3033
|
roundIterations !== 1 && (React.createElement("th", { style: { width: "35%" } }, "Results")),
|
|
3034
3034
|
React.createElement("th", null))),
|
|
3035
3035
|
React.createElement("tbody", null, rounds.map((round, index) => {
|
|
3036
|
+
var _a, _b;
|
|
3036
3037
|
const winCounts = {};
|
|
3037
3038
|
if (results[round.players.join(", ")] !== undefined) {
|
|
3038
3039
|
const currentResults = results[round.players.join(", ")][JSON.stringify(round.parameters)];
|
|
@@ -3055,9 +3056,9 @@ const Round = () => {
|
|
|
3055
3056
|
React.createElement("td", null, round.players.map((player, index) => (React.createElement("img", { key: index, src: `/images/teams/${player.toLowerCase()}.png`, width: 30, style: { marginInlineEnd: 10 } })))),
|
|
3056
3057
|
roundIterations === 1 && (React.createElement(React.Fragment, null,
|
|
3057
3058
|
React.createElement("td", null, results[round.players.join(", ")] !== undefined &&
|
|
3058
|
-
results[round.players.join(", ")][JSON.stringify(round.parameters)] !== undefined && (React.createElement("img", { src: `/images/teams/${round.players[results[round.players.join(", ")][JSON.stringify(round.parameters)][0][0]].toLowerCase()}.png`, width: 30, style: { marginInlineEnd: 10 } }))),
|
|
3059
|
+
results[round.players.join(", ")][JSON.stringify(round.parameters)] !== undefined && (React.createElement("img", { src: `/images/teams/${(_a = round.players[results[round.players.join(", ")][JSON.stringify(round.parameters)][0][0]]) === null || _a === void 0 ? void 0 : _a.toLowerCase()}.png`, width: 30, style: { marginInlineEnd: 10 } }))),
|
|
3059
3060
|
React.createElement("td", null, results[round.players.join(", ")] !== undefined &&
|
|
3060
|
-
results[round.players.join(", ")][JSON.stringify(round.parameters)] !== undefined && (React.createElement("img", { src: `/images/teams/${round.players[results[round.players.join(", ")][JSON.stringify(round.parameters)][0][1]].toLowerCase()}.png`, width: 30, style: { marginInlineEnd: 10 } }))))),
|
|
3061
|
+
results[round.players.join(", ")][JSON.stringify(round.parameters)] !== undefined && (React.createElement("img", { src: `/images/teams/${(_b = round.players[results[round.players.join(", ")][JSON.stringify(round.parameters)][0][1]]) === null || _b === void 0 ? void 0 : _b.toLowerCase()}.png`, width: 30, style: { marginInlineEnd: 10 } }))))),
|
|
3061
3062
|
roundIterations !== 1 && (React.createElement("td", null, winners.map((winner, index) => (React.createElement("p", { key: index },
|
|
3062
3063
|
winner,
|
|
3063
3064
|
": ",
|
|
@@ -1024,15 +1024,13 @@ class CodeBattles(
|
|
|
1024
1024
|
document.getElementById("playpause").click()
|
|
1025
1025
|
|
|
1026
1026
|
@web_only
|
|
1027
|
-
def _step(self):
|
|
1028
|
-
from js import document
|
|
1029
|
-
from pyscript.ffi import create_proxy
|
|
1027
|
+
async def _step(self):
|
|
1028
|
+
from js import document
|
|
1030
1029
|
|
|
1031
1030
|
if not self.over:
|
|
1032
1031
|
if len(self._decisions) == self._decision_index:
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
return
|
|
1032
|
+
await asyncio.sleep(0.01)
|
|
1033
|
+
return await self._step()
|
|
1036
1034
|
else:
|
|
1037
1035
|
logs = self._logs[self._decision_index]
|
|
1038
1036
|
for log in logs:
|
|
@@ -1137,9 +1135,10 @@ class CodeBattles(
|
|
|
1137
1135
|
while self._should_play():
|
|
1138
1136
|
start = time.time()
|
|
1139
1137
|
try:
|
|
1140
|
-
self._step()
|
|
1138
|
+
await self._step()
|
|
1141
1139
|
except Exception:
|
|
1142
1140
|
traceback.print_exc()
|
|
1141
|
+
|
|
1143
1142
|
if not self.background:
|
|
1144
1143
|
await asyncio.sleep(
|
|
1145
1144
|
max(
|
|
@@ -1150,5 +1149,3 @@ class CodeBattles(
|
|
|
1150
1149
|
0,
|
|
1151
1150
|
)
|
|
1152
1151
|
)
|
|
1153
|
-
else:
|
|
1154
|
-
await asyncio.sleep(0.0005)
|
package/dist/esm/index.js
CHANGED
|
@@ -3031,6 +3031,7 @@ const Round = () => {
|
|
|
3031
3031
|
roundIterations !== 1 && (React.createElement("th", { style: { width: "35%" } }, "Results")),
|
|
3032
3032
|
React.createElement("th", null))),
|
|
3033
3033
|
React.createElement("tbody", null, rounds.map((round, index) => {
|
|
3034
|
+
var _a, _b;
|
|
3034
3035
|
const winCounts = {};
|
|
3035
3036
|
if (results[round.players.join(", ")] !== undefined) {
|
|
3036
3037
|
const currentResults = results[round.players.join(", ")][JSON.stringify(round.parameters)];
|
|
@@ -3053,9 +3054,9 @@ const Round = () => {
|
|
|
3053
3054
|
React.createElement("td", null, round.players.map((player, index) => (React.createElement("img", { key: index, src: `/images/teams/${player.toLowerCase()}.png`, width: 30, style: { marginInlineEnd: 10 } })))),
|
|
3054
3055
|
roundIterations === 1 && (React.createElement(React.Fragment, null,
|
|
3055
3056
|
React.createElement("td", null, results[round.players.join(", ")] !== undefined &&
|
|
3056
|
-
results[round.players.join(", ")][JSON.stringify(round.parameters)] !== undefined && (React.createElement("img", { src: `/images/teams/${round.players[results[round.players.join(", ")][JSON.stringify(round.parameters)][0][0]].toLowerCase()}.png`, width: 30, style: { marginInlineEnd: 10 } }))),
|
|
3057
|
+
results[round.players.join(", ")][JSON.stringify(round.parameters)] !== undefined && (React.createElement("img", { src: `/images/teams/${(_a = round.players[results[round.players.join(", ")][JSON.stringify(round.parameters)][0][0]]) === null || _a === void 0 ? void 0 : _a.toLowerCase()}.png`, width: 30, style: { marginInlineEnd: 10 } }))),
|
|
3057
3058
|
React.createElement("td", null, results[round.players.join(", ")] !== undefined &&
|
|
3058
|
-
results[round.players.join(", ")][JSON.stringify(round.parameters)] !== undefined && (React.createElement("img", { src: `/images/teams/${round.players[results[round.players.join(", ")][JSON.stringify(round.parameters)][0][1]].toLowerCase()}.png`, width: 30, style: { marginInlineEnd: 10 } }))))),
|
|
3059
|
+
results[round.players.join(", ")][JSON.stringify(round.parameters)] !== undefined && (React.createElement("img", { src: `/images/teams/${(_b = round.players[results[round.players.join(", ")][JSON.stringify(round.parameters)][0][1]]) === null || _b === void 0 ? void 0 : _b.toLowerCase()}.png`, width: 30, style: { marginInlineEnd: 10 } }))))),
|
|
3059
3060
|
roundIterations !== 1 && (React.createElement("td", null, winners.map((winner, index) => (React.createElement("p", { key: index },
|
|
3060
3061
|
winner,
|
|
3061
3062
|
": ",
|
package/package.json
CHANGED