A Message For You

Some might say it's a day late, but nevertheless, it is a message. And it's for you.

Of course, you'll have to figure out what the message is by reading the source code. This year's code isn't quite as ugly as last year's code, but if you can figure this one out without a compiler - three cheers! If you do figure it out, you might still want to run the code as a console application to see the full effect...

using System;
using System.Collections;

class _2007_
{
    
static void Main()
    {
        
int x, y; x = y = 0;
        
Console.SetWindowSize(84, 7);
        
do
        {
            
foreach (string i in Order)
            {
                
foreach (int n in numbers[Int32.Parse(i)])
                {
                    
Console.SetCursorPosition(x + n % 5,
                                              y + n / 5);
                    
Console.ForegroundColor = SomeColor;
                    
Console.Write("@");
                }
                x += 6;
            }
        }
while (!Console.KeyAvailable && (x = y = 0) < 1);
    }

    
static IEnumerable Order
    {
        
get
        {
            
yield return 4.ToString(); yield return 6.ToString();
            
yield return 2.ToString(); yield return 2.ToString();
            
yield return 1.ToString(); yield return 0.ToString();
            
yield return 3.ToString(); yield return 8.ToString();
            
yield return 5.ToString(); yield return 0.ToString();
            
yield return 1.ToString(); yield return 8.ToString();
            
yield return 6.ToString(); yield return 7.ToString();
        }
    }

    
static int[][] numbers =
    {            
        
new int[] { },
        
new int[] {0,4,5,9,11,12,13,17,22},
        
new int[] {0,1,2,3,5,9,10,11,12,13,15,20},
        
new int[] {0,4,5,6,9,10,12,14,15,18,19,20,24},
        
new int[] {0,4,5,9,10,11,12,13,14,15,19,20,24},
        
new int[] {0,4,5,9,10,14,15,17,19,20,21,23,24},
        
new int[] {1,2,3,5,9,10,11,12,13,14,15,19,20,24},
        
new int[] {0,1,2,3,4,5,9,10,11,12,13,15,18,20,24},
        
new int[] {0,1,2,3,4,5,10,11,12,13,14,15,20,21,22,23,24}
    };

    
static ConsoleColor SomeColor
    {
        
get
        {
            
return (ConsoleColor)colors.GetValue(
                    rand.Next(colors.Length)
                );
        }
    }

    
static Array colors = Enum.GetValues(typeof(ConsoleColor));
    
static Random rand = new Random();
}


posted on Tuesday, January 02, 2007 11:10 PM by scott

Comments

Tuesday, January 02, 2007 9:14 PM by BT

# re: A Message For You

Very cool!
Tuesday, January 02, 2007 11:32 PM by Walt Ritscher

# re: A Message For You

Harsh, making us figure out the x,y plots in our head.
I had to get the graph paper out to plot your @ points but I eventually got it. All those years with the word puzzle books finally paid off.
Wednesday, January 03, 2007 1:32 AM by jayson knight

# re: A Message For You

Tres cool...you've got way too much free time ;-).
Monday, January 08, 2007 4:44 PM by Laurent Duveau

# re: A Message For You

impressed!
Monday, January 08, 2007 6:34 PM by Community Blogs

# Best wishes : the geek way!

If you have 1 min and VS already opened, just try this : http://odetocode.com/Blogs/scott/archive/2007/01/02/9667.aspx
Tuesday, February 06, 2007 6:41 PM by Laurent Duveau

# Best wishes : the geek way!

If you have 1 min and VS already opened, just try this : http://odetocode.com/Blogs/scott/archive/2007/01/02/9667.aspx
Thursday, November 08, 2007 7:11 PM by Laurent Duveau

# Best wishes : the geek way!

If you have 1 min and VS already opened, just try this : http://odetocode.com/Blogs/scott/archive/2007