4
$\begingroup$

With my informal Coding for Teens group, I like to start each session with a puzzle that we do as a group. My reasoning is that programming is not primarily about semicolons and syntax, but about logical thinking. And logical thinking can be demonstrated and honed with puzzles.

So far I've used grid puzzles (Alice, Betty, Carol, and Dawn have dates with Roger, Steve, Tim, and Ulmer...), and I'm thinking about using the Towers of Hanoi (obviously that's a one-session puzzle), but I'm wondering if there are other formats that are good for this type of group activity.

Edit

To be clear, I'm not asking for a list of specific puzzles / links. I'm asking for puzzle types. For instance, if I were asking for puzzle types that hone language and / or lateral thinking, "crossword puzzle" might be a good answer.

$\endgroup$
2
  • $\begingroup$ Could this be better asked as how to evaluate a puzzle for use as a CS teaching tool, than as a request for a list of puzzles? $\endgroup$ Jul 11, 2017 at 9:20
  • $\begingroup$ David Ginat has done a lot of work with this and has a wealth of exercises. Some has appeared in ACM publications and at SIGCSE conferences. See, for example: dl.acm.org/… $\endgroup$
    – Buffy
    Jul 11, 2017 at 11:23

3 Answers 3

1
$\begingroup$

There are a wealth of various puzzle types. Most great puzzles are rooted in discrete mathematics of some sort.

I will name both classic puzzles and more recent puzzles; in some cases I will provide specific links as not all good puzzles have been around long enough to have multiple forms/generic names, but I am not affiliated with any puzzle creators.


Good puzzles can foster thinking in the following areas and many others:

  • Combinatorics
  • Graph Theory
  • Topology
  • ...

But more to the point, some puzzles are tricky to analyze and give birth to entirely new fields of study. The history of Graph Theory is an interesting example, as a puzzle (Seven Bridges of Königsberg) really prompted the entire subject. So looking at fields of math to find interesting puzzles is, in a way, backwards.


  • Block sliding puzzles, such as "Rush Hour" (the most popular name) or "Unblock Me" (a free mobile app version). This puzzle has even been the subject of CS studies such as computing the hardest Rush Hour puzzle.
  • Block sliding puzzles with numbers or pictures (like the "Tile Game" in the Mac OS "Dashboard")
  • Drawing puzzles that involve drawing a figure without lifting the pencil or retracing one's path, much like the Seven Bridges of Königsberg as mentioned above. "One Touch Draw" is a good mobile app execution of the idea, which adds its own twists in later puzzles (one-way paths and other aspects). There are ways to analyze such puzzles for easy victory, and the student has to develop them.
  • Towers of Hanoi, as you already mentioned.
  • "Free the string" type puzzles—this may not relate very well to programming, but it is certainly interesting from a topological standpoint. They definitely require logical thought.
  • Sudoku. The logical methods of attack possible on Sudoku games are quite intricate. Good CS students should be capable of developing many of the attacks themselves with no prompting or teaching.
  • A game I can't find the name for, played on a rectangular grid of squares (of whatever size) with a number above each column and beside each row, where you must draw an orthogonal (taxicab geometry) path across the squares from the top left corner to the bottom right, in such a way that the number of squares touched in each column/row matches the number above/beside that column/row.
  • There are two puzzle apps made by Pyrosphere that are (so far as I know) original, and quite unique and simple, and are excellent for logical thought. (Similar to Sudoku in the logical attacks possible, but they have not been analyzed in books so you must develop your own analysis.) One is Lazors; the other is Weaver.
  • "How many triangles in this diagram?"-type puzzles. These are great for demanding a clear sequential approach as you can't accurately count the triangles otherwise.*

Then there are other not-quite-puzzles that don't really require intense logical thought to do, but which are great for logical analysis. Games like:


I'm sure I've left out an awful lot of them. I collect such things; this is just off the top of my head.

*A great joke I read elsewhere on Stack Exchange: How many legs does a cow have? Twelve: Two on the right, two on the left, two in front, two in the back, and one at each corner.

$\endgroup$
4
$\begingroup$

A fun and useful puzzle type is logical operators. Anything and everything that uses logical operators, and the more complex your operator, the better.

Working out how a mysterious logical operator works is a great way to increase, well, logical thinking. You really have to figure out what's the logical output.

An example puzzle would be:

Input: A B C (binary values)

(((A or b) or (not C)) and (C or (not (A and B))))

And then they need to figure out how this thing works. Building a truth table, figuring out tautologies or how one parameter can completely change what the operator does. ( I think C is like that, in the above example).

A very, very important skill this teaches is tautologies. Sometimes programming needs to be tautologous. The question of whether the program works should be true for every input which is allowed. While that isn't always possible (practical-wise), striving for bug-free code is, as I see it, a good thing.

It's also interesting to show the students how a very simple set of blocks (and,or,not) can be used to construct unbelievably complicated things; and to work out how those things work, the students have to develop logical thinking.

So logical operators overall improve a number of aspects of logical thinking.

(It doesn't add too much, but my personal experience has shown me that puzzles such as these are one of the only things that taught me logical thinking).

$\endgroup$
1
$\begingroup$

There are many forms of Boolean decision logic, so identifying the best type to use for a particular problem would be a useful exercise. When Boolean conditional expressions are combined, they are in families, like:

  1. Similar conditions combined using And & Or (x=7 And y!=3)
  2. Different types of conditions (x=3 And y='george')
  3. Range tests for numbers
  4. Equality tests using a Switch/Case

Then you can show methods to lay out a solution: decision tables, decision trees, Karnaugh maps, etc. This provides experience in classifying problems. An example like a high-low guessing game can lead to surprising results: figuring out a number from 1 to 99 in only 6 tries is interesting. Then explain binary search.

The point of the puzzle is to choose among types of solutions, also appropriate tools for analyzing it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.