Proje olarakVB.NET İÇİNDİR
seçiyorsunuz.console application
Ardından kod penceresine şunları yapıştırın.
module module1
sub main(byval args as string())
console.title = "matrix"
console.foregroundcolor = consolecolor.darkgreen
console.windowleft = ınlineassignhelper(console.windowtop, 0)
console.windowheight = ınlineassignhelper(console.bufferheight, console.largestwindowheight)
console.windowwidth = ınlineassignhelper(console.bufferwidth, console.largestwindowwidth)
#ıf readkey then
console.writeline("devam et")
console.readkey()
#end ıf
console.cursorvisible = false
dim width as ınteger, height as ınteger
dim y as ınteger()
dim l as ınteger()
ınitialize(width, height, y, l)
dim ms as ınteger
while true
dim t1 as datetime = datetime.now
matrixstep(width, height, y, l)
ms = 10 - cınt(directcast((datetime.now - t1), timespan).totalmilliseconds)
ıf ms > 0 then
system.threading.thread.sleep(ms)
end ıf
ıf console.keyavailable then
ıf console.readkey().key = consolekey.f5 then
ınitialize(width, height, y, l)
end ıf
end ıf
end while
end sub
dim thistime as boolean = false
sub matrixstep(byval width as ınteger, byval height as ınteger, byval y as ınteger(), byval l as ınteger())
dim x as ınteger
thistime = not thistime
for x = 0 to width - 1
ıf x mod 11 = 10 then
ıf not thistime then
continue for
end ıf
console.foregroundcolor = consolecolor.white
else
console.foregroundcolor = consolecolor.darkgreen
console.setcursorposition(x, inboxy(cınt(y(x) - 2 - (l(x) / 40 * 2)), height))
console.write("okan bahadır")
console.foregroundcolor = consolecolor.green
end ıf
console.setcursorposition(x, y(x))
console.write("tht")
y(x) = inboxy(y(x) + 1, height)
console.setcursorposition(x, inboxy(y(x) - l(x), height))
console.write(" "c)
next
end sub
private sub ınitialize(byref width as ınteger, byref height as ınteger, byref y as ınteger(), byref l as ınteger())
dim h1 as ınteger
dim h2 as ınteger = cınt((ınlineassignhelper(h1, cınt((ınlineassignhelper(height, console.windowheight)) / 2))) / 2)
width = console.windowwidth - 1
y = new ınteger(width - 1) {}
l = new ınteger(width - 1) {}
dim x as ınteger
console.clear()
for x = 0 to width - 1
y(x) = m_r.[next](height)
l(x) = m_r.[next](h2 * (ıf((x mod 11 <> 10), 2, 1)), h1 * (ıf((x mod 11 <> 10), 2, 1)))
next
end sub
dim m_r as new random()
private readonly property r() as char
get
dim t as ınteger = m_r.[next](10)
ıf t <= 2 then
return cchar(("0"c & m_r.[next](10)))
elseıf t <= 4 then
return cchar(("a"c & m_r.[next](27)))
elseıf t <= 6 then
return cchar(("a"c & m_r.[next](27)))
else
return cchar(cchar(cstr((m_r.[next](32, 255)))))
end ıf
end get
end property
public function inboxy(byval n as ınteger, byval height as ınteger) as ınteger
n = n mod height
ıf n < 0 then
return n + height
else
return n
end ıf
end function
private function ınlineassignhelper(of t)(byref target as t, byval value as t) as t
target = value
return value
end function
end module
değiştirmenizgereken yerleri kırmızıyla çizdim.
Son düzenleme: