98 are unique, 2 are identical. Find the matching patterns.
Available in a variety of maddening sizes, from 4 to 20.
Or choose your own size (perfect for wallpaper):
Refresh to play again.
Geeky update: puzzles are now created as PNG files, and are surprisingly smaller.
Sanity update: you can now generate a puzzle that the server remembers, and can later solve. Here’s how:
- Construct a URL with the parameters you want, and add
&save=1
on the end. For example, http://diveintomark.org/public/2003/05/matchmaker.cgi?size=8&save=1 - This will generate a puzzle, save it on the server, and redirect you to a page with a longish
idparameter. Bookmark this page; this is your puzzle. (This is my current wallpaper.) - To show the solution, go back to this bookmark and add &cheat=1 to the end of the address. (This is the solution to my wallpaper.)


We hates it! We hates the Mark Pilgrims! Nasty, nasty blogger. Gollum! Gollum!!
Comment by d chalmers — Wednesday, May 7, 2003 @ 3:21 am
Cheat: Use Paint Shop Pro. (Oh, and I agree with comment 1 - nasty bloggitses)
Comment by Isofarro — Wednesday, May 7, 2003 @ 4:10 am
Times i’ve screamed out “woohoo I’ve found it!”: 16
Times I’ve found it: 0
Comment by sparticus — Wednesday, May 7, 2003 @ 4:12 am
So how long before the makers of the chocolate minty things come a-knockin’?
And is this meant to be a comment on internet dating, or is that just me?
Comment by Anonymous — Wednesday, May 7, 2003 @ 4:32 am
2 words…E VIL
Comment by THE Chris — Wednesday, May 7, 2003 @ 5:06 am
Hmmm… It’s easy to find a match in less than 4 minutes (or so). It’s just a matter of using a systematic method of eliminating the options. That and using both index fingers to a) point to the square you’re matching against and b) move fast across the grid checking for matches.
Ugh… my monitor glass is all smudgy. Curse you Pilgrim!! ;-)
Comment by Már Örlygsson — Wednesday, May 7, 2003 @ 5:07 am
10 mins the stupid way (Paint -> manual regrouping & eliminating). Still, probably faster than writing the code for 10×10, but the manual method does not scale well, and I skipped the proving that there were only 2 matching tiles ;-)
Comment by Just me (Sir to you) — Wednesday, May 7, 2003 @ 6:22 am
You bastard. 98 unique and 2 identical patterns have burned themselves onto the back of my retina and are now there even if I close my eyes!
I am a total failure. I gave up after 10, tortuous minutes. I can’t type anymore because I want to suck my thumb.
Comment by Simon Jessey — Wednesday, May 7, 2003 @ 7:31 am
Somewhere, some place, there’s an autistic person who can solve this in less than one second.
Comment by Johan Svensson — Wednesday, May 7, 2003 @ 8:19 am
Ow, gee, did the colors have to be *quite* so eye-popping? That’s a wake-up call for sure!
Comment by Dorothea Salo — Wednesday, May 7, 2003 @ 9:03 am
The colors are easy to change (well, for me, it’s not parameterized in the URL or anything). Give me RGB values you’d like and I can play around with it. Note they all have to be distinctly different at close quarters.
Comment by Mark — Wednesday, May 7, 2003 @ 9:06 am
I see an impending cease and desist letter from Microsoft ;-)
Comment by Anonymous — Wednesday, May 7, 2003 @ 9:10 am
When the page first loaded I thought Mark had come up with a really creative use of CSS (a la Tantek)…but disappointingly its just one big gif file.
Comment by MikeyC — Wednesday, May 7, 2003 @ 9:14 am
using System;
using System.IO;
using System.Net;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
namespace WindowsApplication1
{
public class pilgrimPuzzle : System.Windows.Forms.Form
{
private Bitmap theBitmap;
private int theSize=10;
private void getBitmap()
{
Image theImage;
string theUrl = “http://diveintomark.org/cgi-bin/matchmaker.cgi?size=“ + theSize.ToString();
WebRequest webReq = WebRequest.Create(theUrl);
WebResponse webRes = webReq.GetResponse();
Stream theStream = webRes.GetResponseStream();
theImage = Image.FromStream(theStream);
theStream.Close();
this.theBitmap = new Bitmap(theImage);
}
private string getSignature(int theElementNumber)
{
int theRow = theElementNumber / this.theSize;
int theColum = theElementNumber % this.theSize;
int baseX = 38 * theColum;
int baseY = 38 * theRow;
string theSig = theBitmap.GetPixel(baseX +11, baseY +0).Name +
theBitmap.GetPixel(baseX +11, baseY +1).Name +
theBitmap.GetPixel(baseX +11, baseY +7).Name +
theBitmap.GetPixel(baseX +11, baseY +8).Name +
theBitmap.GetPixel(baseX +11, baseY +12).Name +
theBitmap.GetPixel(baseX +11, baseY +18).Name +
theBitmap.GetPixel(baseX +11, baseY +28).Name +
theBitmap.GetPixel(baseX +18, baseY +12).Name +
theBitmap.GetPixel(baseX +18, baseY +18).Name;
return theSig;
}
public pilgrimPuzzle(int givenSize)
{
Hashtable theSet = new Hashtable();
this.theSize=givenSize;
this.getBitmap();
int firstMatch=0;
int secondMatch=0;
for(int i=0;i<theSize*theSize;i++)
{
string theSig=getSignature(i);
if(theSet.ContainsKey(theSig))
{
firstMatch=(int)theSet[theSig];
secondMatch=i;
}
else
{
theSet.Add(theSig,i);
}
}
System.Console.WriteLine(”Found objects ” + firstMatch +” and ” + secondMatch+” to be equal”);
}
public static void Main()
{
Application.Run(new pilgrimPuzzle(20));
}
}
}
Comment by Just me (Sir to you) — Wednesday, May 7, 2003 @ 9:14 am
Well, I had an awful lot of cleaning to do just now.
See, I looked at the puzzle. Then my head exploded. Good times.
Comment by Ethan — Wednesday, May 7, 2003 @ 9:24 am
True story: I have been designing and running unit tests for the last 30 minutes because I generated a 4 x 4 puzzle and was ABSOLUTELY POSITIVELY CONVINCED that there were no matching patterns and that the program had the cruelest imaginable bug.
Unable to find any bugs, I switched back to my browser window and immediately found the match.
I hate this game.
Comment by Mark — Wednesday, May 7, 2003 @ 9:35 am
You can’t hate the game. It’s your game. Just because everbody hates the game doesn’t mean you are allowed to. Unless your head explodes too.
Comment by Adrian Sevitz — Wednesday, May 7, 2003 @ 9:48 am
What’s the smallest number of comparisons that you need to do on a 10×10 puzzle assuming the worst case (you don’t try to match the two unique ones until last)? 5049?
Comment by Anonymous — Wednesday, May 7, 2003 @ 10:16 am
No, the worst case is that you miss it. ;)
Oh, you meant mathematically? I believe 99 + 98 + 97 + … + 1, which is 4950.
Comment by Mark — Wednesday, May 7, 2003 @ 10:22 am
99+98+97+…+0=49*99=4851
Comment by Just me (Sir to you) — Wednesday, May 7, 2003 @ 10:26 am
Re: CSS-based puzzles. I considered that. I also considered tables. Then I came to my senses and used the Python Imaging Library. The upside is that you can easily save the puzzles and use them as desktop wallpaper.
I use the term “upside” loosely, you understand.
Comment by Mark — Wednesday, May 7, 2003 @ 10:27 am
Actually, 99 + 98 + 97 + … + 0 = 50 * 99 = 4950.
Comment by Mark — Wednesday, May 7, 2003 @ 10:29 am
Oeps,
make that 50*99
Comment by Just me (Sir to you) — Wednesday, May 7, 2003 @ 10:32 am
Hey,
is there a refresh frequency filter on this site, or is my typing just not fast enough? ;-)
Comment by Just me (Sir to you) — Wednesday, May 7, 2003 @ 10:34 am
Any chance you can display a unique-but-consistent numeric value for each “random” puzzle, so the more ridiculous among us can keep track of which ones we’ve solved (versus given up on)?
Since I don’t know how the puzzle works exactly, I’m not sure if you can, but can you? 8^)
Comment by Phillip Winn — Wednesday, May 7, 2003 @ 10:36 am
Instantly addictive and maddening. Thanks for the morning mind jolt!
Comment by Dennis — Wednesday, May 7, 2003 @ 10:38 am
Yes, I could do that, but it would have to be part of the image itself. The entire program is self-contained and returns the binary data of the image. (The CGI script itself is the SRC of the IMG tag.)
Then I could make it so you could type in the code, and it could recreate the image and highlight the solution. I wonder if people would pay for a service like that. ;)
Comment by Mark — Wednesday, May 7, 2003 @ 10:43 am
Ever see the Penmen poster?
http://www.penmen.com/huge.html
Comment by David Wertheimer — Wednesday, May 7, 2003 @ 10:43 am
“but disappointingly its just one big gif file.”
Oh puh-lease! Mark, can you do anything without the dissatified nerds chiming in?
Oh, and we also hates it! My precious could solved it!
Comment by Phillip Harrington — Wednesday, May 7, 2003 @ 11:25 am
Oh, and now I have that song from Fidler running through my head… thank you very much!!!
Comment by Phillip Harrington — Wednesday, May 7, 2003 @ 11:27 am
“Oh puh-lease! Mark, can you do anything without the dissatified nerds chiming in?”
Well yes I am a nerd to the nth degree, however, I have seen examples of CSS art that really blew my mind. So I just assumed at first that it was css-based given that this is diveintomark.org and not simply some games/puzzle site. Although now that I think of it, CSS would probably be inappropriate as the patterns are not presentational but indeed the content! SVG would be more appropriate.
Comment by MikeyC — Wednesday, May 7, 2003 @ 11:42 am
Am I right in thinking that you couldn’t make a 1280×1024 wallpaper at that scale without more than one repeat? (40×40 pixels into 1280×1024 goes 32 x 25.6 ~= 800)
But there are (outer) 4 * 3 * 2 * 1 * (inner) 4 * 3 * 2 * 1 = 24 * 24 = 576 possible tiles?
Comment by Tom — Wednesday, May 7, 2003 @ 2:20 pm
If you want to get super pedantic, it’s
99 + 98 + 97 + … + 3 + 2 = 4949
If you haven’t found the match until the last two tiles, then you automatically know they’re the pair. (Think about it, if you have a 2×1 grid, you need to do 0 comparisons because they must match by construction.)
Of course, this assumes you trust the computer to actually generate a matching set. :)
Comment by Adam Trachtenberg — Wednesday, May 7, 2003 @ 2:33 pm
The solution? Don’t even bother looking. :D
What purdy colors!
Comment by Boris — Wednesday, May 7, 2003 @ 2:53 pm
i believe there are actually 1152 possible tiles.
the outer section contains two arrangements where each arrangement has 24 possible solutions.
(24 + 24) * 24 = 1152
this would make a 33×33 board possible.
Comment by sleeper — Wednesday, May 7, 2003 @ 3:27 pm
sleeper is correct. However, due to avoidable inefficiencies in my current first-generation code, it’s quite slow to create anything more than 30 x 30.
Of course, additional combinations are possible by, say, allowing the outer and middle layers to vary independently. Or adding colors.
But do you really need this to be more evil?
Comment by Mark — Wednesday, May 7, 2003 @ 4:06 pm
If you decide to develop this into a releasable, self-contained game (with donation option, like shareware, of course), you can make a “Poke Out Your Eyes With A Sharp Stick For Relief” option that involves more colors.
If you do that, in addition to the unique number thing I mentioned before, I suggest a way to click on squares you’re already convinced are *not* the match, like marking a flag in Minesweep (only in reverse).
Comment by Phillip Winn — Wednesday, May 7, 2003 @ 4:12 pm
I’m not even gonna bother.
Comment by Jesper — Wednesday, May 7, 2003 @ 4:48 pm
A simpler way to find the worst-case number of comparisons necessary:
(number of tiles)*(number of tiles-1)/2
in the case of a 10×10 grid:
100*99/2 = 4950
(This is because you compare each tile to each other tile (which gives the numerator), but that counts each comparison twice, so you divide by 2.)
Annoyingly, it requires O(n^2) comparisons =)
Comment by Slime — Wednesday, May 7, 2003 @ 5:09 pm
Finding a match is more difficult than finding weapons of mass destruction in Iraq!
Comment by Anonymous — Wednesday, May 7, 2003 @ 6:44 pm
“Or choose your own size (perfect for wallpaper)”
Now I understand why Mark is so keen on accessibility - he’s blind :)
Comment by Anonymous — Wednesday, May 7, 2003 @ 6:53 pm
Mental note: some time before I / he dies, I must walk up to Mark Pilgrim and shout a stream of profanities at him.
Comment by kami — Wednesday, May 7, 2003 @ 7:04 pm
I believe I found the match within about 60 seconds (pure luck), but only under one condition - that the matching square may be a rotated version of the original. My husband thinks the two should have identical orientation as well as identical patterns. I believe the match only requires identical patterns thus a rotation would be okay. Who is correct?
Comment by geoteacher — Wednesday, May 7, 2003 @ 10:13 pm
If I’ll met you one day, I’ll kill you! You evil BASTARD!
Comment by Anonymous — Wednesday, May 7, 2003 @ 10:39 pm
Sorry, identical means identical in pattern and orientation. Rotations don’t count.
Comment by Mark — Wednesday, May 7, 2003 @ 11:07 pm
Slime– only requires O(n^2) if the set is unsorted. You could easily come up with some lexical relation to sort on, and then get merge/quick/binary search, which (I think) is O(n log n).
Of course, with this goal (only searching once) the sort is relatively expensive.
Comment by Anonymous — Thursday, May 8, 2003 @ 1:32 am
i wasted some time coding it up in php and css, because i’m an idiot like that. also, my version has a help button. :)
http://reversal.org/matchmaker/
(of course, the css is all screwy in ie (see: http://reversal.org/matchmaker/uglay.png ). maybe i’ll have fixed that by the time you see it.)
Comment by mike — Thursday, May 8, 2003 @ 2:50 am
Only now did I notice that the orientation of the outer and inner bands are codependant. This means that my getSignature() code in http://diveintomark.org/archives/2003/05/07/matchmaker.html#c001850 checks one pixel to many :-(
BTW, for those wondering why this code has a form, I included some visual debugging routines to see wether I was checking the right pixels. I left that part out to reduce the posting size.
Actually, turning this thing into a smart client for Marc’s puzzels should just require a few more lines of code … must resist … get back to work … now …
Damn you Pilgrim! If we’d all suck the wasted time collectively out of your life tread, the whole of the Pilgrim ancestral line would by now have been burned out of history :-)
Comment by Just me (Sir to you) — Thursday, May 8, 2003 @ 4:13 am
I’ve spent the last few minutes trying to peel the stickers off and move them so I can get a match. I found one, but the edges are bubbly and now everyone will know I cheated.
Comment by Michael Earls — Thursday, May 8, 2003 @ 8:51 am
brilliant.
source code?
Comment by Rich Salz — Thursday, May 8, 2003 @ 1:34 pm
Mike, it looks like you have some rounding errors [link moved to name link]
Comment by Danil — Thursday, May 8, 2003 @ 3:39 pm
danil: i can’t imagine why it does that.. it’s not consistant at all. silly bugs.
*shrug* maybe if i ignore it, it will fix itself. :)
Comment by mike — Friday, May 9, 2003 @ 2:46 am
“You are in a maze of twisty little diagrams, all almost alike.”
I admit to quitting before finding, but I’d LOVE to inflict this on a classroom full of bored kids on a rainy friday afternoon when the lesson plans have all been used up.
And I’m with the other guy (name forgotten), source code?
Comment by CyranoSmith — Tuesday, May 13, 2003 @ 12:02 pm
BTW I toss my cookies at every opportunity (sorry, but it BEGGED to be said). Saw the source code that Just Me posted & assume it will work. Now I have to learn how to use it (I’ve been out of programming for too long).
I’ll be looking over your archives for other goodies. Keep up the demented good work.
CS
Comment by CyranoSmith — Tuesday, May 13, 2003 @ 12:11 pm