The Swap Puzzle Activity

Solve a puzzle, coming up with an algorithm that your team can follow faster than anyone else.

This introduces the idea of the solution to a problem being a set of instructions that allow others to ‘solve’ it with no understanding. Also explores how different algorithms can solve the same problem but may not be equally good – some may be faster.

Learn about:

  • algorithms
  • computational thinking
  • testing
  • efficiency

Activity

Place small coins heads up on the blue squares and tails up on the red squares. Swap the positions of the Heads for the Tails in as few moves as possible.swap-puzzle.jpg

There are two ways to move a piece:

  1. Move left or right to an adjacent empty square
  2. Jump over a single adjacent piece into an empty space.

It is not good enough to just complete the puzzle. To solve it, you must write down the algorithm: the sequence of  instructions so anyone who follows them can complete it. (eg a move might be written “1 <— 0”  to mean move the piece on square 0 to square 1).

There are three increasingly larger boards that get harder. Complete the first in 3 moves, the second in 8 moves and the third in 15 moves. Your solution must be fast (ie take as few moves as possible). If your early solutions take more than the above number of moves then keep trying until you find more efficient algorithms.

Once you have a solution algorithm evaluate it – check it really works by following it step by step from the start.

A bit of computational thinking wisdom

Harder problems can be made easier by tackling simpler version first, then generalising the solution.

Resources
This session comes with linked activity sheets and write-ups that you can download.

The Puzzle Sheet is a single sided, self contained activity. The other resources give more detail or other versions. You can either print the sheet or just draw the boards on paper.

You may also be interested in our free very big booklet exploring algorithms, and programming concepts using games, puzzles and everyday things.

Back to activities

 

QMUL - Queen Mary University of London logo

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.