Go to the first, previous, next, last section, table of contents.
- World: ktr_world_t
-
The world data type.
- World: ktr_world_t * ktr_world_create (int n_streets, int n_avenues)
-
Creates a new world of size n_streets by n_avenues.
- World: ktr_world_t * ktr_world_read (FILE *in_file)
-
Reads a world description from the open file in_file. The file
should be opened with a call to
fopen()
. Returns a newly
allocated world matching the description found in the file, or NULL if
there is an error reading the file.
- World: void ktr_world_add_ew_wall (ktr_world_t *w, int north_of_street, int at_avenue, int length_to_east)
-
Adds an east-west wall immediately north of north_of_street,
starting at at_avenue, and extending length_to_east blocks
to the east.
- World: void ktr_world_add_ns_wall (ktr_world_t *w, int at_street, int east_of_avenue, int length_to_north)
-
Adds a north-south wall immediately east of east_of_avenue,
starting at at_street, and extending length_to_north blocks
to the north.
- World: int ktr_world_check_ew_wall (ktr_world_t *w, int north_of_street, int at_avenue)
-
Returns 1 if there is an east-west wall immediately north of street
north_of_street at avenue at_avenue. Returns 0 otherwise.
- World: int ktr_world_check_ns_wall (ktr_world_t *w, int at_street, int east_of_avenue)
-
Returns 1 if there is an north-south wall immediately east of avenue
east_of_avenue at street at_street. Returns 0 otherwise.
- World: int ktr_world_check_beeper (ktr_world_t *w, int street, int avenue)
-
Returns 1 if there is a beeper at intersection
(street,avenue). Returns 0 otherwise.
- World: int ktr_world_pick_beeper (ktr_world_t *w, int street, int avenue)
-
Decrements the number of beepers at intersection
(street,avenue). Returns 0 if a beeper was successfully
picked. Returns -1 if there were no beepers to pick up.
- World: int ktr_world_put_beeper (ktr_world_t *w, int street, int avenue)
-
Increments the number of beepers at intersection
(street,avenue). Returns 0.
Go to the first, previous, next, last section, table of contents.