PoshCode Archive  Artifact [54fd7411ab]

Artifact 54fd7411ab5aaf7aadcd13870f5469f3ab2dc696fcaccb98958bc160f03ac8f3:

  • File Number-River.ps1 — part of check-in [3486203a0b] at 2018-06-10 14:14:41 on branch trunk — Displays a constant stream of numbers and spaces. This can cause patterns to form and can be mesmerizing :) (user: Nathan Estell size: 2446)

# encoding: ascii
# api: powershell
# title: Number River
# description: Displays a constant stream of numbers and spaces. This can cause patterns to form and can be mesmerizing :)
# version: 0.1
# type: script
# author: Nathan Estell
# license: CC0
# x-poshcode-id: 6384
# x-archived: 2016-10-18T11:00:07
# x-published: 2016-06-14T18:10:00
#
#
#Programmer Name: Nathan Estell
#Date: 8/14/2015
#Description: Displays a constant stream of numbers and spaces. This can cause patterns to form and can be mesmerizing :)

$max=10000 #This affects the balance between blank space and numbers. The higher this number, the more space the numbers take up.
$backGroundColor="Black"
$foreGroundColor="Green"

for (;;)
{
$r=(get-random -max $max).tostring()
#[int]$firstDigitRN=$randomNumber[0]
<# Possible way of implementing spaces with loop
for ($i=0;$i -lt $firstDigitRN;$i++)
{
" " | write-host -backgroundcolor $backGroundColor -foregroundcolor $foreGroundColor -NoNewLine
}
#>
#Implementing the spaces with if statements

if ($r.startswith(0))
{
"" | write-host -backgroundcolor $backGroundColor -foregroundcolor $foreGroundColor -NoNewLine
}
if ($r.startswith(1))
{
" " | write-host -backgroundcolor $backGroundColor -foregroundcolor $foreGroundColor -NoNewLine
}
if ($r.startswith(2))
{
"  " | write-host -backgroundcolor $backGroundColor -foregroundcolor $foreGroundColor -NoNewLine
}
if ($r.startswith(3))
{
"   " | write-host -backgroundcolor $backGroundColor -foregroundcolor $foreGroundColor -NoNewLine
}
if ($r.startswith(4))
{
"    " | write-host -backgroundcolor $backGroundColor -foregroundcolor $foreGroundColor -NoNewLine
}
if ($r.startswith(5))
{
"     " | write-host -backgroundcolor $backGroundColor -foregroundcolor $foreGroundColor -NoNewLine
}
if ($r.startswith(6))
{
"      " | write-host -backgroundcolor $backGroundColor -foregroundcolor $foreGroundColor -NoNewLine
}
if ($r.startswith(7))
{
"       " | write-host -backgroundcolor $backGroundColor -foregroundcolor $foreGroundColor -NoNewLine
}
if ($r.startswith(8))
{
"        " | write-host -backgroundcolor $backGroundColor -foregroundcolor $foreGroundColor -NoNewLine
}
if ($r.startswith(9))
{
"         " | write-host -backgroundcolor $backGroundColor -foregroundcolor $foreGroundColor -NoNewLine
}

$r | write-host -backgroundcolor $backGroundColor -foregroundcolor $foreGroundColor -NoNewLine
}