The Sierpinski Triangle

Do you remember when you first learned about recursion? The thought triggered a memory from an old CS101 Java course. The textbook had some fractal triangle thing made with only 20 lines of code. At the time, it was a confusing 20 lines of code. A quick search on Google for “fractal triangle recursion” led straight to the Sierpinski triangle. A Sierpinski triangle generator with an ncurses visualization is a fun afternoon project. ...

February 7, 2024 · 6 min

The Game of Life

If you grind old Advent of Code problems, you might notice a particular style of problem crop up more than once. The people of Reddit refer to their solutions as a variation of Conway’s Game of Life (GoL). Wikipedia has a great article on GoL. The animations are eye catching. The Wiki serves as motivation for a terminal app that visualizes GoL simulations. Rules of the Game What are the GoL rules? The setup is simple. You have an MxN grid of “cells.” Each cell is always in one of two states: live or dead. The grid transitions through states on a frame tick. You apply the following rule at each tick. ...

December 1, 2023 · 6 min

ncube: A Cube in Your Terminal

You ever come across one of those ASMR programming videos? This video where the developer programs a terminal display with a couple of spinning cubes is neat. This video is the motivation for the development of a ncurses application that renders a user controlled 3D cube. Perspective Projection and Rotation Matrices So how do you take an object in 3D space and visualize it in 2D space? The answer is perspective projection. Many videos explain the technique in detail. One of the better videos is “Carl the Person”’s (cool name by the way) video tutorial: ...

November 16, 2023 · 6 min

Binary Rain

Most programmers young and old have seen the cyberpunk sci-fi film The Matrix. One of the most outstanding parts of the movie is the closing scene where Neo sees the Matrix when battling the Agents: The visual effect with the code running along all the surfaces is iconic. Seems other people thought so too to the point that the effect has a name: Matrix Digital Rain. Wouldn’t it be neat to create a terminal screensaver that mimicked the effect seen in the movie? ...

July 23, 2023 · 6 min

Snake in the Terminal

Are you a text user interface enjoyer? Have you always wondered how difficult is it to write an ncurses UI? What better way to find out than to write a program of your own that explores ncurses’ API. Of course, you have to keep it interesting. Why not implement a scaled down version of a retro arcade game: snake. The Rules of Snake Step one of this project is to look up what the rules for a game of snake are. Specifically, what does the play “arena” look like, how do you win, and how do you lose? ...

June 17, 2023 · 14 min