player¶
| author: | Laurens Koppenol |
|---|
Module to handle players. See Adding AI on how to create new players
-
class
player.DistanceSensor(player, angle, depth)[source]¶ Linear distance sensor using a simple raytracing algorithm. This sensor is drawable because it has percept, depth and a get_absolute_angle function. At the moment this is required to be drawn.
-
class
player.HumanPlayer[source]¶ Human Player that does not have sensors but responds to key input
-
class
player.NaiveAi[source]¶ Super simple Naive AI that will try to stay away from the walls. User ray-tracing sensors (DistanceSensor).
-
class
player.Player[source]¶ Abstract class. Subclass this if you want to make a new player. See readthedocs for more info.
-
change_position(delta_coordinate)[source]¶ Adjust player position
Parameters: delta_coordinate – incremental coordaintes (dx, dy) Returns: Nothing
-
get_position(pixel=False, scale=1)[source]¶ Get player position
Parameters: - pixel – wether to round down to full pixels
- scale – whether to scale (for drawing purposes)
Returns: coordinates (x, y)
-
plan(percepts)[source]¶ Use percepts to get an action
Parameters: percepts – output of sense() function Returns: acceleration_command, rotation_command. both in range [-1, 1]
-