Sunday Sep 21, 2008

Spore

Even though it's got abysmal DRM, (and the game has been given a virtual bitch-slap by a swarm of reviewers on Amazon all giving it a 1-star rating), Duncan and I have been happily playing away at Spore and have reached the Space Age stage.

It's mostly Duncan. I'm just there to read the fine print in the Game Guide and shout out any tips that might be useful. He's played Red Alert (2) before, and that knowledge has really helped in keeping all his people busy and doing the right things. I admit to being amazed at how quickly he's picked up this game. He breezed through the Civilization stage. All the reading he's had to do has helped improve his reading skills (although I personally wish we could get him as interested in reading some of the books his teacher would like him to read).

It was I suppose inevitable that given the choices of economics, religion or military tactics as a means of achieving world domination, that he'd pick the one where he can destroy things. One could argue that maybe he doesn't understand the other two yet.

But it is all fun. With humorous touches for the grownups with the ability to do alien abductions via space ship and make crop circles. The audio ambiance is wonderful. From the grunts, squawks and squeaks of all the creatures through to the chants of the tribe and to the superb made-up language(s) in the latter stages, that you almost think you are starting to understand.

I see that EA has retooled their DRM (slightly). Too little too late. It's a sad day for gaming where it's easier for software pirates to play the game than for those who try to do the right thing and obtain the game legally.

[]

[]

Wednesday Jun 18, 2008

Spore Creature Creator

Spore is one of the most anticipated games of the year. While we all wait for that to happen, Electronic Arts have released their Spore Creature Creator, including a trial version.

I didn't R the FM and just naïvely downloaded the Mac version onto Duncan's iBook, only to find it's just for the Intel architecture. I then tried the PC version on two oldish Windows Xp machines, only to find that we didn't have good enough graphics cards.

Luckily it works nicely on the wife's MacBook, and Duncan is having a blast creating some monsters. An intuitive UI with great graphics and sounds.

Check out the video:

I guess I know what he'll be wanting for his birthday (or just after).

[]

[]

Wednesday Feb 13, 2008

Alphametic Solver in C

At the last library book sale in Saratoga, I bought a copy of an old Journal of Recreational Mathemetics magazine for a quarter. Near the back were several alphametic problems.

I decided to see if there were any freely available programs around to solve this type of puzzle.

There is a nice online solver by Truman Collins which looks like it's been there for at least 10 years.

I also found a version in C written a couple of years ago by Anuj Prateek and Upendra Singh.

(Update: The alphametic puzzle solver is not written by Prateek and Singh. The original code is by Naoyuki Tamura. See this post (and its comments) for more details.)

At the moment, it just does alphametic addition problems. If I had to guess, I'd say this was one of their first C programs and possibly done because of school work. The formatting and indentation was lousy and there were a load of things that newcomers to C do (such as returns at the end of functions when they aren't needed and two printf statements where one would do). But Burridge's Rules of Programming are:

  1. Get it working.
  2. Get it better.
  3. Get it faster/smaller.

and they've already done #1 so this wasn't a big deal.

But to try to understand it, I decided to tidy it up. I made the following changes:

  • Changed the program name from "crypt" to "alphametic". There is already a "crypt" program on my machine.
  • Added a bunch of newlines, consistent formatting and four space indentation to make the code more readable.
  • Removed all Tabs. Repeat after me, tabs are evil.
  • Included the .h file contents in the single .c source file.
  • Included the README file contents in the single .c source file.
  • Removed the Makefile and added a comment at the top to tell people how to do a simple compile.
  • Rearranged the order of the various routines so that function prototypes aren't needed.
  • Removed #include lines that weren't needed.
  • Adjusted so that there was a single statement per line.
  • Removed the useless calls to "system("cls") and the initial bogus gets call.
  • Adjusted the initial message that's displayed, to add the line:
    "\\nTYPE 'HELP' FOR HELP\\n".
  • Added a simple "> " prompt at the start of each line where the program wants input, so you at least have an idea that you are required to enter something.

The new self-contained single source file is here. There are lots of other places where the code could be improved (like adding comments and better string handling), but I stopped there.

After looking at this, I'm convinced that it's just crying out to be converted to something like Python. The setjmp/longjmp code would naturally become try/except clauses and raising an exception. Some of the other routines that are several lines long would be simple one-liners in Python.

Hopefully I'll have some more time soon to try this, and also expand it so that it solves other alphametic puzzles apart from addition.

[]

[]

Thursday Feb 07, 2008

