Go to the first, previous, next, last section, table of contents.


Robot API

Robot: ktr_robot_t
The robot data type.

Robot: ktr_robot_t * ktr_robot_create (ktr_world_t *world, int street, int avenue, ktr_direction_t dir, int n_beepers)
Creates a new robot that lives in world. The starting position is given as (street, avenue), facing direction dir. The robot starts with n_beepers in his beeper bag.

Robot: void ktr_robot_set_move_callback (ktr_robot_t *r, ktr_robot_move_callback_t cb)
Establishes the function to invoke whenever karel moves.

Robot: void ktr_robot_set_turn_callback (ktr_robot_t *r, ktr_robot_turn_callback_t cb)
Establishes the function to invoke whenever karel turns.

Robot: void ktr_robot_get_pos (ktr_robot_t *r, int *street, int *avenue);
Sets street and avenue to the coordinates of the given robot's (r) current intersection.

Robot: char * ktr_robot_dir_to_string (ktr_direction_t dir);
Converts the given direction (dir) to a string for printing the robot's current direction.


Go to the first, previous, next, last section, table of contents.