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();
}


Print | posted @ Wednesday, January 03, 2007 4:10 AM

Comments on this entry:

Gravatar # re: A Message For You
by BT at 1/3/2007 5:14 AM

Very cool!
  
Gravatar # re: A Message For You
by Walt Ritscher at 1/3/2007 7:32 AM

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.
  
Gravatar # re: A Message For You
by jayson knight at 1/3/2007 9:32 AM

Tres cool...you've got way too much free time ;-).
  
Gravatar # re: A Message For You
by Laurent Duveau at 1/9/2007 12:44 AM

impressed!
  
Comments have been closed on this topic.