Implemented Minimax Algorithm