diff options
author | Peter Ward <peteraward@gmail.com> | 2014-05-18 10:31:48 +1000 |
---|---|---|
committer | Peter Ward <peteraward@gmail.com> | 2014-05-18 10:31:48 +1000 |
commit | 58e37a1be5b257def98b5c86de84c068e21512df (patch) | |
tree | dad9296b78b717c0ffb078634bcde9f36ffe9ee0 | |
parent | bfce363852bd28d5ed52388f48290119096ae969 (diff) |
things
-rw-r--r-- | capturer.py | 2 | ||||
-rw-r--r-- | robots/__init__.py | 1 | ||||
-rw-r--r-- | setup.py | 7 | ||||
-rw-r--r-- | simple.py | 16 |
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 @@ -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', + ], ) @@ -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) |