FGCSchool-Math-Club / fgcs-math-club-2014

BSD 2-Clause "Simplified" License
0 stars 2 forks source link

#Critter API

API stands for Application Programmer Interface, which means it's the way the application programmer (you) gets at the framework, service or library providing the API—in other words, an API answers the question “How in the heck do you drive this thing?”

APIs are seldom static; new version of the software often change the API and thus you may have to change your code. Nice API designers will at least warn you about things that may go away (by marking them as “deprecated”), known to be buggy, etc. and will avoid changing things in surprising ways.

Events

The Critter API presently supports three event types:

Incoming data (to your code)

All callbacks provide the current information from your critter's senses as a dictionary. Presently, it contains data from six sense organs:

Control commands (from your code)

Callbacks can return a string telling your critter's body what to do. If no command is given, most callbacks presently assume “Pass” (the main exception being on_collision, which defaults to "Eat" if the collision was with Food). Presently supported commands are: