Matrix effect

This is a cool little application I found deep in my folder structure :D
No idea where I got it from, and no idea who is the author of it.

Uhm… this application is a simulation of The Matrix, like seen in the movie I suppose :D looks really cool. Runs only on Windows.

Download: matrix.exe

Code (Now I don’t know if this is the real code, but it looks like it isn’t…):

Imports System
Module Module1
Sub Main(ByVal args As String())
    Console.Title = "tH3 M7tr1x 3ff3<t"
    Console.ForegroundColor = ConsoleColor.DarkGreen
    Console.WindowLeft = InlineAssignHelper(Console.WindowTop, 0)
    Console.WindowHeight = InlineAssignHelper(Console.BufferHeight, Console.LargestWindowHeight)
    Console.WindowWidth = InlineAssignHelper(Console.BufferWidth, Console.LargestWindowWidth)
    #If readkey Then
    Console.WriteLine("H1T 7NY K3Y T0 C0NT1NU3 =/")
    #End If
    Console.CursorVisible = False
    Dim width As Integer, height As Integer
    Dim y As Integer()
    Dim l As Integer()
    Initialize(width, height, y, l)
    Dim ms As Integer
    While True
        Dim t1 As DateTime = DateTime.Now
        MatrixStep(width, height, y, l)
        ms = 10 - CInt(DirectCast((DateTime.Now - t1), TimeSpan).TotalMilliseconds)
        If ms > 0 Then
        End If
        If Console.KeyAvailable Then
            If Console.ReadKey().Key = ConsoleKey.F5 Then
                Initialize(width, height, y, l)
            End If
        End If
        End While
    End Sub
    Dim thistime As Boolean = False
    Sub MatrixStep(ByVal width As Integer, ByVal height As Integer, ByVal y As Integer(), ByVal l As Integer())
        Dim x As Integer
        thistime = Not thistime
        For x = 0 To width - 1
            If x Mod 11 = 10 Then
                If Not thistime Then
                    Continue For
                End If
                Console.ForegroundColor = ConsoleColor.White
                Console.ForegroundColor = ConsoleColor.DarkGreen
                Console.SetCursorPosition(x, inBoxY(CInt(y(x) - 2 - (l(x) / 40 * 2)), height))
                Console.ForegroundColor = ConsoleColor.Green
            End If
            Console.SetCursorPosition(x, y(x))
            y(x) = inBoxY(y(x) + 1, height)
            Console.SetCursorPosition(x, inBoxY(y(x) - l(x), height))
            Console.Write(" "c)
    End Sub
    Private Sub Initialize(ByRef width As Integer, ByRef height As Integer, ByRef y As Integer(), ByRef l As Integer())
        Dim h1 As Integer
        Dim h2 As Integer = CInt((InlineAssignHelper(h1, CInt((InlineAssignHelper(height, Console.WindowHeight)) / 2))) / 2)
        width = Console.WindowWidth - 1
        y = New Integer(width - 1) {}
        l = New Integer(width - 1) {}
        Dim x As Integer
        For x = 0 To width - 1
            y(x) = m_r.[Next](height)
            l(x) = m_r.[Next](h2 * (If((x Mod 11 <> 10), 2, 1)), h1 * (If((x Mod 11 <> 10), 2, 1)))
    End Sub
    Dim m_r As New Random()
    Private ReadOnly Property R() As Char
    Dim t As Integer = m_r.[Next](10)
    If t <= 2 Then
        Return CChar(("0"c & m_r.[Next](10)))
    ElseIf t <= 4 Then
        Return CChar(("a"c & m_r.[Next](27)))
    ElseIf t <= 6 Then
        Return CChar(("A"c & m_r.[Next](27)))
        Return CChar(CChar(CStr((m_r.[Next](32, 255)))))
    End If
    End Get
End Property
Public Function inBoxY(ByVal n As Integer, ByVal height As Integer) As Integer
    n = n Mod height
    If n < 0 Then
        Return n + height
        Return n
    End If
End Function
Private Function InlineAssignHelper(Of T)(ByRef target As T, ByVal value As T) As T
    target = value
    Return value
End Function
End Module

Inline Feedbacks
View all comments