diff --git a/examples/driver.py b/examples/driver.py index 1255f4b..345a47c 100644 --- a/examples/driver.py +++ b/examples/driver.py @@ -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 \ No newline at end of file + 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