# encoding: ascii
# api: powershell
# title: Infinite Staircase
# description: Creates a stepped diagonal line going down to the right, then down to the left.
# version: 0.1
# author: Nathan Estell
# license: CC0
# x-poshcode-id: 6380
# x-archived: 2016-10-06T10:50:49
# x-published: 2016-06-14T18:01:00
#
#
$spaces=0
for ([int]$rownum=1;;$rownum++)
{
$StairDirection=[math]::floor($rownum/50)%2
if ($StairDirection -eq 0)
{
for ($i=0; $i -lt $spaces; $i++)
{
Write-Host " " -NoNewLine
}
$spaces++
}
if ($StairDirection -eq 1)
{
for ($j=0; $j -lt $spaces; $j++)
{
Write-Host " " -NoNewLine
}
$spaces--
if ($spaces -eq -1)
{
$spaces=1
}
}
Write-Host " " -BackgroundColor "Green"
}