Runescape 3

Duncan and I have a ritual nowadays. While I'm in my (home) office first thing in the morning, catching up on my email, he's logged in on one of the other computers playing games or reading before he has to go off to school.

This morning he was really frustrated and said "the guy on YouTube is right. Runescape 3 is a fake!"

Apparently I'd stepped away from the Internet for just a moment, because I didn't even know there was a Runescape 3. I asked him to show me the video. There are several similar videos on YouTube. What they seem to have in common is that they direct you to their own web sites where there are probably key loggers in place to grab the names and passwords of unsuspecting users (like Duncan).

From what I can tell, there is a real Runescape 3 in beta, and that one looks valid. If it's not, it's a helluva good spoof.

Update: It's a fake too. I should have looked closer. Thanks Sebastian.

I think that was the one that Duncan had been trying to log into, but was getting nowhere. To be safe, I got him to immediately change his Runescape 2 password. If that site was bogus too, or he's tried to log into one of the other ones, then hopefully we're in time and they won't be able to abuse his real Runescape account.

I hope I've interpreted all this correctly. This afternoon, when he comes home from school, I'll give him a little talk on what happened and see if there are ways to prevent it happening again. I really don't want to put some kind of NetNanny in place, because that'll probably just make him more determined to try to circumvent it. Better to take each incident one at a time. Unless it starts to gets out of control.

[]

[]

Wednesday Dec 12, 2007

Simon Tatham's Portable Puzzle Collection

Here's a little something to give your brain a workout. A collection of interesting one-player puzzle games

There are individual Windows binaries that you can download straight from the web page or there is a Windows installer for the lot.

These puzzles are also automatically available via one of the network repositories on my Ubuntu system (with probably something similar on other Linux distributions) and there is a Mac OS X DMG file (although I haven't tested it).

For everybody else, there is a source code compressed tarball.

[]

[]

Monday Mar 05, 2007

Duncan's First Professor Fizzwizzle Level - The Movie

Thanks to Joanie, there is now a Flash movie of Duncan's first Professor Fizzwizzle custom level. Visual quality has been reduced so that it'll fit under the 3Mb limit imposed by the Roller resources upload. Hopefully you can still see what's going on.

For those Professor Fizzwizzle addicts, see if you can solve the level and have one power up remaining.

[]

[]

Wednesday Feb 28, 2007

Professor Fizzwizzle

Our current game addiction is Professor Fizzwizzle. We ended up buying the Windows version as Duncan still has a Windows laptop.

To quote their website:

Professor Fizzwizzle is a fun, mind-expanding puzzle game, where you take control of the diminutive genius, Professor Fizzwizzle. You must help the professor use his brains and his gadgets to solve each exciting level. Do you have what it takes to get past the Rage-Bots and bring the prof back to his lab?

Perfect for teaching kids problem solving skills and great for the grownups too. It comes with 230 built-in levels, with varying degrees of difficulty and most with a story to go with them. But what makes the game great (as opposed to just being good) is that it comes with a level editor and you can create your own new custom levels and then play them.

You can also register and submit your custom levels to the Professor Fizzwizzle community custom level website. Over the last weekend that's exactly what we did.

There's going to be moments in my life where I'm really impressed with what our son does. I don't expect too many sporting moments. You know, where the basketball player scores the winning three point shot with two seconds left on the clock in the final period. (Just hours before his cheerleader girlfriend accidentally kills him in a prank that went too far, after she discovers that he's given her crabs and is sleeping with anything with a pulse. Of course, she then gets runs over by the obsessed school photographer who takes his dead body and tastefully arranges it in her rental storage area and then kills herself in a bizarre suicide pact, so it all sort of works itself out in the end. But I digress.)

One of those proud moments for me was when Duncan showed me the first custom level he'd created for Professor Fizzlewizzle. It was deviously tricky. I gave him a couple of small suggestions that would clean it up; he quickly modified it and we uploaded it to the community website. Since then there have been 60 downloads.

Gaming in the Participation Age.

If there was one critisism of the game though, it's that there doesn't appear to be a way to take a screenshot while the game is running. I'd really have liked to have shown you what he'd created.

Also over the weekend, (and with a little help from some of my very alert readers), I created a small Python script that automatically downloads all the custom levels in one go. Hundreds of them. I've now put them in the "custom" directory on Duncan's laptop for him to play with. There are some truly clever examples here. I hope some of them migrate into a future version of the full game.

