From 2fe31caf455648f3bb8603d804a4a873244acec6 Mon Sep 17 00:00:00 2001 From: Peter Ward Date: Sun, 6 Apr 2014 21:41:27 +1000 Subject: Ripping out functionality to meet new spec. --- simple.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'simple.py') diff --git a/simple.py b/simple.py index 932cc09..10dba02 100644 --- a/simple.py +++ b/simple.py @@ -2,9 +2,7 @@ from collections import defaultdict import random import robots - -iter_board = robots.utils.iter_board -DIRECTIONS = robots.game.DIRECTIONS +from robots.constants import DIRECTIONS def shuffled(items): items = list(items) @@ -103,8 +101,8 @@ def never_paint(whoami, players, board): for _ in range(len(my_robots)) ) -def bot(whoami, players, board): - my_robots = players[whoami]['robots'] +def bot(whoami, state): + my_robots = state.robots_by_player[whoami] return ''.join( random.choice('ULDRP-') for _ in range(len(my_robots)) @@ -114,18 +112,15 @@ if __name__ == '__main__': # random.seed(42) map_ = robots.border_map(30, 10, 0) for y in range(8): - map_[y][10] = '*' + map_[y][10] = 'X' for y in range(11, 2, -1): - map_[y][20] = '*' + map_[y][20] = 'X' map_[5][5] = '1' - map_[5][15] = '2' - map_[5][25] = '3' + map_[5][15] = '3' + map_[5][25] = '2' game = robots.Game(map_) -# game.add_bot(attacker, 'Alice') -# game.add_bot(attacker, 'Adam') - game.add_bot(attacker, 'Barry') - game.add_bot(attacker, 'Bob') - game.add_bot(never_paint, 'Baldrick') + game.add_bot(bot, 'Alice') + game.add_bot(bot, 'Bob') viewer = robots.CursesViewer(game) viewer.run() -- cgit v1.2.3