initial commit - the AI seems to work, but needs testing/improving.