As well as the the version for Windows, there are also downloads for Mac OS X and Linux. I was curious to see how well the Linux version did on my Ubuntu system. I downloaded the demo version from their website (you get about 10-12 levels to play with -- unlimited time). I was slightly disappointed that it didn't "just work" the first time. After I'd unpacked the compressed tarball, I had to run a script that asked me a couple questions:

$ cd .../ProfessorFizzwizzleDEMO_1.02
$ ./run.sh
Building...
Executable already built!  Starting the game...

PROFESSOR FIZZWIZZLE - SOUND INITIALIZATION

\*\*\*\*\*\* PLEASE SELECT DESIRED SOUND SYSTEM \*\*\*\*\*\* 
1 - OSS - Open Sound System
2 - ESD - Elightment Sound Daemon
3 - ALSA - Advanced Linux Sound Architecture
4 - NO SOUND

Input the number corresponding to the desired sound system and press ENTER: 1


\*\*\*\*\*\* PLEASE SELECT DESIRED SOUND DRIVER \*\*\*\*\*\* 
1 - /dev/dsp1
2 - /dev/dsp

Input the number corresponding to the desired sound driver and press ENTER: 1


\*\*\*\*\*\* USING: OSS  WITH DRIVER: /dev/dsp1 \*\*\*\*\*\*

Sound settings saved to file.  To alter settings in the future, delete SOUND.DAT run the game.
$

For me, this was fairly easy, but I can just imagine novice computer users struggling a bit. After you've had a successful run, it created a SOUND.DAT file, so the next time you start the game it's just a click away.

Overall, this is one of the most enjoyable games I've played with Duncan. Simple graphics, easy to use UI, with the occasional touch of humor (for example, when Professor Fizzwizzle falls over or is waiting for you to do something).

I've found that the "secret" of the game is to fully understand what each of the gadgets can do and their effect on all the other objects. Even then, you can't alway predict some of the really creative things that the level designers have integrated into each puzzle, so sometimes you are still stumped. In that case, you can see a solution to the level and use that to then try to solve the level yourself.

I can't give you a better recommendation for this game then that Duncan is still actively wanting to play it after two weeks from the initial download. His ADD personality has usually got him wanting something new by now.

[]

[]

Friday Feb 09, 2007

Pygame Slidepuzzle - Update 9th February 2007

Friday is hacking day.

A followup to a previous post.

I've created a new compressed tarball of the Pygame Slidepuzzle

I've made the following changes:

Added in support for various command line options and adjusted the code to handle them:
  • -?, --help - print out the usage message and exit.
  • -i, --image - path of the image file to use.
  • -s, --size - number of rows and columns to use. Range 2-6.
  • -m, --missing - square that should be empty Numbered from 1.

Assuming you've got pygame (and its dependencies) installed -- and it's just a few clicks away via the Synaptic Package Manager on Ubuntu -- you can then download the Slidepuzzle compressed tarball, unpack it, and then turn your favorite image into a nice sliding puzzle.

For example, I found a nice digital copy of the Mona Lisa on the web and resized it to half its original size, and saved it in the directory where I unpacked slidepuzzle-0.2.

I can now turn it into a 4x4 sliding puzzle with the bottom right corner initially blank with:

  % cd /path/to/slidepuzzle-0.2
  % python slidepuzzle.py --image mona_lisa.jpg --size 4 --missing 16

Type "s" to randomly shuffle the tiles, then use the arrow keys or the mouse to try to solve the puzzle. "q" or Esc will quit the game.

The next step is to try to adjust the code so that there are initial controls like "Play", "Options" and "Quit" and you don't have to set things via command line options. You know, like a real game. I'll probably be again stealing chunks of the public domain Magicor game to do this.

Another update (and probably fairly simple) would be to allow a different number of rows and columns. The "-s", "--size" command line option would change to "-r", "--rows" and "-c", "--columns" and the Python code tweaked accordingly.

But that's all for another day. Back to RealWork™

[]

[]

[]

Tuesday Jan 09, 2007

My First Pygame Game

After discovering pygame back in November, I thought I'd write a small simple game to see how easy it was to use. I finished the first version of it over the Christmas break.

Just like for Zillions of Games, I decided to implement a variant of Sam Loyd's 15 puzzle. I used the Duncan and Dusti Christmas picture from 2 years ago, and turned it into a 3x3 sliding puzzle.

If you have Pygame (and its dependancies) installed on your computer, then you can downloaded a compressed tarball of all the files you need.

Once you've unpacked the gzipped tarball, change directories to the slidepuzzle directory, and type:

