M
Michael Naunton
Just for pig-iron, I wrote a clone in C++ today, based on your
description (I can't run yours). Took about the same time! Likewise,
it's not production code (in particular, it will crash if it's given no
images at all - I should have fixed that at least).
Thanks for taking the time to do this: it was interesting to look at
your version. My original code also failed with no images -- I added
a test to drop to the debugger in that case right before posting the
code.
The two might be an interesting comparison for readers of the thread.
My version is for an MFC dialog app. I left out most of the AppWizard-
generated boiler plate i.e. a CWinApp-derived class whose files I didn't
open at all, and a CDialog-derived class where I only added code to one
function. All my actual code is in the text file:
http://bindweed.com/misc/concen-src.txt
There is some bitmap-twiddling done by my DibDC class (not included),
but your version makes external calls to do the same thing, so I figure
that's fair.
Seems fair to me.
I was surprised to find it is actually shorter than the Lisp version in
terms of characters, though it has more lines (a lot have just one curly
bracket). I was sure it would be longer, especially since I did some
things in quite a roundabout and repetitive way.
Note that one third of the Lisp code implements a simple event loop
(code to call a redraw function and a user-input function.) I included
it for completeness, but it's just library code like your MFC framework.
I think, anyway, correct me if I'm wrong.
Those who want can download the 148 KB Windows executable from:
http://bindweed.com/misc/Concen.exe
This is a clear win for the Win/C++ code: providing a Linux/Lisp
executable would be 10 times the size. This is the classic exe vs.
big runtime environment issue.
Just pop it into a directory along with some .bmp files of any size
(there must be at least one or it will crash). It's quite fun! When
you've solved the puzzle, you have to close it and run it again for
another. Perhaps I'll tidy it up a bit, add a few options and sfx and
release it as a freeware...
Hehe, I quite agree with you here: as dumb as the game is, it's
actually fun to play: I've actually played it several times over the
past few days. Ah, the satisfaction of getting a tile right when you're
not quite sure
I have a couple of questions about extensions to this problem, e.g:
o Make it a two player gmae (i.e. fail to flip a pair and the other
player gets to turn card.)
o Make it a net game (serve over http?)
It seems to me that the first case can be handled well by just hacking
code, but the seond case requires a major rewrite (we're using a code
generator, and must add our code to its framework as text.)
Regards,
-- MMN