December 28th, 2006
0 reactions

Mandelbrot One-liner

PowerShell Team
PowerShell Team

WaiKin Wong sent me a Mandelbrot one-liner:

$i=$j=$r=$x=$y=[float]-16; while(($y++) -lt 15) {for($x=0; ($x++) -lt 84; write-host (” .:-;!/>`)|&IH%*#”[$k -band 15]) -nonewline){$i=$k=$r=[float]0;do{$j=$r*$r-$i*$i-2+$x/25;$i=2*$r*$i+$y/10;$r=$j} while (($j*$j+$i*$i) -lt 11 -band ($k++) -lt 111)}” “}

This produces the following results:

 

:::::::::::::————————————————:::::::::::::::::::::::
:::::::::——————————————————–:::::::::::::::::::
:::::———————————-;;;;;;;;;;;——————-:::::::::::::::
:::—————————–;;;;;;;;;;;;;;;;;;;;;;;;—————:::::::::::::
—————————;;;;;;;;;;;;;!!!/-%//!!!;;;;;;;;—————::::::::::
————————;;;;;;;;;;;;;!!!!//>)I#&H /!!!;;;;;;;;————–::::::::
——————–;;;;;;;;;;;;;!!!!!!//>)|&:# &)>//!!!!;;;;;;;————–::::::
—————-;;;;;;;;;;;;;!!!!!!////>>)&-    /-&>>///!!!!;;;;;————–:::::
————;;;;;;;;;;;;!!!!!!!//>)|H))|&&H      %I||)>>>>#/!!;;;;;————-::::
——–;;;;;;;;;;!!!!!!!!!!///>>|%-   &             .H%I#H >!!;;;;;————-:::
—–;;;;;;;;;!!!!///////////>>)&:%-                      H)>/!!;;;;;————-::
-;;;;;;;;;;!!!!/>&&)>>))))>>))|&*.                        *&I>/!!;;;;————–:
;;;;;;;;!!!!!//>>|I.-!H#;% I&&I>                           #|>/!!;;;;;————–
;;;;;!!!!!///>>)|H%-;                                       I//!!;;;;;————–
!!!!/////>>>)|%*:##           #                            |>/!!!;;;;;;————-
                                                        .I|>//!!!;;;;;;————-
!!!!/////>>>)|%*:##           #                            |>/!!!;;;;;;————-
;;;;;!!!!!///>>)|H%-;                                       I//!!;;;;;————–
;;;;;;;;!!!!!//>>|I.-!H#;% I&&I>                           #|>/!!;;;;;————–
-;;;;;;;;;;!!!!/>&&)>>))))>>))|&*.                        *&I>/!!;;;;————–:
—–;;;;;;;;;!!!!///////////>>)&:%-                      H)>/!!;;;;;————-::
——–;;;;;;;;;;!!!!!!!!!!///>>|%-   &             .H%I#H >!!;;;;;————-:::
————;;;;;;;;;;;;!!!!!!!//>)|H))|&&H      %I||)>>>>#/!!;;;;;————-::::
—————-;;;;;;;;;;;;;!!!!!!////>>)&-    /-&>>///!!!!;;;;;————–:::::
——————–;;;;;;;;;;;;;!!!!!!//>)|&:# &)>//!!!!;;;;;;;————–::::::
————————;;;;;;;;;;;;;!!!!//>)I#&H /!!!;;;;;;;;————–::::::::
—————————;;;;;;;;;;;;;!!!/-%//!!!;;;;;;;;—————::::::::::
:::—————————–;;;;;;;;;;;;;;;;;;;;;;;;—————:::::::::::::
:::::———————————-;;;;;;;;;;;——————-:::::::::::::::
:::::::::——————————————————–:::::::::::::::::::
:::::::::::::————————————————:::::::::::::::::::::::

Thanks for sharing WaiKin!

 

Jeffrey Snover [MSFT]
Windows PowerShell/MMC Architect
Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

Category
PowerShell

Author

PowerShell Team
PowerShell Team

PowerShell is a task-based command-line shell and scripting language built on .NET. PowerShell helps system administrators and power-users rapidly automate tasks that manage operating systems (Linux, macOS, and Windows) and processes.

0 comments

Discussion is closed.

'; block.insertAdjacentElement('beforebegin', codeheader); let button = codeheader.querySelector('.copy-button'); button.addEventListener("click", async () => { let blockToCopy = block; await copyCode(blockToCopy, button); }); } }); async function copyCode(blockToCopy, button) { let code = blockToCopy.querySelector("code"); let text = ''; if (code) { text = code.innerText; } else { text = blockToCopy.innerText; } try { await navigator.clipboard.writeText(text); } catch (err) { console.error('Failed to copy:', err); } button.innerText = "Copied"; setTimeout(() => { button.innerHTML = '' + svgCodeIcon + ' Copy'; }, 1400); }