Applications of mathematics for the design and analysis of games and puzzles