// Matrix rain: goto moves the cursor anywhere, color changes the text colour use random, chrono fun main() { width = screen_width() height = screen_height() - 1 trail = 10 letters = "abcdefghijklmnopqrstuvwxyz0123456789".chars() // one drop in every second column; each has its own place and speed columns = [] drops = [] speeds = [] for (x in 0 to width step 2) { columns.add(x) drops.add(random(-height to 0)) speeds.add(random(1 to 4)) } command("cls") cursor(false) for (frame in 1 to 500) { // the old heads turn green, the tails disappear, the drops move down color("green") for (i in 0 to columns.len()) { if (frame % speeds[i] == 0) { y = drops[i] if (y >= 0 and y < height) { goto(columns[i], y) print(random(letters)) } if (y - trail >= 0 and y - trail < height) { goto(columns[i], y - trail) print(" ") } drops[i] = y + 1 if (y - trail > height) { drops[i] = random(-height to 0) } } } // the new heads are white color("white") for (i in 0 to columns.len()) { if (frame % speeds[i] == 0 and drops[i] >= 0 and drops[i] < height) { goto(columns[i], drops[i]) print(random(letters)) } } sleep(0.03) } color("reset") cursor(true) command("cls") printl("wake up, neo") }