started to add minimax function