Re: [Tutor] robots question

2010-09-17 Thread Peter Otten
Roelof Wobben wrote: > I changed a lot because of your suggestions. > But one thing is still a puzzle. > The robots don't move anymore. > > What I have is this : > robots = [] > place_robots(4) > move_robots(robots, player) You are only moving the robots in the 'robots' list. B

Re: [Tutor] robots question

2010-09-17 Thread Roelof Wobben
play_game(): begin_graphics(SCREEN_WIDTH, SCREEN_HEIGHT) player = place_player() robots = [] place_robots(4) junk = [ place_robot(GRID_WIDTH/2, GRID_HEIGHT/2, junk=True )] defeated = False while not defeated: quit = move_player(player) if quit:

Re: [Tutor] robots question

2010-09-16 Thread Steven D'Aprano
On Fri, 17 Sep 2010 11:28:04 am Steven D'Aprano wrote: > Settle down! Sorry, that reads a bit more harshly than I intended. Please insert a smiley after it. :) -- Steven D'Aprano ___ Tutor maillist - Tutor@python.org To unsubscribe or change subs

Re: [Tutor] robots question

2010-09-16 Thread Steven D'Aprano
On Fri, 17 Sep 2010 01:57:48 am Evert Rol wrote: > > As a exercise from this book ( Thinking like a computer scientist ) > > I have to make this programm on this > > page(http://openbookproject.net/thinkcs/python/english2e/ch12.html) > > Exercise 11 > > > > # > > # robots.py > > # > > from gasp imp

Re: [Tutor] robots question

2010-09-16 Thread Alan Gauld
"Roelof Wobben" wrote # # robots.py This is pretty weird code, there are several odd things in it. def place_player(): # x = random.randint(0, GRID_WIDTH) # y = random.randint(0, GRID_HEIGHT) x, y = GRID_WIDTH/2 + 3, GRID_HEIGHT/2 return {'shape': Circle((10*x+5, 10*y+5), 5, fill

Re: [Tutor] robots question

2010-09-16 Thread Peter Otten
Roelof Wobben wrote: > As a exercise from this book ( Thinking like a computer scientist ) I have > to make this programm on this > page(http://openbookproject.net/thinkcs/python/english2e/ch12.html) > Exercise 11 > def check_collisions(robots, junk, player): > defeated = check_collision

Re: [Tutor] robots question

2010-09-16 Thread Evert Rol
> As a exercise from this book ( Thinking like a computer scientist ) I have to > make this programm on this > page(http://openbookproject.net/thinkcs/python/english2e/ch12.html) > Exercise 11 > > # > # robots.py > # > from gasp import * Argh! Is that really in the book? Bad book, bad. You c

[Tutor] robots question

2010-09-16 Thread Roelof Wobben
Hello, As a exercise from this book ( Thinking like a computer scientist ) I have to make this programm on this page(http://openbookproject.net/thinkcs/python/english2e/ch12.html) Exercise 11 # # robots.py # from gasp import * SCREEN_WIDTH = 640 SCREEN_HEIGHT = 480 GRID_WIDTH = SCREEN_WIDTH