Added the minmax algorythm