Updates on controller.js and utilities.js

Added a pre_init method to gridbox_type so that instances can test
whether they can be used as gridboxes. Say, a "factory" type cannot
be used unless the player has 200 construction supplies in their
inventory.

Added a "title" function in utilities.js which does a similar thing
to Python's string.title method.