tic tac toe judge and matrix rotater