Refactor ai, combine checking for win and danger