Skip to content

Comment on Show HN: an extremely simple program shows a 2D structure in the integers

Comments

For any lazy C# folks:

    internal class Program
    {
        public static void Main()
        {
            int numRows = 256;
            int numColumns = 128;
            for (int row = 0; row < numRows; row++)
            {
                StringBuilder rowOutput = new StringBuilder();
                for (int column = 0; column < numColumns; column++)
                {
                    if ((row & column) != 0) rowOutput.Append("1");
                    else rowOutput.Append("0");
                }
                Console.WriteLine("row/col {0}:\t{1}", row, rowOutput);
            }
            Console.Read();
        }
    }
Cool stuff, very interesting to see that triangle structure emerge.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.