From Polygons to Ultradiscrete Painlevé Equations