Learning patterns for the design and deployment of mathematical games