basic AI now works, added debug functions