[Tutor] Livewires questions
Eric Brunson
brunson at brunson.com
Thu Jul 26 20:49:59 CEST 2007
Tonu Mikk wrote:
> Tiger12506 wrote:
>
>>> Based on your guidance, I figured it out. I need to use a return
>>> statement, which I had not encountered before. Now I wrote my
>>> definitions in this way:
>>>
>>> def collided():
>>> if player_x == robot_x+0.5 and player_y == robot_y+0.5:
>>> return True
>>>
>>>
>>
>> This could be simplified more.
>> Here's an example as a hint. These two functions are the same.
>>
>> def f():
>> if a == b and c == d:
>> return True
>>
>> def g():
>> return (a==b and c == d)
>>
>>
>>
> I got it. I will do it like this:
> def collided():
> return (player_x == robot_x+0.5 and player_y == robot_y+0.5)
>
>
I believe that will only work if the robot collides with the player from
the southeast.
I'm not sure of the rules of the game, but if that's not the case, then
see my previous note.
More information about the Tutor
mailing list