Carbon Monoxide Detector Followup

I clearly survived the night, though when I checked and saw that it was supposed to get down to freezing or at least near it last night I only left the windows open by a crack. I did sleep next to the balcony door though. That makes 12 hours and no headache yet, and from the labels on the detector it sounds like it’s supposed to be quiet when you hit the reset button so you can call emergency services. Guess I’ll take it over to the apartment office and see what they have to say about it.

Actually, reading more closely it says specifically that it’s supposed to beep 4 times then pause for 5 seconds, not whine constantly for 12 hours. I got a replacement one from the apartment office, and it chirped upon being plugged in and has been silent since.

Rubik’s Cube Simulator

I’m planning to try to write a Rubik’s cube solver, or rather a few tools towards one. One goal is to have a program that can breadth-first search moves from a given arrangement to reach another arrangement. That’ll probably take a significant amount of optimization to allow it to run quickly and efficiently in memory, but to be able to get that working I need a computer model of a Rubik’s cube.

This weekend I put together a Rubik’s cube simulator and a command line interface to allow interaction:
Well, this was supposed to be where I pasted the log of console output of manipulating the cube, but the formatting depends on a uniform-width font and maintaining whitespace, neither of which actually worked when I pasted it. Here’s a screenshot:

It’s still having some issues, but the example sequence I chose doesn’t show them. I also only implemented (almost) the entire set of moves that are valid on a 2-cube, but didn’t try to use any 3-cube specific moves in that sequence. Once I’ve got the last few bugs worked out of that set extending it to n-cube size is just a matter of defining the moves for that size cube puzzle as an extension off the base 2-cube moves. I was planning to have that finished tonight, but I was distracted (see my previous post) and had to settle for just finding the test cases that it fails. Didn’t have time to put them in unit tests, but if they give me enough trouble I might bother with that.

In other news, I wish I’d looked up the problem of representing a Rubik’s cube as an object before I started. I couldn’t think of a way to represent the puzzle in a way that would make manipulating it easy, so I took the approach that I’d store the data in an easily extensible form (arrays of size n*n where n is the size of the cube) and put all the logic to make it work in the code that manipulates the puzzle. This approach (from 1986) flips it around, but the end solution looks a lot simpler than mine. The way I have mine written is easily extensible to larger cubes, but done right I think that approach could be also. Since mine is almost finished I’ll get it working on the 2- and 3-cubes, then I’ll probably put together a 2-cube using that approach and see if it’s actually as simple as it looks (I don’t know APL, but I know what it’s trying to do).

At least my interface is very similar, though there aren’t all that many reasonable ways to represent a cube in ascii, and my input accepts standard cube notation, unlike his. Looking at the other search results it’s surprising that the first Google hit exactly solved one of my problems (that I’d already worked around less elegantly) when all the rest are just software puzzles, not computer science.

Carbon Monoxide Detector

My carbon monoxide detector went off today immediately after I put down a load of laundry fresh from the dryer under it. I may have bumped it, I’m not sure. Anyways, the reset button had no effect, unplugging it from the wall just switched it to battery power, and opening the windows for a breeze and waving it in the air also didn’t do a thing. Without the ability to reset it (as in have it stop whining so I know it’s testing instead of just being stuck on) I have no way of determining if it’s malfunctioning.

Carbon monoxide (according to wikipedia) is produced by burning stuff when there’s not enough oxygen, and since I haven’t smelled anything burning (carbon monoxide itself is odorless) I’m figuring the only sources of combustion in my apartment are the heater and the hot water heater (my stove and oven are both electric). I’m not counting the grilled cheese sandwich that I charred while distracted by the carbon monoxide detector. I turned off the air conditioner when I opened the windows (though I suppose it has a pilot flame, but I haven’t touched the hot water heater.

Considering the alarm has been going for a few hours now and the only thing that’s wrong with me is a vaguely upset stomach (a combination of being worried that something’s actually wrong and the fact that I ate the burnt sandwich (first I’ve bothered to make in months and the last slice of cheese I had, I wasn’t about to pass it up)) instead of a headache(the first expected symptom) I suspect it’s malfunctioning, but I’ll still sleep with the windows open tonight. I have had the suspicion that I have a headache, but I’m blaming that on constantly wondering if I’m getting one since my head doesn’t actually hurt. More importantly, Talore isn’t behaving oddly though she’s decidedly more playful, probably because I’ve been moving around the apartment instead of sitting at my computer, and since she’s rather smaller than I am I’d expect her to be affected first. On the other hand, she should be fine anyways since carbon monoxide is supposed to be lighter than air and on the floor (where she is) there’s a layer of cooler air from having the windows open. That coolness could also be a reason for her to be more playful and active, she’s responded like that before.

Since I was unable to get the sound to stop and Talore hid under the bed after it had been going for a few minutes I wrapped the detector in blankets to muffle it. The sound doesn’t carry very well (I could hear it from the other room, but it wasn’t obnoxiously loud from there), so two blankets rolled up around it contain it well enough that I have to be close and listening for it to tell if it’s still going. Of course that means there’s no airflow on it which probably isn’t helping it stop, but I don’t think having a loud, high-pitched buzzer going at 11 at night would be appreciated, especially since I have the windows open. I’ll do something about it tomorrow during the day.