code-battles 1.7.2 → 1.7.3

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.
@@ -259,6 +259,11 @@ class CodeBattles(
259
259
 
260
260
  return 20
261
261
 
262
+ def configure_breakpoint_by_time(self) -> bool:
263
+ """Return whether the breakpoint value should be a time instead of steps (multiplied by `configure_steps_per_second`)."""
264
+
265
+ return False
266
+
262
267
  def configure_board_count(self) -> int:
263
268
  """The number of wanted boards for the game. 1 by default."""
264
269
 
@@ -547,7 +552,9 @@ class CodeBattles(
547
552
  )
548
553
  step_element = document.getElementById("step")
549
554
  if step_element is not None:
550
- step_element.onclick = create_proxy(lambda _: self._step())
555
+ step_element.onclick = create_proxy(
556
+ lambda _: asyncio.get_event_loop().run_until_complete(self._step())
557
+ )
551
558
 
552
559
  # Start the simulation.
553
560
  document.getElementById("playpause").click()
@@ -1096,6 +1103,7 @@ class CodeBattles(
1096
1103
  return False
1097
1104
 
1098
1105
  if self.step == self._get_breakpoint():
1106
+ self._ensure_paused()
1099
1107
  return False
1100
1108
 
1101
1109
  if self.step in self._breakpoints and self.console_visible:
@@ -1126,6 +1134,10 @@ class CodeBattles(
1126
1134
  return -1
1127
1135
 
1128
1136
  try:
1137
+ if self.configure_breakpoint_by_time():
1138
+ return int(
1139
+ float(breakpoint_element.value) * self.configure_steps_per_second()
1140
+ )
1129
1141
  return int(breakpoint_element.value)
1130
1142
  except Exception:
1131
1143
  return -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-battles",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "A library for building interactive competitive coding battles",
5
5
  "repository": "https://github.com/noamzaks/code-battles",
6
6
  "homepage": "https://code-battles.readthedocs.org",