Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint fix #11

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions examples/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@


def drive(world):
"""
This method controls the car's movement based on the obstacle it encounters.
"""
This method controls the car's movement based on the obstacle it encounters.

Parameters:
world (World): The game world object containing the car and obstacles.
Parameters:
world (World): The game world object containing the car and obstacles.

Returns:
Action: An action to perform based on the obstacle encountered.
"""
x = world.car.x
y = world.car.y
obstacle = world.get((x, y - 1))
Returns:
Action: An action to perform based on the obstacle encountered.
"""
x = world.car.x
y = world.car.y
obstacle = world.get((x, y - 1))

if obstacle == obstacles.PENGUIN:
return actions.PICKUP
elif obstacle == obstacles.WATER:
return actions.BRAKE
elif obstacle == obstacles.CRACK:
return actions.JUMP
elif obstacle == obstacles.NONE:
return actions.NONE
else:
return actions.RIGHT if (x % 3) == 0 else actions.LEFT
if obstacle == obstacles.PENGUIN:
return actions.PICKUP
elif obstacle == obstacles.WATER:
return actions.BRAKE
elif obstacle == obstacles.CRACK:
return actions.JUMP
elif obstacle == obstacles.NONE:
return actions.NONE
else:
return actions.RIGHT if (x % 3) == 0 else actions.LEFT