Code from a game that I am porting to the web.