Author: Ben North

Literate programming with git

As a follow-up to the previous post on git dendrify, I’ve been experimenting with using git to present the development of a piece of software in a more human-readable way. The hierarchical organisation described in the git dendrify README allows the history to be rendered into a structured and interactive document explaining the code’s development. As a demo, I’ve created: https://www.redfrontdoor.org/20200201-literate-git-demo/index.html [2020-02-19: updated to refer to newer version of demo] which gives an interactive presentation of the development of a web-app tutorial I wrote (in collaboration with a friend) for use with an after-school programming class at primary-school level. This was generated directly from the git repo of the web-app project, using my ‘literate git’ tools: https://github.com/bennorth/literate-git The README of

Continue reading

git-dendrify — a tool for transforming git histories

I’ve been working with git for a while now, and have been experimenting with it as a way to present the history of a piece of code in a way which makes it easier for a human reader to understand. One way I think git can help with this is by adding structure to the collection of commits. Rather than just a simple flat list of commits, you can use branches and merges to give a hierarchical structure to the presentation. However, re-drafting your (local) history in the presence of merges is troublesome, so I wrote git-dendrify to help. It transforms your history between a linear form and a structured form. For example, suppose we’re adding printing to a word

Continue reading

Bike Game in Scratch

Just over a year ago, my son (then 6) wanted to create a computer game where you drive a bike round a world. I helped him with this, and we’ve worked intermittently but fairly often on it since then. There were quite a few details to get right, but he worked through them a bit at a time, and I think the result is pretty cool. We’ve finally clicked ‘share’ on it, so it’s public: Bike Game on Scratch Here’s a video of a play-through: (There are minor changes between the version in the video compared to the released version; see below.) Game features The game takes place in a large world (7½ screens wide and 10 screens high) which

Continue reading

Flying over a trampoline

Origin of idea A couple of months ago, Sally (5) was bouncing around on the trampoline at my in-laws’ house, and said something very close to: ‘Dad, you should take lots of pictures of me jumping in the air, and put them together into a video, then it will look like I’m flying’. I thought this was a cool idea, so we did it. Source video Instead of lots of individual stills, though, I thought I’d take some video footage and pull the frames out of that. With a digital camera kindly lent to me by my in-laws, I took about 1′20″ of Sally leaping around aimlessly. This is just over 2000 frames, at 25fps. Locate her head in each

Continue reading

Mono Lake alkali flies in JavaScript

We recently went on a fantastic family camping trip to California, travelling round various National and State Parks. One of the places we saw was Mono Lake. There are lots of interesting aspects to Mono Lake, but this post concentrates on one of them: the vast numbers of alkali flies which live on the waterline. This video (by YouTube user Jeff Lowe) gives a good impression of their behaviour, and of the beautiful scenery which they inhabit: Walking along, your feet set off ‘waves’ of jumping flies, interrupting the flies’ normal meandering. I wondered whether it would be possible to create a simulation of the flies which captured some of this behaviour. In a modern browser, there should be a

Continue reading

Guess Poo: An application of nearly-orthogonal fractional factorial design

We have the game ‘Guess Who’, which comes with a selection of sheets to play variants of the original game. In a flash of comedy inspiration, my eldest, Meg, and I thought it would be excellent if there was a game called ‘Guess Poo‘. In Guess Poo, instead of trying to identify faces, you have to identify faeces. We therefore set about designing drop-in sheets for our game. (‘Guess Who’ is probably a trademark of Hasbro or Milton Bradley, and I would be very surprised indeed if either of them endorsed this post.) Choice of characteristics In the original, the faces have different values for various characteristics, such as hair colour, whether they wear glasses, gender, and so on. It

Continue reading

Faint amusement from arrows

In logic, we talk about propositions, giving them names, say p or q. For example, p might be the proposition ‘it is raining’, and q the proposition ‘I will get wet’. Then to represent the proposition ‘if it is raining then I will get wet’, we can say ‘p IMPLIES q‘, which is often written with a double-arrow: p ⇒ q. In ASCII, this can be approximated by ‘p => q‘. In full, this operator has the following truth table: p q p => q T T T T F F F T T F F T (This appears slightly strange, but the only way we can disprove the claim ‘p implies q‘ is if p happens but q doesn’t.) In many programming languages,

Continue reading