Added some intelligence to the player and cleaned up ruby style.