Implemented minimax-algorithm