Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

Matrix Code [C#]

There's probably a thousand of this on the forum but there's always new people around here so I'm going to post this...
This is how it will look like:

[img]http://i.min.us/ikBPwK.png[/img]

Step 1) Start a new console application in C#.
Step 2) Delete every line of code and paste this code (I didn't coded this, just found it on the netz and thought about sharing it):

Code
#define readkey

using System;

namespace m7tr1x
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Title = "Dos monitor";
            Console.ForegroundColor = ConsoleColor.DarkGreen;
            Console.WindowLeft = Console.WindowTop = 0;
            Console.WindowHeight = Console.BufferHeight = Console.LargestWindowHeight;
            Console.WindowWidth = Console.BufferWidth = Console.LargestWindowWidth;

#if 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;
        }
    }
}

Step 3) Save it and build it.
Step 4) Go to bin folder, run it and enjoy. 🤝🤝
this looks mean!

im going to test it right now.

will it work in Visual C# 2008?

[Image: 2f4032b5f1170bc8fedd7e367c680327.png]

Awesome, im trying to learn C# ^^
(Apr 9, 2011 06:50 PM)Alison Wonderland Wrote:  this looks mean!

im going to test it right now.

will it work in Visual C# 2008?

Yes. I guess so! 🤝
wow its realy nice thanks you bro +1 rap
(Apr 9, 2011 06:50 PM)vullux Wrote:  Awesome, im trying to learn C# ^^

Kewl! Enjoy mate... 😎

(Apr 9, 2011 06:55 PM)besimbicer Wrote:  wow its realy nice thanks you bro +1 rap

Thanks for the "rap" bro! 🤣
Works Great. I think it just needs to be faster then it will look awesome

edit

Make less code replace

Code
Console.WindowHeight = Console.BufferHeight = Console.LargestWindowHeight;
    Console.WindowWidth = Console.BufferWidth = Console.LargestWindowWidth;

with

Code
Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight);

[Image: 2f4032b5f1170bc8fedd7e367c680327.png]

I remember making one of these when I was learning c#.
haha cool code, :) i cant wait to learn more.
Hey, nice code stuff. I'm making a program that makes you look like a pro hacker when you show it to others, and this will add into my collection (ofcourse, credits).

One thing im just asking is how can I make a smaller window of it, instead of full screen? I changed:

Console.WindowHeight = Console.BufferHeight = Console.LargestWindowHeight;
Console.WindowWidth = Console.BufferWidth = Console.LargestWindowWidth;

Into:

Console.WindowHeight = 740;
Console.WindowWidth = 300;

But it doesnt work, gives me an error when I try to debug. Any help? I'd like to resize it to normal CMD size.
Aha, never seen that before. It looks jokes.

(Apr 10, 2011 10:35 AM)Jinxyy Wrote:  Hey, nice code stuff. I'm making a program that makes you look like a pro hacker when you show it to others, and this will add into my collection (ofcourse, credits).

One thing im just asking is how can I make a smaller window of it, instead of full screen? I changed:

Console.WindowHeight = Console.BufferHeight = Console.LargestWindowHeight;
Console.WindowWidth = Console.BufferWidth = Console.LargestWindowWidth;

Into:

Console.WindowHeight = 740;
Console.WindowWidth = 300;

But it doesnt work, gives me an error when I try to debug. Any help? I'd like to resize it to normal CMD size.

Just delete the two following lines and it will be the default size:
Code
Console.WindowHeight = Console.BufferHeight = Console.LargestWindowHeight;
Console.WindowWidth = Console.BufferWidth = Console.LargestWindowWidth;
(Apr 10, 2011 10:35 AM)Jinxyy Wrote:  Hey, nice code stuff. I'm making a program that makes you look like a pro hacker when you show it to others, and this will add into my collection (ofcourse, credits).

One thing im just asking is how can I make a smaller window of it, instead of full screen? I changed:

Console.WindowHeight = Console.BufferHeight = Console.LargestWindowHeight;
Console.WindowWidth = Console.BufferWidth = Console.LargestWindowWidth;

Into:

Console.WindowHeight = 740;
Console.WindowWidth = 300;

But it doesnt work, gives me an error when I try to debug. Any help? I'd like to resize it to normal CMD size.

I guess tw0n answered it for me. 🤝

(Apr 10, 2011 10:41 AM)tw0n Wrote:  Just delete the two following lines and it will be the default size:
Code
Console.WindowHeight = Console.BufferHeight = Console.LargestWindowHeight;
Console.WindowWidth = Console.BufferWidth = Console.LargestWindowWidth;
Looks awsome
And since my Dos is blue instead of lame black it makes it even cooler
By the way if you want to troll a computer store (well, it's customers), go to a computer that's turned on, open up CMD, type in

color a
tree C:\

Nice program! If i have time I'm gonna convert this to a screensaver soon. 👍


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by ComputroniumApr 11, 2018 09:48 AM 3 209 Apr 11, 2018 09:48 AM
Last Post: Computronium
[Java] by AutowallNov 24, 2017 09:03 PM 2 238 Nov 24, 2017 09:03 PM
Last Post: Marduno
[Java] by HostyShotsMar 13, 2017 07:33 AM 0 105 Mar 13, 2017 07:33 AM
Last Post: HostyShots