Mostly Misaligned Mirrors

Recently my stochastic professor introduced me to a problem he has been pondering for over two decades: on the two-dimensional integer lattice \mathbb{Z}^2 one shall flip a three-sided coin for each point and uniformly place one of three mirrors, \{\diagup,\,\cdot\,,\diagdown\}, where \,\cdot\, denotes not placing a mirror. After having populated the world, one picks their favorite integer tuple and points a beam of light in one of the four cardinal directions. With what probability does the light fall into a loop, never fully escaping?

Simulating a beam of light bouncing off mirrors.
A cycle which includes the origin.

Continue reading

Foam Cube Puzzle

After having solved the puzzle shown below a few times by combining six foam pieces to construct a hollow cube, I wondered if it had a unique solution. A simple brute-force search reveals it does. Source code: foam_cube.py

Foam Cube Puzzle
All six foam pieces.

As a first step I digitalized all pieces seen above. Having an internal representation, I wrote a script which tries all possible rotations and reflections (as three-dimensional rotations can imply two-dimensional reflection) to try and construct a three-dimensional cube from the given pieces. Using short-circuit evaluation to not bother with already impossible solutions, the search space is narrow enough to not require any considerable computing time. The resulting unique solution modulo rotation is shown above; the top face is placed on the bottom right.

Conky Clock

For a few months now, I have been a vivid user of the ArchLabs distribution which — in a recent release — added the system monitor Conky to display various pieces of information such as uptime, CPU usage and UTC time.

However, Conky does not statically produce a wall of text and plops it on your desktop; it periodically updates itself as to be able to display time-dependent information.
Furthermore, it allows to be fully configured through a simple ~/.config/conky/ArchLabs.conkyrc file.

I wanted to display a useful time-dependent piece of information which does not require user interaction of any kind and found it — an analogue ASCII-art clock.

Conky Clock
Time smiley optional.

For installation, download conky_clock.py and add a ${exec python <chosen_path>/conky_clock.py} line to your conky configuration file.