redo mimax my logic was not clear
working on edge case of checkmate debug