fixed win checking and added minimax AI