Results 1 to 5 of 5
  1. #1
    HaxPro's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    Latvia
    Posts
    2,834
    Reputation
    98
    Thanks
    1,148

    C# MatriX effect

    Screen :

    Code :
    Code:
    #define readkey
    
    using System;
    
    namespace m7tr1x
    {
        class Program
        {
            static void Main(string[ ] args)
            {
                Console.Title = "tH3 M7tr1x 3ff3<t";
                Console.ForegroundColor = ConsoleColor.DarkGreen;
                Console.WindowLeft = Console.WindowTop = 0;
                Console.WindowHeight = Console.BufferHeight = Console.LargestWindowHeight;
                Console.WindowWidth = Console.BufferWidth = Console.LargestWindowWidth;
    #if readkey
                Console.WriteLine("H1T 7NY K3Y T0 C0NT1NU3 =/");
                Console.ReadKey();
    #endif
                Console.CursorVisible = false;
                int width, height;
                int[ ] y;
                int[ ] l;
                Initialize(out width, out height, out y, out l);
                int ms;
                while ( true )
                {
                    DateTime t1 = DateTime.Now;
                    MatrixStep(width, height, y, l);
                    ms = 10 - (int)( (TimeSpan)( DateTime.Now - t1 ) ).TotalMilliseconds;
                    if ( ms > 0 )
                        System.Threading.Thread.Sleep(ms);
                    if ( Console.KeyAvailable )
                        if ( Console.ReadKey().Key == ConsoleKey.F5 )
                            Initialize(out width, out height, out y, out l);
                }
            }
    
            static bool thistime = false;
    
            private static void MatrixStep(int width, int height, int[ ] y, int[ ] l)
            {
                int x;
                thistime = !thistime;
                for ( x = 0 ; x < width ; ++x )
                {
                    if ( x % 11 == 10 )
                    {
                        if ( !thistime )
                            continue;
                        Console.ForegroundColor = ConsoleColor.White;
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.DarkGreen;
                        Console.SetCursorPosition(x, inBoxY(y[x] - 2 - ( l[x] / 40 * 2 ), height));
                        Console.Write(R);
                        Console.ForegroundColor = ConsoleColor.Green;
                    }
                    Console.SetCursorPosition(x, y[x]);
                    Console.Write(R);
                    y[x] = inBoxY(y[x] + 1, height);
                    Console.SetCursorPosition(x, inBoxY(y[x] - l[x], height));
                    Console.Write(' ');
                }
            }
    
            private static void Initialize(out int width, out int height, out int[ ] y, out int[ ] l)
            {
                int h1;
                int h2 = ( h1 = ( height = Console.WindowHeight ) / 2 ) / 2;
                width = Console.WindowWidth - 1;
                y = new int[width];
                l = new int[width];
                int x;
                Console.Clear();
                for ( x = 0 ; x < width ; ++x )
                {
                    y[x] = r.Next(height);
                    l[x] = r.Next(h2 * ( ( x % 11 != 10 ) ? 2 : 1 ), h1 * ( ( x % 11 != 10 ) ? 2 : 1 ));
                }
            }
    
            static Random r = new Random();
            static char R
            {
                get
                {
                    int t = r.Next(10);
                    if ( t <= 2 )
                        return (char)( '0' + r.Next(10) );
                    else if ( t <= 4 )
                        return (char)( 'a' + r.Next(27) );
                    else if ( t <= 6 )
                        return (char)( 'A' + r.Next(27) );
                    else
                        return (char)( r.Next(32, 255) );
                }
            }
    
            public static int inBoxY(int n, int height)
            {
                n = n % height;
                if ( n < 0 )
                    return n + height;
                else
                    return n;
            }
        }
    }


    Attachment virus scan : Virustotal. MD5: b028be248262a91ab96c41da4909001d

  2. #2
    'Bruno's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Portugal
    Posts
    2,883
    Reputation
    290
    Thanks
    1,036
    My Mood
    Busy
    Leeched...

    ProgramGood.Net - Matrix Rain Effect in C# Console App

    gtfo...

    edit: you did not even change the namespace.. was totally C&P .. Give credits at least
    Last edited by 'Bruno; 07-21-2010 at 01:51 AM.
    Light travels faster than sound. That's why most people seem bright until you hear them speak.

  3. #3
    Kallisti's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    深い碧の果てに
    Posts
    4,019
    Reputation
    52
    Thanks
    376
    My Mood
    In Love
    I'm sick of copy and pasters.
    Just buy a book. They're only like $50

    未来が見えなくて怖いから
    未来が見えてしまって悲しいから
    目を閉じて優しい思い出に浸ってしまう




  4. #4
    inmate's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    Bottrop, NRW, Germany
    Posts
    131
    Reputation
    10
    Thanks
    194
    My Mood
    Amazed
    Omfg haha fail thread NR 2

    What the fuck is going with that people !?

  5. #5
    V3CT0R's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    57
    Reputation
    10
    Thanks
    22
    Another Matrix c&p fail.

Similar Threads

  1. [Info] Never Get Tired and Matrix Effect
    By Raisinets in forum Vindictus Discussions
    Replies: 12
    Last Post: 04-29-2011, 01:27 AM
  2. Rain Effect: GIMP
    By Jackal in forum Tutorials
    Replies: 3
    Last Post: 06-23-2006, 06:33 PM
  3. Spatter Effect By Drive-By
    By Paolo1993 in forum Tutorials
    Replies: 1
    Last Post: 01-28-2006, 03:11 AM
  4. Ripple Effect By Drive-By
    By Paolo1993 in forum Tutorials
    Replies: 1
    Last Post: 01-28-2006, 03:11 AM
  5. Matrix Ping Pong
    By gunot in forum General
    Replies: 4
    Last Post: 01-04-2006, 01:25 AM