An efficient competitive strategy for learning a polygon