% ./slidepuzzle.py

Type "s" to randomly shuffle the tiles, then use the arrow keys or the mouse to try to solve the puzzle. "q" or Esc will quit the game.

If you just want to look at the Python source code, I made the slidepuzzle.py file available too.

Note that this version uses some nice sound files, shamelessly copied from the public domain Magicor game.

The pygame API is nice and clean. Admittedly I haven't explored all there is to offer yet, but it wasn't too hard to work out what I needed in order to get this simple game working, especially after reading the tutorials first.

The next changes will be to allow you to specify any image file on the command line and the size of the grid (3x3, 4x4 or 5x5). I'll also allow you to select which square is the one that is initially removed. If I get enthused, I might further adjust it so that you don't need to use any command line options, and all these things are settable via a normal Preferences type screen.

[]

[]

[]

Friday Jan 05, 2007

Supergamer2

Over the new years break, I downloaded the ISO for the new supergamer2 PCLinuxOS based DVD containing a variety of good games plus a good Linux live CD distribution, and burnt myself a disk.

As the original supergamer-1 webpage reports, the software includes:

  • 3D games: america's army, cube, doom 3, enemy territory, legends, nexuiz, privateer, quake 4, soldier of fortune, ufo: alien invasion, ut2004, wesnoth
  • Arcade: BzFlag, chromium, 3d pinball, frozen bubble, neverball, neverput, penguin racer, supertux, tuxkart
  • Cards: Pysol
  • Strategy: Foobillards
  • Kernel: 2.6.13amd64op-smp squash 3 with source and stripped source installed
  • Office: Open Office 2
  • Misc: Xorg 6.8.2, gcc 3.3.1, firefox 1.0.7, and kde 3.4.3.

For the new version, Darin writes:

"we have an updated iso done with the addition of postal 2 to the line up... I updated the nvidia drivers some and the ldetect to allow 7 series cards to be selected...I also have a version that is a total desktop solution for older hardware (2-3 years old) and at least a gforce4 card to run the big 3d games...also I am forcing dma mode on the dvd to increase some response time...a slight increase but every speed increase helps...this increase only happens running live though as I did not increase the bootup time..."

I tried this on a Dell Dimension 8200 machine that I have (Intel P4 2GHz) and it booted up nicely. I tried a few of the games and had no problems. The machine has a nvidia graphics card, so the accelerated 3D driver was good.

The violence in the demo of Postal 2 wasn't my cup of tea, but then again, I'm not in the demographic that these guys are going after, and as they say, the game is only as violent as you make it. Nice to see that Gary Coleman has found something to do since Diff'rent Strokes, besides, sueing his parents, appearing in really bad loan commercials and fighting with bus drivers.

But I digress.

Thanks Darin et al for putting this nice gaming disk together.

[]

[]

[]

Monday Dec 11, 2006

Runescape Followup

At the weekend, I decided to give Runescape a try for myself, to see just how great it was, and to hopefully be a fount of all knowledge when Duncan asks me questions.

I never know what to call my character in games like this. Rather than pick a name based on an inanimate object and a number such as birdseed101 or cannonfodder4, I decided to use a generator. Here's a good starting point, if you're ever stuck. I stupidly started with the Fantasy Character Generator, and got back wonderful examples like:

Krife is a quirky beekeeper with strawberry blond hair and bluish gray eyes, who is terrified of dogs.

Raby is a dimwitted recluse with red hair and grayish green eyes, who is extremely large.

Gioru is a attractive shipwright with gray hair and golden eyes, who wears a distinctive amulet.

then wised up and used the Fantasy Name Generator

Picking how your avatar looks I'm sure tells others a lot about you. I'm just not a "rainbow socks" kind of person. I went for basic black with a minimum amount of facial hair. I was looking for the option to beef up my muscles (like in a recent Myst demo), but they don't seem to have that.

The tutorial is excellent, but so much to learn (and remember). Duncan seems to have grasped it all. I should have taken notes.

Into the real game.

I love the way they've handled avatar collision by just ignoring it. It's a little disconcerting to have others walk right through you or to magically appear as you move away from the same spot they were occupying, but you get used to it after a while and it certainly makes the code easier.

After two or three hours of this, I'd completed a quest (getting flour, milk and eggs for the cook) and was half way through another. Duncan and I have added each other to our Friends list, and can now easily see when we are online. We've even visited a few places together. It's incredibly easy to move from one server to another and join up with your friends avatar.

