COMPLETED threaded version of minimax algorithm