Center window on primary screen — Win32, C/C++ — below, featuring workiness. Our long national nightmare is now over:
UnadjustWindowRectEx etc.
I’ve been doing some Win32 programming lately and just wanted to flag this old Raymond Chen post in which he defines a simple function that fills a hole in the Win32 API and has a nice why-didnt-I-think-of-that quality to it. Note, Chen says that AdjustWindowRect handles scroll bars but I think that is wrong. AdjustWindowRect works without a window handle so it is not possible…
How to Convert a GDI+ Image to an OpenCV Matrix in C++…
You have to convert the gdi+ image to a gdi+ bitmap and then to an OpenCV matrix. There is no easier way to do the first conversion than creating a bitmap and painting the image into it, as far as I know. To perform the second conversion (Gdiplus::Bitmap -> cv::Mat), note that Mat constructors order their parameters rows then columns so that is Bitmap height…
Is there hexagonal analog of Conway’s Game of Life?
The short answer is that in the hexagonal case the best analog of Conway’s Game of Life — in my opinion as someone who has been a CA hobbyist for 30 years or so — is an original creation which I will describe for the first time in detail in this blog post. (Note: The links to cellular automata in this post go to a…
Some cellular automata
A friend of mine, Jack Kutilek, wrote a web-based player for the CA rules format that I used in Lifelike — basically simple JSON files that describe a state table and the meta-information you need to execute the CA the state table encodes. It uses WebGL and a fragment shader and as such is very fast. I made a little web page interface here, some…
Lifelike, or the Joy of Killing Time via Breeding Little Squiggles
A couple of weeks ago I got interested in this project but wanted full control of the code, wanted to know exactly what it is doing, wanted a bunch of features like the ability to import and export CA rules, and wanted to have the process not be seeded by cellular automata already featuring gliders (which the web app seems to be). To this end I…
A Woven Icosahedron
You can weave an icosahedron from 10 strips of paper — or anyway you can weave a construction that has icosahedral geometry; it is actually more of a snub icosahedron. From about 11″ strips of printer paper folded lengthwise to have two layers with a little overlap to lock into rings, as pictured below, locks well and is rigid: Construction follows the pattern implied by…
A higher order sonobe ball
Below is a modular origami construction known as the 120-unit sonobe ball. It has the geometry of an icosidodecahedron but with the 12 pentagonal faces of the icosidodecahedron split into five of the little equilateral pyramids that sonobe units demand. The above was made from 120 Post-it notes, three sets of forty in each color. I haven’t seen anyone post a picture of one…
Review of Neal Stephenson’s Seveneves
I’m the kind of reader of Neal Stephenson who likes Snow Crash, Diamond Age, and Anathem but has never succeeded in plodding through Cryptonomicon (I tried twice!) and who has never even tried to read the Baroque Cycle, not being a masochist. I’m a reluctant fan. I wish he would realize that just because the research he has been doing on the historical use of mercury in…
Draak Update
Below is gameplay video of a prototype of the puzzle game “Draak” that I am working on. Draak will be an iPad-only iOS game; the prototype below is written to Windows in C# on top of MonoGame. The initial idea for this game was about the art. I thought it would be cool to make a game that looks like an animated version of one…