Slashdot Mirror


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?"

17 of 87 comments (clear)

  1. What about Duff's device? by chrestomanci · · Score: 5, Interesting

    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.

  2. Chess? Pah! by GregWebb · · Score: 4, Interesting

    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!

  3. Not too good by Scarblac · · Score: 5, Insightful

    The site says it looks 2 moves deep, but I don't see how it can play like this then:

    1.e4 Nc6 2.d4 Nf6 3.e5 Ne4 4.Bd3 Nxd4?? 5.Bxe4 Nxc2?? 6.Qxc2

    Leaving two knights hanging to immediate capture threats, that doesn't suggest any lookahead to me.

    But of course, it's neat that it works. People have made utilities for playing through chess games before, like PalView (a simple demo here).

    Adapting that to take user input and a very simple lookahead is work, but not stunning in my opinion. Unless there's some reason why this is very hard in JS, I don't really do that language...

    --
    I believe posters are recognized by their sig. So I made one.
  4. Strange uses for C by Anonymous Coward · · Score: 4, Funny

    Some people use the C programming language to actually attempt to write qulaity programs.

    I have to ask (slashdot) what drugs are these people taking?

  5. BaSiX by ebbe11 · · Score: 5, Interesting

    I think BaSiX ought to qualify - a BASIC interpreter written in TeX, no less.

    --

    My opinion? See above.
  6. Chess is nifty by DeadSea · · Score: 4, Interesting

    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.

  7. Language facilities and syntax not that foreign. by abdulla · · Score: 3, Interesting

    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.

  8. Its kind of cool - but... by Dukebytes · · Score: 4, Insightful
    This sort of stuff is neat - but it also makes you want to go eh?? WTF??

    I know, I know - its just a little game to see if they could do it. But geesh - I see this stuff in the OFFICE all the time. Some of the devs do stuff in java, some in VB, some in perl etc... What I hate to see is when someone is so wrapped up in VB, or java, or any language that they WILL NOT write anything in any other code.

    A few of the VB guys, they push it to the extreme, and are zelots about it. Sometimes I actually think they believe they are making the world a better place because they write in VB....

    This is cool, but man, it happens all the time and not always for the right reasons.

    Duke

    --

    FreeBSD: Nothing runs like a daemon with a pitch fork.
  9. Postscript web server by Samus · · Score: 3, Interesting

    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.
  10. Solving the N-Queens problem in XSLT by oren · · Score: 3, Interesting

    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.

  11. Obfuscated code, 1K competition by JonBob · · Score: 4, Interesting

    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).

    1. Re:Obfuscated code, 1K competition by Mr.+Sketch · · Score: 3, Funny

      Obfuscated Perl contest WTF?

      As if one would even have to try to make perl code obfuscated? How about a legable perl contest? I'm sure that would be much more difficult.

    2. Re:Obfuscated code, 1K competition by Mr.+Sketch · · Score: 3, Funny

      It isn't funny, it's on topic. After all, legible perl code does push the envelope of the language and uses it for something it was never intended.

  12. What about templates? by Bingo+Foo · · Score: 3, Informative
    C++ templates were known to be Turing-complete when they were introduced into the language, but NOBODY back then would have suspected that something like Andrei Alexandrescu's Modern C++ Design was possible.

    Every day, my appreciation for templates grows deeper. I've even thought that there ought to be another language built from the ground up around templates, one that shows more parallelism in the syntax of compile-time templates and "regular" code.

    --
    taken! (by Davidleeroth) Thanks Bingo Foo!
  13. Wolfenstein by 'The+'.$L3mm1ng · · Score: 5, Interesting

    Searching this page didn't show it up, so here's the link:

    Wolfenstein in 5kb of JavaScript

  14. Maybe interested in a HTTP-server in PHP? by 1110110001 · · Score: 4, Interesting

    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

  15. Pushing the limits by bobv-pillars-net · · Score: 5, Interesting

    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.