Rewrite of mechanic
Fixed minimax for new gui