minmax algorithm implementation started