implementing argmin to pick the best action at each square