added AI.canWin and some tests