Checking in goal check
merging bryce's working code
Added win check with legitimate moves check... about to make a bit simpler
Added win check. It works by either detecing infallible win condition or detecting that it searched the entire tree, in which case it chooses the best move available, e.g. if it knows it can't win, it will try to draw