I've been trying to do something that seems surprisingly challenging --- printing an equilateral triangle to the command line (Terminal for Mac OS X). I have a program that can compute the nth row of Pascal's triangle up to some user-specified constant. As is well known, if one takes the values of Pascal's triangle modulo two, there is a correlation between that and Sierpinski's triangle.
I have been setting odd values to be 1 and even values to be 0, and when I print the results on the Terminal and zoom out, it looks nice, apart from the fact that it's clearly not equilateral. Here is an example output of my program after zooming way out (so zeroes and ones look much different):
But I'm wondering ... is there a way to get this triangle to look equilateral? Or do I have to print the output somewhere else? I've been experimenting with different fonts, different line width levels, but I can't get anything to look close to equilateral, and even if it does, I don't have a reliable way of checking for this. Part of the problem is also that zooming in/out on the Terminal results in different line width and height scales.
My code takes in as input the number of rows to generate. Then, it takes that number into account when printing out each row. So the first row (which is just a single "1") would have n-1 spaces to print before printing the 1. Then the second row has to print n-2 spaces before printing its actual contents (which are "1 1"), which includes a space between each number, and so on. It's in C++, but I don't think that should matter.
I suspect that I'll need to find some other way of getting the image out, so any advice about libraries to use would be great.