January 2, 2018

Quick reflection on first good Dwarf Fortress

I just retired my first good, semi-successful fort in Dwarf Fortress. I decided jot down a few comments while the memories are still fresh. My fort, Commonbread, lasted 6+ years, survived 4 goblin sieges, had 150 dwarfs at its peak, and generated more than ☼1.6M in value. Main mistakes My two principal mistakes are related: I picked a cold embark location, and I opened my gates to fight a goblin siege during late-autumn. ... Read more

November 29, 2017

Dwarf Fortress and ivy-mode

A new version of Dwarf Fortress was released last week, and it was all the incentive I needed to start playing again. I suck at DF, but I love that game: it savantly combines depth and complete wackiness and the old-school look-and-feel certainly appeals to me. Yet, I think that the game has (at least) one huge flaw: its menu system makes ed(1) look positively user-friendly by comparison. There are a lot of tasks that one can perform in Dwarf Fortress: select regions to be dug, build all kinds of shops and accessories, manage a militia, etc. ... Read more

September 13, 2017

What is a Type Error?

The top comment by /u/staticassert in a Reddit thread on type systems makes an interesting point, one that I made in the past myself: what is a type error? I read those types (pun intended) of threads often enough, and one recurring argument often made by people who doubt the benefits of type systems goes like this: “I rarely make errors that the type checker would catch; my bugs are logic in nature. ... Read more

September 6, 2017

A Simple Tip to Improve Rust Program Speed

I am on vacation this week, so I decided to dig out a backtracking Sudoku solver I wrote last summer and see what I could do to improve its performance. A couple of changes to the data structures and the algorithm yieled an important speed-up. Previously, I had used a BTreeSet to store the list of candidates for a cell; I now use a u32 to represent a set of 9 elements. ... Read more

September 3, 2017

My Review of The Talos Principle

Now that I have a slightly more powerful computer, I was finally able to play through The Talos Principle and its DLC, The Road to Gehenna. [Spoilers below] The gameplay is mostly about solving problems by using some items. You have jammers that can open doors, disable bombs and guns; boxes to hold down buttons and to increase the height of an item; connectors that relay a signal from an emitter to receivers and can open doors; fans to elevate yourself or an object; etc. ... Read more

August 7, 2017

Speedrunning a Compiler

At AdGear, the developers typically end their week at “Friday Not Friday”, a team activity from 4pm to 5pm. One person gives a presentation on any technical subject while the others listen and sip a beer to wind down before the week-end. Last week, I gave a demonstration that I called “Speedrunning a Compiler”. I wanted to show my colleagues the basics of writing a compiler, and I thought it would be more instructive if they saw code rather than an abstract flowchart. ... Read more

April 17, 2017

Less intrusive color theme

The purpose of syntax highlighting is to draw attention to certain parts of the code: it helps us to identify when a comment or a string literal is not properly terminated, when a keyword is misspelled, or when an escape sequence is invalid. Lately, I find that editors colorize too many elements and use too many colors. (This is a recently-acquired annoyance; maybe age and worse eyesight have something to do with it? ... Read more

April 13, 2017

Functional Queues

First-in first-out queues are a data structure used in many algorithms (including my favorite one—breadth-first search) and as a building block for complex functionality, the operations on queues should be as efficient as possible. This can be a bit of a challenge in a functional language: the bread-and-butter data structure of functional programming, the list, supports fast insertion and deletion at the head—ideal for enqueuing or dequeuing respectively—but operations at the other end of the list take O(n) time in the length of the list. ... Read more

April 7, 2017

Being a T.A.

Being a teaching assistant is a job that most graduate students are asked—pressured even—to do. During my time at McGill, I was a T.A. three times: twice for the introduction to compiler design class (taught by my adviser), and once for a functional programming class. It was difficult, time-consuming, and not well paid, yet being a T.A. was the best job I’ve ever had. I’ve had many bad T.A.’s when I was an undergrad; absent from the message boards, with a poor understanding of the subject, and confusing in their explanations, they make hard classes more difficult and bad classes unbearable. ... Read more

March 27, 2017

Journalistic Writing Exercises 1

I recently purchased Journalistic Writing by Robert Knight. I’m not a journalist, but I’m sure some of his lessons transfer to other areas of non-fiction writing. At the end of the first chapter, the author presents the reader with a number of sentences that contain unneeded thats, there is’s, there are’s, etc.; the goal of the exercise is to rewrite the sentences without them. Here is my attempt. There were half a dozen vintage airplanes standing in the foreground of the museum. ... Read more