Code for poolbot, a robot that plays pool and learns as it goes