Minetest Cereal, Week 01: Initial commit

The Mintest world format is problematic. Designed more or less by accident, you could not reasonably open it up with a SQL client and look up all the Lava blocks within 500 meters of sea level. I'm writing a tool to convert to, and from, a more accessible format.

My first goal is to do a conversion of the block positions, so they can be accessed as simple X,Y,Z coordinates. According to the current documentation, the authors of the format didn't know that SQLite can store data with multiple primary keys, so they used a math algorithm to mangle the coordinates into a single number and never looked back. The algorithm is weird enough that they don't even try to explain it: there's just some Python you could use to make the translation yourself.

I'm using Racket instead of Python for this project. Python is great, but the style and process taught in How to Code - Systematic Program Design (HTC-SPD) class is much more rigorous for writing clear and accessible code, and I want to stick to that as closely as I can. This week I got started by translating their sample code into a small library with tests, much as I'd expect to do with the course.

Racket also has libraries to handle database connections and command line arguments, so it was very easy to write a command line tool that accepts the filename for a SQLite database and connects to it. The results have been posted to the Mintest Cereal github repository.

The next thing to do is merge these parts together so that I can read, convert, and save the block data. There are are also two questions I may need to explore further:

  1. The HTC-SPD class has students keep the function tests in the same file as the function libraries, at least to get started. I'm betting there is a more conventional method for separating them from the libraries. What does that convention look like in Racket?
  2. Both the db and cmdline libraries are using #: to denote keyword arguments. How exactly should those be used?