blob: 2876948b79af4690a30c8c8b0ef054837d7e1d5a (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import random
import robots
from robots.utils import add_spawns
def random_walk(whoami, state):
my_robots = state.robots_by_player[whoami]
return ''.join(
random.choice('ULDRP')
for _ in range(len(my_robots))
)
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()
|