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.

Advertisements

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.

Truth

Proposition calculus deals with statements and the relation between statements, where each of them can only be in one of two states; \vdash p \lor \lnot p. Therefore, when working with finitely many connected propositions, one can algorithmically determine all possible truth values of all atomic and thus connected propositions.

Truth is command-line tool which was written to precisely perform those computations; computing a logical expression’s truth value. Download link: truth.py
A list of all supportet operators can be seen by invoking the tool with a --help flag.
This project was inspired by Albert Menne’s Einführung in die Logik1; the operator syntax used is similar to his, translated to be 7-bit-ASCII-compatible.

Truth can be used to either verify universally true statements, e.g. tertium non datur and a property of the replication, verum sequitur ex quodlibet.

-(p&-p) <-> 1  ,  1 <- p
1 0010   1  1     1 1  0
1 1001   1  1     1 1  1

Though not only absolute truth, but also complete relational equivalence between two expressions can be shown.

(p->q)|(r>-<s) <-> q|(r|s)&-(r&s)|-p
 01 0 1 0 0 0   1  00 000 01 000 110
 10 0 0 0 0 0   1  00 000 01 000 001
 01 1 1 0 0 0   1  11 000 01 000 110
 11 1 1 0 0 0   1  11 000 01 000 101
 01 0 1 1 1 0   1  01 110 11 100 110
 10 0 1 1 1 0   1  01 110 11 100 101
 01 1 1 1 1 0   1  11 110 11 100 110
 11 1 1 1 1 0   1  11 110 11 100 101
 01 0 1 0 1 1   1  01 011 11 001 110
 10 0 1 0 1 1   1  01 011 11 001 101
 01 1 1 0 1 1   1  11 011 11 001 110
 11 1 1 0 1 1   1  11 011 11 001 101
 01 0 1 1 0 1   1  00 111 00 111 110
 10 0 0 1 0 1   1  00 111 00 111 001
 01 1 1 1 0 1   1  11 111 00 111 110
 11 1 1 1 0 1   1  11 111 00 111 101

Complete contravalence can also be shown.

-(p/-p>-<0)|p->q<-r >-< p&-q&r
0 0110 1 0 101 01 0  1  001000
0 1101 1 0 110 01 0  1  111000
0 0110 1 0 101 11 0  1  000100
0 1101 1 0 111 11 0  1  100100
0 0110 1 0 101 01 1  1  001001
0 1101 1 0 010 00 1  1  111011
0 0110 1 0 101 11 1  1  000101
0 1101 1 0 111 11 1  1  100101

1Menne, Albert: Einführung in die Logik. Bern: Franke, 1966. (= Dalp-Taschenbücher; 384 D)