Javascript applet and AI for tic tac toe