Added minimax function , general stuff