Blog
2022-02-26
Surprisingly often, people ask me how they can build their own copy of MENACE. If you've been thinking that you'd love your own matchbox-powered machine learning computer but haven't got round to asking me about it yet, then this blog post is just what you're looking for.
Matchboxes
Before building MENACE, you'll need to get hold of 304 matchboxes (plus a few spares in case one gets lost or falls apart). I used these craft matchboxes: they don't have the best build quality, but they're good enough.
304 positions
The positions you need to glue onto the front of the matchboxes can be downloaded from this GitHub repository (first move boxes, third move boxes, fifth move boxes, seventh move boxes). These are sized to fit on matchboxes that have 15mm by 35mm fronts.
I printed each pdf on differently coloured paper to make it easier to sort the matchboxes after getting them out of their box.
If you get differently sized matchboxes, the code used the generate the PDFs is in the same GitHub repository (you'll need to modify these lines). Alternatively, feel free to drop me an email and I will happily adjust the sizes for you and send you the updated PDFs.
Glue
I used PVA glue to stick the positions onto the matchboxes. The printable PDFs have extra tabs of paper above and below the postions that can be glued in to the bottom and inside of the matchbox tray to hold it more securely.
Gluing the positions onto the matchboxes was the most time consuming part of building my copy of MENACE, largely due to having to wait for the glue to dry on a set of matchboxes before I had space for the next batch of them to dry.
Beads
Once you've glued pictures of noughts and crosses positions to 304 matchboxes, you'll need to put coloured beads into each matchbox. For this, I used a large tub of Hama beads (that tub contained orders of magnitude more beads than I needed).
A nice side effect of using Hama beads is that they're designed to be ironed together so making a key to show which colour corresponds to each position is very easy.
I typically start the boxes off with 8 beads of each colour in the first move box, 4 of each colour in the third move boxes, 2 of each in the fifth move boxes, and one of each in the seventh move boxes.
Once you've filled all your matchboxes with the correct number of beads, you're ready to play yout first game against MENACE. I'd love to hear how you get on.
And once you're bored of playing noughts and crosses against your matchboxes, why not build a machine that learns to play Hexapawn, Connect 4, Chess or Go? Or one that plays Nim?
Edit: Added link to the printable pdfs of the positions needed for Hexapawn, made by Dan Whitman.
(Click on one of these icons to react to this blog post)
You might also enjoy...
Comments
Comments in green were written by me. Comments in blue were not written by me.
I also read the Martin Gardner article way back when and had two matchbox machines (actually with envelopes instead of matchboxes) play Nim against each other. I don't remember all the details now, except that it got to the point where one would make the first move and the other would immediately resign.
Tim Lewis
I made a matchbox machine that learns to play 3x3 Nim almost 50 years ago. I still have it. (Based on Martin Gardner's article)
Tony
Add a Comment
2021-12-04
In November, I spent some time designing this year's Chalkdust puzzle Christmas card.
The card looks boring at first glance, but contains 14 puzzles. By writing the answers to the puzzles in the triangles on the front of the card, then colouring triangles containing 1s, 2s, 5s or 6s in the right colour, you will reveal a Christmas themed picture.
If you want to try the card yourself, you can download this printable A4 pdf. Alternatively, you can find the puzzles below and type the answers in the boxes. The answers will automatically be written in the triangles, and the triangles will be coloured...
The puzzles | ||
1. | What is the sum of all the odd integers between 0 and 30? | Answer |
2. | What is the sum of all the odd integers between 0 and 5668? | Answer |
3. | What is the smallest integer with a digital sum of 28 and a digital product of 10000? | Answer |
4. | What is the smallest integer with a digital sum of 41 and a digital product of 432000? | Answer |
5. | What is the area of the largest area dodecagon that will fit inside a circle with area \(111185\pi\)? | Answer |
6. | What is the area of the largest area heptagon that will fit inside a semicircle with area \(115185\pi\)? | Answer |
7. | How many terms are there in the (simplified) expansion of \((x+y+z)^{2}\)? | Answer |
8. | How many terms are there in the (simplified) expansion of \((x+y+z)^{41172}\)? | Answer |
9. | What is the largest integer that cannot be written as \(4a+5b\) for non-negative integers \(a\) and \(b\)? | Answer |
10. | What is the largest integer that cannot be written as \(83409a+66608b\) for non-negative integers \(a\) and \(b\)? | Answer |
11. | How many positive integers are there below 100 whose digits are all non-zero and different? | Answer |
12. | How many positive integers are there whose digits are all non-zero and different? | Answer |
13. | What is the only integer for which taking the geometric mean of all its factors (including 1 and the number itself) gives 2? | Answer |
14. | What is the only integer for which taking the geometric mean of all its factors (including 1 and the number itself) gives 25? | Answer |
(Click on one of these icons to react to this blog post)
You might also enjoy...
Comments
Comments in green were written by me. Comments in blue were not written by me.
@HJ: the smallest one does have 6, and Q4 is correct too. I bought the cards and had good fun solving it myself. I’m glad to find this here though to check my answers as when I did the shading it looked like the picture wasn’t quite right. Thanks for the cards Matthew, I look forward to next year’s - no pressure!
Alec
The only one I'm stuck on is #6. I thought I was doing it right but I'm getting a non-integer answer. I'm assuming the heptagon in question is aligned so one of its sides sits on the diameter of the semicircle, and the opposite vertex sits on the curved edge of the semicircle. Is this wrong?
Seth C
The version of the card on this page doesn't check if your answers are correct, so it will colour in any number you enter as long as it has the right number of digits.
Matthew
Wonky solution for #9? On a blank start page, answering "16" gives you red and white puzzle completions, yet we _know_ that 16 is an incorrect answer. Strange?
Attika
Add a Comment
2021-09-25
A few weeks ago, I (virtually) went to Talking Maths in Public (TMiP). TMiP is a conference for anyone involved
in—or interested in getting involved in—any sort of maths outreach, enrichment, or public engagement activity. It was really good, and I highly recommend coming to TMiP 2023.
The Saturday morning at TMiP was filled with a choice of activities, including a puzzle hunt written by me. Each puzzle required the solver to first find a clue hidden in
the conference's Gather-Town-powered virtual Edinburgh (built by the always excellent Katie Steckles), then solve the puzzle to reveal a clue to the final code. Once the final code was found, the solvers could enter
a secret area in the Gather Town space.
The puzzles for the puzzle hunt can be found at mscroggs.co.uk/tmip. For anyone who doesn't have access to the Gather Town space, the numbers that are hidden in the space are:
- Puzzle 1: The mathematician (Thomas Bayes) died in 1761.
- Puzzle 2: The sign claims that Arthur's seat is 1288 links tall.
- Puzzle 3: The sign claims that the maximum capicity of the museum is 2449 people.
- Puzzle 4: Dynamic Earth became a charitable trust in 94.
- Puzzle 5: The 102 bus goes to Dumfries.
The solutions to the five puzzles, and the final puzzle are below. If you want to try the puzzles for yourself, do that now before reading on.
Puzzle 1: The strange shop
A shop has a very strange pricing model. If you buy \(k\) items, then the price (in pence) is decided as follows:
- If \(k\) is prime, then the price is \(k\) pence.
- If \(k\) is not prime, then double \(k\) and add one:
- If the result is prime, that is the price.
- If the result is not prime, keep doubling and adding one until a prime is reached.
You enter the shop with 1761 pence and buy 28 items.
How many pence do you leave the shop with?
Fun fact: If you try to buy 509202 items from the shop, then the shopkeeper cannot work out a price,
as a prime is never reached. It is currently unknown if this is the smallest number of items that
this is true for.
Puzzle 2: The homemade notebook
You make a homemade notebook with 1288 pages:
You take a stack of 1288/4 pieces of paper and fold the entire stack in half so that
each piece of paper makes four pages in the notebook. You number the pages:
you write the number 1 on the front cover, 2 on the inside front cover, and so on
until you write 1288 on the back cover.
While you are looking for your stapler, a strong wind blows the pieces of paper all
over the floor. You pick up one of the pieces of paper and add up the two numbers
you wrote on one side of it.
What is the largest total you could have obtained?
Puzzle 3: The overlapping triangles
You draw three circles that all meet at a point:
You then draw two triangles. The smaller red triangle's vertices are the centres of the circles. The larger blue triangle's vertices are at the points on each circle diametrically opposite the point where all three circles meet:
The area of the smaller red triangle is 2449.
What is the area of the larger blue triangle?
The odd factors
You write down the integers from 94+1 to 2×94 (including 94+1 and 2×94). Under each number, you write down its largest odd factor*.
What is the sum of all the odd factors you have written?
* In this puzzle, factors include 1 and the number itself.
Hint: Doing what the puzzle says may take a long time. Try doing this will some smaller values than 94 first and see if you can spot a shortcut.
The sandwiched quadratic
You know that \(f\) is a quadratic, and so can be written as \(f(x)=ax^2+bx+c\) for some real numbers \(a\), \(b\), and \(c\);
but you've forgetten exactly which quadratic it is. You remember that for all real values of \(x\), \(f\) satisfies
$$\tfrac{1}{4}x^2+2x-8\leqslant f(x)\leqslant(x-2)^2.$$
You also remember that the minimum value of \(f\) is at \(x=0\).
What is f(102)?
The final puzzle
The final puzzle involves using the answers to the five puzzles to find a secret four digit passcode is made up of four non-zero digits. To turn them into clues,
the answers to each puzzle were scored as follows:
Each digit in an answer that is also in the passcode and in the same position in both scores two points; every digit in the answer that is also in the passcode but in a different position scores 1 point. For example, if the passcode was 3317, then:
- 4686 would score 0 points (no digits correct);
- 4676 would score 1 point (7 is a correct digit but in the wrong position);
- 4616 would score 2 points (1 is a correct digit in the correct position);
- 4343 would score 3 points (one of the 3s is a correct digit in the correct position, the other 3 is a correct digit in the wrong position);
- 7333 would score 4 points (one of the 3s is a correct digit in the correct position, the 7 and one of the other 3s are correct digits in wrong positions. Note that the third three scores nothing);
- and 1733 would score 4 points (all four digits are correct digits in wrong positions).
The five clues to the final code are:
- Puzzle 1: 1298 scores 3 points.
- Puzzle 2: 1289 scores 3 points.
- Puzzle 3: 9697 scores 3 points.
- Puzzle 4: 8836 scores 1 point.
- Puzzle 5: 5198 scores 4 points.
(Click on one of these icons to react to this blog post)
You might also enjoy...
Comments
Comments in green were written by me. Comments in blue were not written by me.
Small nitpick on problem 1 fun fact. I think you meant 509202. 509203 is already prime so the price would be 509203. The way you set up the problem (2a_n+1) only gets to (k*2^n-1) if you start with k-1, so your k needs to be one smaller than the Wikipedia's k.
Dan
Add a Comment
2020-12-03
In November, I spent some time designing this year's Chalkdust puzzle Christmas card.
The card looks boring at first glance, but contains 9 puzzles. By splitting the answers into two digit numbers, then colouring the regions labelled with each number (eg if an answer to a question in the red section is 201304, colour the regions labelled 20, 13 and 4 red), you will reveal a Christmas themed picture.
If you want to try the card yourself, you can download this pdf. Alternatively, you can find the puzzles below and type the answers in the boxes. The answers will be automatically be split into two digit numbers, and the regions will be coloured...
Grey/black | ||
1. | How many odd numbers can you make (by writing digits next to each other, so 13, 1253, and 457 all count) using the digits 1, 2, 3, 4, 5, and 7 each at most once (and no other digits)? | Answer |
2. | Carol made a book by stacking 40300 pieces of paper, folding the stack in half, then writing the numbers 1 to 161200 on the pages. She then pulled out one piece of paper and added up the four numbers written on it. What is the largest number she could have reached? | Answer |
3. | What is the sum of all the odd numbers between 0 and 130376? | Answer |
White/yellow | ||
4. | There are three cards with integers written on them. The pairs of cards add to 31, 35 and 36. What is the sum of all three cards? | Answer |
5. | What is the volume of the smallest cuboid that a square-based pyramid with volume 1337 can fit inside?? | Answer |
6. | What is the lowest common multiple of 305 and 671? | Answer |
Red | ||
7. | Holly rolled a huge pile of dice and added up all the top faces to get 6136. She realised that the probability of getting 6136 was the same as getting 9999. How many dice did she roll? | Answer |
8. | How many squares (of any size) are there in a 14×16 grid of squares? | Answer |
9. | Ivy picked a number, removed a digit, then added her two numbers to get 155667. What was her original number? | Answer |
(Click on one of these icons to react to this blog post)
You might also enjoy...
Comments
Comments in green were written by me. Comments in blue were not written by me.
@JDev: lots of the card will still be brown once you're done, but you should see a nice picture. Perhaps one of your answers is wrong, making a mess of the picture?
Matthew
I finished all of the puzzles but the picture is far from colored in. Am I missing something?
These puzzles have been a blast!
These puzzles have been a blast!
JDev
@Tara: I initially made the same mistake. Maybe you didn't take into account that 6 is not one of the available digits in question 1?
Sean
@Tara: Yes, looks like you may have got an incorrect answer for one of the black puzzles
Matthew
Add a Comment
2019-12-08
Just like last year, the year before and the year before, TD and I spent some time in November this year designing a Chalkdust puzzle Christmas card.
The card looks boring at first glance, but contains 9 puzzles. By splitting the answers into two digit numbers, then drawing lines labelled with each number (eg if an answer is 201304, draw the lines labelled 20, 13 and 4), you will reveal a Christmas themed picture. Colouring the regions of the card containing circles red, the regions containing squares green, and the regions containing stars white or yellow will make this picture even nicer.
If you want to try the card yourself, you can download this pdf. Alternatively, you can find the puzzles below and type the answers in the boxes. The answers will be automatically be split into two digit numbers, the lines will be drawn, and the regions will be coloured...
1. | If you write out the numbers from 1 to 10,000 (inclusive), how many times will you write the digit 1? | Answer |
2. | What is the sum of all the odd numbers between 0 and 86? | Answer |
3. | How many numbers between 1 and 4,008,004 (inclusive) have an odd number of factors (including 1 and the number itself)? | Answer |
4. | In a book with pages numbered from 1 to 130,404, what do the two page numbers on the centre spread add up to? | Answer |
5. | What is the area of the largest area quadrilateral that will fit inside a circle with area 60,153π? | Answer |
6. | There are 5 ways to write 4 as the sum of ones and twos (1+1+1+1, 1+1+2, 1+2+1, 2+1+1, and 2+2). How many ways can you write 28 as the sum of ones and twos? | Answer |
7. | What is the lowest common multiple of 1025 and 835? | Answer |
8. | How many zeros does 245! (245!=245×244×243×...×1) end in? | Answer |
9. | Carol picked a 6-digit number then removed one of its digits to make a 5-digit number. The sum of her 6-digit and 5-digit numbers is 334877. Which 6-digit number did she pick? | Answer |
(Click on one of these icons to react to this blog post)
You might also enjoy...
Comments
Comments in green were written by me. Comments in blue were not written by me.
Thanks for the feedback. (I now understand the need for redaction). My son sent me your link as a Xmas present. I must think of an appropriate retaliation. (What is a PDF?)Think I've fixed 1,6 and 9....8 eludes me, for the moment.
Rob
@Rob: It looks to me like you've made mistakes in questions 1, 6, 8, and 9. The hints from the back of the pdf might help:
1. How many numbers between 1 and 10,000 have 1 as their final digit? How many have 1 as their penultimate digit?
6. How many ways can you write 1? 2? 3? 4? 5? What's the pattern?
8. How many zeros does 10! end in? How many zeros does 20! end in? How many zeros does 30! end in?
9. Carol’s sum is odd. What does this tell you about the 5- and 6-digit numbers?
1. How many numbers between 1 and 10,000 have 1 as their final digit? How many have 1 as their penultimate digit?
6. How many ways can you write 1? 2? 3? 4? 5? What's the pattern?
8. How many zeros does 10! end in? How many zeros does 20! end in? How many zeros does 30! end in?
9. Carol’s sum is odd. What does this tell you about the 5- and 6-digit numbers?
Matthew
I'm 71, with one good eye left. What am I missing?
1. 400001
2. 1849
3. 2002
4. 130405
5. 120306
6. 53?
7. 171175
8. 59?
9. 313525
1. 400001
2. 1849
3. 2002
4. 130405
5. 120306
6. 53?
7. 171175
8. 59?
9. 313525
Rob
Add a Comment
Could try a same kind of thing using playing card deck(s)? A(=1)-2-3 4-5-6 7-8-9 maybe 3 decks with different colours on their backs.