Some observations:

  • There are a lot of people out there spoiling for a fight. Everywhere I went. Luckily nobody wanted to fight with me. I'm not sure I'm strong enough yet. I admit I'm not wandering around with my weapons drawn. Maybe it's as simple as that.

  • The inane chat! Just like some chat forums or IRC groups I've hung around in. Probably the same people.

  • It's a little surreal to see several fires blazing away in grid patterns at certain locations. I guess that a required action as part of a quest, and several people are doing it. Still, it's weird.

All great fun though. And you can't beat the price. I'll be back next weekend.

[]

Thursday Dec 07, 2006

Runescape - Online Gaming for Kids

As you've probably seen from a few recent posts of mine, our son is really into computer games at the moment. One of the things Duncan really wants to do is to play games with his friends.

This is easy when he's right there with his buddies, and they'll use a PC or a friends Xbox. (We've also bought him a Nintendo DS Lite for Christmas -- shush, don't tell him!).

He'd also like to play these games in the evening after he's finished his homework, at times when his friends aren't available for in-person visits. So we started looking at online games that are suitable for kids. And preferably free or allow cheap short-term engagements, as he has a tendency to get bored with things like this very quickly.

The first one he tried was Club Penguin, which is a kid-friendly virtual world where children can play games, have fun and interact with each other.

Not bad, but he was looking for something a little more challenging. On a recommendation from a friend, we tried Runescape.

Per the Wikipedia entry (yes, I remembered to look there this time),

RuneScape is a massive multi player online role-playing game (MMORPG) that is programmed in Java by developers in Jagex Limited. With over nine million active free players and more than 850,000 paying members, RuneScape was rated among the most populous online games in the world.

RuneScape offers both free and subscription content and is designed to be accessible from any location with an Internet connection and to run in an ordinary web browser without straining system resources.

We decided on the free subscription for now, which allows players to access more than twenty quests and plenty of items and skills, totalling many hours of gameplay. That should give us an indication of whether he's going to really get into this.

There is a tutorial to work through that tells you all about what you need to do. It takes a while to complete the first time, but it's a great introduction. Then you are into the game, trying to keep healthy, stay alive, face challenges and overcome them and earn extra points to improve your lifestyle. A bit like life really.

He's learning that you can die in these games (unlike adventure games from LucasArts). When that happens, you create a new login, go back in, wade through the tutorial and start accumulating points again.

There is also an interesting side-effect. Whereas we can't currently get him as addicted to books as his parents are, playing Runescape has helped improve his reading as he continually has to read the text on the screen to find out what he should be doing next.

We're very impressed. I hope he perseveres with it.

See the Runescape web site for more details on all aspects of this virtual world.

[]

[]

[]

Tuesday Dec 05, 2006

ScummVM - Beneath a Steel Sky

After all the comments from a recent post suggesting I should try ScummVM for my gaming pleasures, I finally got around to doing it late last week.

For those who don't know (and that included me two weeks ago),

ScummVM is a program which allows you to run certain classic graphical point-and-click adventure games, provided you already have their data files. The clever part about this: ScummVM just replaces the executables shipped with the game, allowing you to play them on systems for which they were never designed!

It's also regularly one of the top 25 projects on SourceForge.

Sounds great! It'll mean I can finally get rid of that old Windows 98 machine we have. I want it !

