An attempt at a C++ port of domasimu