Remix.run Logo
tzs 5 hours ago

I've got a brute force solver for the NYT Pips game. There's a particular puzzle that it takes 45.2 seconds on on my M2 Max Mac Studio. The solver is single threaded and doesn't use much memory so it is mostly limited by CPU and memory speed.

I ran it on my Pi 3, 4, 5, Intel iMac, and on my cheap Amazon Lightsail instance. Here are the results, in seconds:

  680.4  RPi 3
  274.5  RPi 4
  131.3  RPi 5
  108.5  Lightsail
   78.7  2017 iMac (3.4 GHz Intel Core i5)
   45.2  M2 Max Mac Studio
tomcam 3 hours ago | parent [-]

Very cool. I feel like Lightsail performed quite well. Feels like a local optimum of some kind. Mind specifying the tier?

tzs 2 hours ago | parent | next [-]

It says "512 MB RAM, 1 vCPU, 20 GV SSD" and "General Purpose". It was whatever was the cheapest when I made it.

Looking at the instance creation page it looks like it is no longer available. The cheapest now has 2 vCPU and the same other specs.

If anyone would like to run it on something else for comparison I've put it Pastebin [1].

Normally, a script converts the puzzle into a header file that describes the puzzle in terms of the data structures the solver uses, and then the solver is compiled with that header included via #include, but for benchmarking I manually included the header, so it is just a single C file that you simply compile and run. Add a -q flag to have it just find and count the solutions but not display them. For this particular puzzle it is fine to let it show the solutions. For some puzzles with a ton of solutions it displaying them can take significant time.

If anyone actually wants a Pips solver to solve Pips puzzles, there's a copy of mine along with the scripts that convert puzzles from the JSON format the NYT provides for download to the header file for the solver and some other stuff as a shar archive on Pastebin [2]. Pastebin's download link messes up something with that, so click the raw link and copy/paste from the browser.

Note: I'm still doing a lot of experimenting with it, both in the solving algorithm and in how the display the results, and am not at a point where I'm able to accept outside contributions. There are other Pips solvers that have been put on Github (and even posted on HN) that are (1) more sophisticated than mine, and (2) almost certainly more open to contributions. Just use mine if for some reason you want a fairly simple (aside from the damn display stuff...) brute force solver in C and aren't going to expect anything else from me :-)

[1] https://pastebin.com/5HmymPXw

[2] https://pastebin.com/SfSk3eNB

mappu 19 minutes ago | parent [-]

Fun!

    126 Intel N5105, gcc -O2
     59 Ryzen 7600, clang -O2 under MSYS2
andai 3 hours ago | parent | prev [-]

If it's low RAM and single threaded then I would expect every tier to perform identically.

(Also I was just looking at the pricing, you don't get any extra CPU cores until the $84 tier!)

tomcam 3 hours ago | parent [-]

Thanks for pointing that out. I had thought maybe as the tiers went up you'd get faster CPUs, but upon reflection the pricing schedule seems to confirm your point. I guess they are completely virtualized because there is not mention of CPU type on the pricing page.