Now with Windows and Mac OS X, I've become used to going to a web site, downloading the binary file, then double clicking on the small icon in the browser's download manager to Open it, typically in an install wizard. Click on "Next", a few times, wait for the slidey thing to stop moving (stop me if I'm getting too technical) and you're done. The software is installed.

Ubuntu makes this even easier. I've now trained myself to click on System->Administration->Synaptic Package Manager, and look in there first. This is the GUI front-end to the apt packaging system. Currently there are 19424 packages available to me, and so far, I've installed 1171 of them (or they were already installed as part of the initial O/S installation).

I clicked on the "Search" button and typed in "ScummVM". It returned three hits; one for the ScummVM game engine and the other two for a couple of freely available games that use the engine. One of these was for "Beneath a Steel Sky", a game that was recommended in the comments on my previous post.

I selected that one, marked it for installation. It asked me if I'd like to also install its dependencies (like the ScummVM game engine). I said yes by clicking on the "Mark" button. I then hit the "Apply" button. About a minute later everything was installed. It's hard to see how it could be easier.

I now have two new entries under my Applications->Games menu. Being the bold reckless daredevil that I am, I just clicked on the "Beneath a Steel Sky" entry and was immediately into the game.

Oh, the chunky graphics! Note that this is an old game which expects to run at 640x480 resolution. I adjusted to full-screen mode and the graphics got even chunkier. No matter. The game is still fun.

There is about a ten minute opening sequence which gives a good introduction to the game, and then you're into the action. Cool. I love the point-click-move interaction style that I'd used in Curse of Monkey Island

I then went over to another computer, found a decent FAQ and Walkthough and started playing for real. Whereas I don't mind stumbling around trying everything, Duncan, our eight year old son gets bored and needs to keep moving.

(Who'd have thought that F5 would bring up the menu where you can save or quit the game? This must be from the days before they "standardized" on Esc or F1).

When we have finished Grim Fandango, we'll really get into this one.

I've also got Monkey Island I and II on CDROM (for Windows). It'll be interesting to try to "just replace the executables shipped with the game" and get those up'n'running too.

[]

[]

[]

Sunday Dec 03, 2006

Four Fours in Python

I couldn't leave it alone. I just had to see what the C# code looked like in Python, so I could understand how it worked, and to see how much slower it was in a scripting language.

I've made no attempts to optimize the code. If I had more time to spend on this, I think I would have designed the data structures differently for the Python version.

To my unpracticed eye, it looks more readable as Python code, but I don't want to start a my-language-is-better-than-yours slanging match.

Here's the results. Hopefully identicals to Carl's.

  % python fourfours.py 
  1 = (4 + 4) / (4 + 4)
  2 = (4 \* 4) / (4 + 4)
  3 = ( (4 + 4) + 4) / 4
  4 = ( (4 - 4) \* 4) + 4
  5 = ( (4 \* 4) + 4) / 4
  6 = ( (4 + 4) / 4) + 4
  7 = (4 + 4) - (4 / 4)
  8 = (4 + 4) + (4 - 4)
  9 = (4 + 4) + (4 / 4)
  10 = (4 + 4) + (4 - sqrt(4))
  11 = ( (4 + 4!) / 4) + 4
  12 = 4 - (4 / 4) \* 4
  13 = (4 / 4) + (4! / sqrt(4))
  14 = (4 + 4) + (4 + sqrt(4))
  15 = (4 \* 4) - (4 / 4)
  16 = (4 + 4) + (4 + 4)
  17 = (4 \* 4) + (4 / 4)
  18 = (4 \* 4) + (4 - sqrt(4))
  19 = (4! - 4) - (4 / 4)
  20 = ( (4 / 4) + 4) \* 4
  21 = (4 / 4) - (4 - 4!)
  22 = (4 \* 4) + (4 + sqrt(4))
  23 = ( (4 \* 4!) - 4) / 4
  24 = (4 + 4) + (4 \* 4)
  25 = ( (4 / 4) + 4) \^ sqrt(4)
  26 = ( (4 + 4) / 4) + 4!
  27 = (4 + 4!) - (4 / 4)
  28 = ( (4 + 4) \* 4) - 4
  29 = (4 / 4) + (4 + 4!)
  30 = ( (4 + 4) \* 4) - sqrt(4)
  31 = ( (4 + 4!) / 4) + 4!
  32 = (4 \* 4) + (4 \* 4)
  33 = (4 + 4!) + (sqrt(4) / .4)
  34 = ( (4 + 4) \* 4) + sqrt(4)
  35 = ( (4 \* 4) - sqrt(4)) / .4
  36 = ( (4 + 4) \* 4) + 4
  37 = (4 + 4!) + (4 / .4bar)
  38 = (4 \* 4) - (sqrt(4) - 4!)
  39 = ( (4 \* 4) - .4) / .4
  40 = ( (4 \* 4) + 4) \* sqrt(4)
  41 = ( (4! - 4) / .4bar) - 4
  42 = (4 \* 4) + (sqrt(4) + 4!)
  43 = (sqrt(4) \* 4!) - (sqrt(4) / .4)
  44 = (4 \* 4) + (4 + 4!)
  45 = ( (4 \* 4) + 4) / .4bar
  46 = ( (4 \* 4!) - 4) / sqrt(4)
  47 = (sqrt(4) \* 4!) - (4 / 4)
  48 = ( (4 + 4) + 4) \* 4
  49 = (4 / 4) + (sqrt(4) \* 4!)
  50 = ( (4 \* 4) + 4) / .4
  51 = ( (4! - sqrt(4)) / .4) - 4
  52 = ( (4 - sqrt(4)) \* 4!) + 4
  53 = (4! / .4bar) - (4 / 4)
  54 = ( (4 + sqrt(4)) \^ 4) / 4!
  55 = (4 / 4) + (4! / .4bar)
  56 = ( (4 \* 4) - sqrt(4)) \* 4
  57 = (4 / .4bar) + (sqrt(4) \* 4!)
  58 = ( (4 \^ 4) - 4!) / 4
  59 = (4! / .4) - (4 / 4)
  60 = ( (4 \* 4) \* 4) - 4
  61 = (4 / 4) + (4! / .4)
  62 = ( (4 \* 4) \* 4) - sqrt(4)
  63 = ( (4 \^ 4) - 4) / 4
  64 = (4 + 4) \* (4 + 4)
  65 = ( (4 \^ 4) + 4) / 4
  66 = ( (4 \* 4) \* 4) + sqrt(4)
  67 = ( (4 + 4!) / .4bar) + 4
  68 = ( (4 \* 4) \* 4) + 4
  69 = ( (sqrt(4) + 4!) / .4) + 4
  70 = ( (4 \^ 4) + 4!) / 4
  71 = ( (sqrt(4) \* 4!) - sqrt(.4bar)) / sqrt(.4bar)
  72 = ( (4 \* 4) + sqrt(4)) \* 4
  73 = ( (sqrt(4) \* 4!) + sqrt(.4bar)) / sqrt(.4bar)
  74 = (4 \* 4!) + (sqrt(4) - 4!)
  75 = ( (4 + sqrt(4)) + 4!) / .4
  76 = ( (4! - 4) \* 4) - 4
  77 = ( (4 / .4bar) \^ sqrt(4)) - 4
  78 = ( (4! - 4) \* 4) - sqrt(4)
  79 = ( (4 / .4bar) \^ sqrt(4)) - sqrt(4)
  80 = ( (4 \* 4) + 4) \* 4
  81 = ( (4 / 4) - 4) \^ 4
  82 = ( (4! - 4) \* 4) + sqrt(4)
  83 = ( (4 / .4bar) \^ sqrt(4)) + sqrt(4)
  84 = ( (4! - 4) \* 4) + 4
  85 = ( (4 / .4bar) \^ sqrt(4)) + 4
  86 = ( (4! - sqrt(4)) \* 4) - sqrt(4)
  87 = (4 \* 4!) - (4 / .4bar)
  88 = (4 \* 4!) - (4 + 4)
  89 = ( (sqrt(4) + 4!) / .4) + 4!
  90 = (4 \* 4!) - (4 + sqrt(4))
  91 = (4 \* 4!) - (sqrt(4) / .4)
  92 = 4! - (4 / 4) \* 4
  93 = (4 \* 4!) - (sqrt(4) / sqrt(.4bar))
  94 = (4 \* 4!) - (4 - sqrt(4))
  95 = (4 \* 4!) - (4 / 4)
  96 = (4 \* 4) \* (4 + sqrt(4))
  97 = (4 / 4) + (4 \* 4!)
  98 = (4 - sqrt(4)) + (4 \* 4!)
  99 = ( (sqrt(4) \* 4!) - 4) / .4bar
  100 = ( (4 + 4) + sqrt(4)) \^ sqrt(4)
  Done. (648000 loop iterations)
  Elapsed time:  8.08476805687  seconds
  %

I ran this on an Acer Ferrari 3400 laptop (which has a Mobile AMD Athlon 64 processor), under Ubuntu Edgy (with Python 2.4.4c1). I don't know what Carl ran his code on.

Assuming they are roughly comparable, the Python version was over 20 times slower. Not bad. Unlike Homer Simpson and his microwaved food, I think I can wait out the 8 seconds with patience.

If somebody has a setup to run both and compare apples with apples that would be great.

I think the itch is scratched now. On to other things.

Update:

I received an email notification of a comment from "Name", but that comment didn't automatically appear with this blog entry. It was marked as spam. I've cleared that. Name said:

"Some of the values are wrong - I noticed 92, but there are probably others. I've created a new version of this, also written in Python. It's very, very slow (30 seconds to run), but is correct. (lets hope posting it works)"

Thanks! I've put the new version here.

Update:

I've also received a Java version of Carl's original C# code from Jeffrey Olson (thanks!), which you can find here

[]

Friday Dec 01, 2006

Four Fours

Every now and then I get addicted by a puzzle. Here's the first that I was ever addicted to. It was given to me my one of my maths teachers when I was a teenager.

The goal is to just use four four's to represent all the integer numbers from 1 to 64. you can use whatever mathematical symbols you want to derive your answers. In the notation below, sqrt(x) is the square root of x and pow(x, y) is x to the power of y.

Over the years (and without the aid of a computer), I reduced the number of missing entries to 9.

Here's my solution. Digitized at last.

  1. (4 + 4) / (4 + 4)
  2. (4 / 4) + (4 / 4)
  3. 4 - sqrt(4) + (4 / 4)
  4. (4 \* 4) / (sqrt(4) + sqrt(4))
  5. 4 + sqrt(4) - (4 / 4)
  6. 4 + sqrt(4) + sqrt(4) - sqrt(4)
  7. 4 + sqrt(4) + (4 / 4)
  8. 4 + 4 + 4 - 4
  9. 4 + 4 + (4 / 4)
  10. 4 + sqrt(4) + sqrt(4) + sqrt(4)
  11. (4! / sqrt(4)) - (4 / 4)
  12. (4 \* 4) - sqrt(4) - sqrt(4)
  13. (4! / sqrt(4)) + (4 / 4)
  14. (4! / (4 - sqrt(4)) + sqrt(4)
  15. (4 \* 4) - (4 / 4)
  16. sqrt(4) \* sqrt(4) \* sqrt(4) \* sqrt(4)
  17. (4 \* 4) + (4 / 4)
  18. (4 \* 4) + 4 - sqrt(4)
  19. 4! - 4 - (4 / 4)
  20. 4 \* sqrt(4! + (4 / 4))
  21. 4! + (4 / 4) - 4
  22. 4! - 4 + 4 - sqrt(4)
  23. 4! + (4 / 4) - sqrt(4)
  24. (4! \* (4 / sqrt(4))) / sqrt(4)
  25. 4! + sqrt(4) - (4 / 4)
  26. 4! + 4 - sqrt(4)
  27. 4! + 4 - (4 / 4)
  28. 4! + sqrt(4) + (4 / sqrt(4))
  29. 4! + 4 + (4 / 4)
  30. 4! + sqrt(4) + sqrt(4) + sqrt(4)
  31. (pow(sqrt(sqrt(sqrt(4))), 4!) - sqrt(4)) / sqrt(4)
  32. (4 \* 4) + (4 \* 4)
  33. (pow(sqrt(sqrt(sqrt(4))), 4!) + sqrt(4)) / sqrt(4)
  34. 4! + 4 + 4 + sqrt(4)
  35. 4! + (4! - sqrt(4)) / sqrt(4)
  36. 4! + 4 + 4 + 4
  37. 4! + (4! + sqrt(4)) / sqrt(4)
  38. 4! + (4 \* 4) - sqrt(4)
  39. no solution
  40. (4! \* sqrt(4)) - 4 - 4
  41. sqrt(((4 + 4)! + 4!) / 4!)
  42. (4! \* sqrt(4)) - 4 - sqrt(4)
  43. no solution
  44. (4! \* sqrt(4)) - sqrt(4) - sqrt(4)
  45. no solution
  46. (4! \* sqrt(4)) - 4 + sqrt(4)
  47. (4! \* sqrt(4)) - (4 / 4)
  48. (4! \* sqrt(4)) + 4 - 4
  49. (4! \* sqrt(4)) + (4 / 4)
  50. (4! \* sqrt(4)) + 4 - sqrt(4)
  51. no solution
  52. (4! \* sqrt(4)) + sqrt(4) + sqrt(4)
  53. no solution
  54. (4! \* sqrt(4)) + sqrt(4) + 4
  55. no solution
  56. (4! \* sqrt(4)) + 4 + 4
  57. no solution
  58. pow(sqrt(sqrt(sqrt(4))), 4!) - 4 - sqrt(4)
  59. no solution
  60. pow(sqrt(sqrt(sqrt(4))), 4!) - sqrt(4) - sqrt(4)
  61. no solution
  62. pow(sqrt(sqrt(sqrt(4))), 4!) - (4 / sqrt(4))
  63. pow(sqrt(sqrt(sqrt(4))), 4!) - (4/4)
  64. 4\*4\*sqrt(4)\*sqrt(4)

I see that Carl Johansen was addicted to this too, and even wrote a C++ program to solve it. He's gone to 100 and also used .4bar (.44444...), which wasn't something I incorporated.

It's nice to see the puzzle finally solved though.

[]

About

user12607856

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today