summaryrefslogtreecommitdiff
path: root/robots/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'robots/utils.py')
-rw-r--r--robots/utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/robots/utils.py b/robots/utils.py
index 544bec7..dff2a3e 100644
--- a/robots/utils.py
+++ b/robots/utils.py
@@ -1,6 +1,13 @@
from random import sample
import time
+def ceil_div(a, b):
+ """Divide a by b, rounding towards infinity."""
+ return -(-a // b)
+
+def ilen(items):
+ return sum(1 for _ in items)
+
def add_spawns(map_, n_spawns):
available = []
for x, y, cell in iter_board(map_):