Code That Pushed the Language Envelope?
Lil Fritz asks: "Following on from the cool Flash Adventure game last week, this geezer Neil Pearce has written a full client side JavaScript CPU chess player (which drew with me, but then I'm papz at Chess). Now this sort of thing always amazes me. Doing stuff for which it was never intended. Do we have other warped (ie 'they wrote it in what?!?') uses of languages and tools?"
When I first saw it, I was amazed that it worked, but I would say it pushed the limits
Code example and discussion in the Jargon File
For a more detailed explation see here.
Can't post the code, due to Lameness filter.
If we think about it, Chess is only requiring a lot of processing on the client side. It's a waste of CPU power but nothing more.
I remember being rather more impressed when a friend wrote a Tetris clone in JavaScript. Interactive, real-time processing in JavaScript? Well done.
Greg
(Inside a nuclear plant)
Aaaarrrggh! Run! The canary has mutated!
It falls to a scholar's mate.
Wants to reload the icons every move too on my 56k connection for some odd reason.
I think BaSiX ought to qualify - a BASIC interpreter written in TeX, no less.
My opinion? See above.
Along the same vein, a couple weeks ago I coded Tic-Tac-Toe in JavaScript complete with an alpha-beta search such that the when it is in expert mode, you cannot beat your web browser. Solving the whole game on my computer takes about 5 seconds, so I added an opening book to compute the first move. With that response time is pretty much instantaneous even in expert mode.
JavaScript's syntax and language facilities are pretty similar to C, it's not that far fetched that he was able to do this, and considering that a lot of Mozilla is controlled via JavaScript, it doesn't suprise me that this is possible.
I seem to remember a web server writen in postscript being mentioned on /. some years back. It seems like a pretty big stretch to me having a language designed for displaying text and graphics serve out web pages.
In Republican America phones tap you.
Once upon a time there was an argument whether XSLT was turing-complete (this was when the spec was being worked out), so I posted an XSLT "stylesheet" that places N queens on an NxN chessboard so that none threatens the other. You can see the post here: http://www.biglist.com/lists/xsl-list/archives/199 906/msg00289.html and the stylesheet here: http://www.biglist.com/lists/xsl-list/archives/199 906/bin00003.bin. That's a pretty twisted piece of code if I do say so myself :-) Strangely enough it has been actually "used" - to benchmark XSLT processors etc. (e.g., here: http://www.machi.pe.kr/xml/document/xslt/xslt_benc hmark.htm.
Lots of "barrier pushing" code can be found in obfuscation contests. Check out the Obfuscated C contest or the Obfuscated Perl contest. For similar feats on the web, check out The 5k (which recently featured a lightweight chess entry).
Searching this page didn't show it up, so here's the link:
Wolfenstein in 5kb of JavaScript
Not coincidentally, one on my pet projects that I want to spend time on is to make (or find if it already exists) a generic plug-in module in Mozilla that can do the same thing with no external hardware outside a vanilla PC sound card (or on board chip). Links anyone?
...Open Source isn't the only answer -- but it's almost always a better value than the alternatives...
The other day I played around with PHP's socket-extension. After some reading I thought about a normal server-service I could try. A webserver came to my mind. So I made up a HTTP-server/daemon in PHP. PHP should be an extension to a webserver not a webserver itself, that's why it might fit into this topic.
...
I played around with it and tested it with apache benchmark. As I'm able to handle multiple request it got pretty fast and stable - even faster then pure apache (no wonder - it has more features).
The advantage of this webserver is, you don't need any php-optimizer as everything in your application gets includes in the webserver and loaded with it. If anyone wants the code just tell me
b4n
here
How about a program that compiles and runs in seven different languages?
http://www.nyx.net/~gthompso/poly/polyglot.txt
Or a program that prints its own source code?
http://www.nyx.net/~gthompso/quine.htm
Or just a whole collection of weird programming-related stuff?
http://www.catseye.mb.ca/
(OK, so I'm way too late to the party and nobody's going to read this, but hey :)
At a company where I worked in the early '90s, I used to write batch files that really pushed the limits. I tried to avoid using third-party utilities such as 4DOS so they'd run about anywhere but I sure used the standard DOS utilities. Some of my batch files used pipes and redirects to script EDLIN to search and replace data in text files. Some used ASCII control codes to send color data to the ANSI.SYS driver. They called me ".bat man". I still have a Batman coffee mug at work. It was a joke then, but nobody gets it anymore. :) These days, I'd just use Perl.
assert(birth_date<time-86400)
I know a guy who wrote a program to calculate Pi to an arbitrary number of digits in
You ready for this?
DOS
He wrote the entire progeram as a series of .BAT files that recursively called each other.
No external programs, no tricks. Nothing but the native capabilities of COMMAND.COM. Local variables were stored in the environment, and globals were stored in files.
It ran really slow.
The Web is like Usenet, but
the elephants are untrained.
I used to have Pac-Man written entirely within MS Excel.
a n. zip
Should be able to grab it from
http://www.winsite.com/info/pc/win3/excel/pac-m
May not have pushed the limit, but it was pretty cool nonetheless. Boss key? We don't need no shtinkin boss key!