summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--capturer.py2
-rw-r--r--robots/__init__.py1
-rw-r--r--setup.py7
-rw-r--r--simple.py16
4 files changed, 11 insertions, 15 deletions
diff --git a/capturer.py b/capturer.py
index 92f85b7..7a698ee 100644
--- a/capturer.py
+++ b/capturer.py
@@ -37,7 +37,7 @@ class CaptureSpawns(object):
if random.random() < self.variance:
result = random.choice('ULDR')
elif predecessors[y][x]:
- result = predecessors[y][x]
+ result = random.choice(predecessors[y][x])
elif state.allegiances.get((x, y)) != whoami:
result = 'P'
else:
diff --git a/robots/__init__.py b/robots/__init__.py
index f47e080..4406736 100644
--- a/robots/__init__.py
+++ b/robots/__init__.py
@@ -1,3 +1,4 @@
from robots.cursesviewer import CursesViewer
from robots.game import Game
+from robots.server import Server
from robots.utils import empty_map, border_map
diff --git a/setup.py b/setup.py
index 77263a7..9e80889 100644
--- a/setup.py
+++ b/setup.py
@@ -4,5 +4,10 @@ from Cython.Build import cythonize
setup(
name='robots',
packages=find_packages(),
- ext_modules = cythonize('robots/*.pyx')
+ ext_modules=cythonize('robots/*.pyx'),
+ install_requires=[
+ 'flask',
+ 'blessings',
+ 'cython',
+ ],
)
diff --git a/simple.py b/simple.py
index 2876948..554016c 100644
--- a/simple.py
+++ b/simple.py
@@ -1,7 +1,6 @@
import random
import robots
-from robots.utils import add_spawns
def random_walk(whoami, state):
my_robots = state.robots_by_player[whoami]
@@ -11,15 +10,6 @@ def random_walk(whoami, state):
)
if __name__ == '__main__':
-# random.seed(42)
- map_ = robots.border_map(20, 10, 0)
-
- add_spawns(map_, 10, 'X')
- add_spawns(map_, 20, '+')
- add_spawns(map_, 4)
-
- game = robots.Game(map_)
- game.add_bot(random_walk, 'Alice')
- game.add_bot(random_walk, 'Bob')
- viewer = robots.CursesViewer(game)
- viewer.run()
+ server = robots.Server()
+ server.add_simple_bot(random_walk, 'Alice')
+ server.run(debug=True)