Automating the world one-liner at a time…
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 ArchitectVisit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShellVisit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
That's cheating - it's concatenated. It's just a big run-on sentence.
Still - it's pretty cool.
I wonder if we can write a one-liner that can get a robot to Mars. Hmmm... World Domination...Hmmm...COntrol!!!!.....I wan't control! PowerSHell Rules!!!! He! He! He!.
> That's cheating - it's concatenated. It's just a big run-on sentence.
Busted. :-)
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
How about some PowerShell quines?
okay, that's the coolest thing i've seen in a while. top stuff.
Somewhat related to this: I've been doing some performance comparisons with PowerShell and other scripting solutions on Windows (JScript.NET, WSF).
I came across a non-one-line version of the mandelbrot generator and used it for the tests.
http://ps1.soapyfrog.com/blog/files/powershell_is_slow.html