Update write-fractal.ps1 and write-matrix.ps1

This commit is contained in:
Markus Fleschutz
2022-11-05 17:53:23 +01:00
parent 2c2567fe5c
commit fa694a5278
2 changed files with 61 additions and 397 deletions

View File

@ -27,7 +27,7 @@ function CalculateFractal([float]$left, [float]$top, [float]$xside, [float]$ysid
$zy = $zoom * $zx * $zy + $cy
$zx = $tempx
}
$global:buffer[$y * $maxx + $x] = $([char](65 + $count))
$global:buf[$y * $maxx + $x] = $([char](65 + $count))
}
}
}
@ -41,20 +41,20 @@ $rui = $ui.rawui
[float]$yside = 0.45
$buffer0 = ""
1..($rui.MaxWindowSize.Width * $rui.MaxWindowSize.Height) | ForEach-Object { $buffer0 += " " }
$global:buffer = $buffer0.ToCharArray()
$global:buf = $buffer0.ToCharArray()
while ($true) {
for ([float]$zoom = 4.0; $zoom -gt 1.1; $zoom -= 0.02) {
CalculateFractal $left $top $xside $yside $zoom
[console]::SetCursorPosition(0,0)
[string]$drawscreen = New-Object system.string($global:buffer, 0, $global:buffer.Length)
Write-Host -foreground green $drawscreen -noNewline
[string]$Screen = New-Object system.string($global:buf, 0, $global:buf.Length)
Write-Host -foreground green $Screen -noNewline
}
for ([float]$zoom = 1.1; $zoom -lt 4.0; $zoom += 0.02) {
CalculateFractal $left $top $xside $yside $zoom
[console]::SetCursorPosition(0,0)
[string]$drawscreen = New-Object system.string($global:buffer, 0, $global:buffer.Length)
Write-Host -foreground green $drawscreen -noNewline
[string]$Screen = New-Object system.string($global:buf, 0, $global:buf.Length)
Write-Host -foreground green $Screen -noNewline
}
}
exit 0 # success