1K JavaScript Madness 131
An anonymous reader writes "JS1k has a simple goal: to get programmers producing demos written in JavaScript that are 1k in size or less. That's just 1024 bytes to play with. There's even additional bonus points on offer if a demo's code can fit inside a single tweet. Now that the contest is finished and there is a top-ten, I'm wondering what they can do if given some extra bytes." I like the Tetris clone. The pulsing wires demo is neat too but kinda stuttery on my machine.
I'm sure Twitter is delighted (Score:4, Funny)
Re:I'm sure Twitter is delighted (Score:5, Funny)
About javascript in their tweets...
If they aren't just give it some time ... I'm sure it will worm its way into their hearts ;-)
Re: (Score:1, Funny)
Re: (Score:1)
<script>while(1){alert("twitter sucks");}</script>
There. Fixed that for you. I don't really think Twitter sucks, though.
js1337 (Score:4, Funny)
>I'm wondering what they can do if given some extra bytes.
In a few weeks you'll find out at js1337.com ;0)
Re: (Score:2)
>I'm wondering what they can do if given some extra bytes.
In a few weeks you'll find out at js1337.com ;0)
This sounds epic
Re: (Score:2)
And BOOM (Score:4, Funny)
Re: (Score:1)
4 comments and the site is already crawling. Reddit must have hit it first.
Re: (Score:2)
Re: (Score:2)
Still too many bytes (Score:2)
Apparently they should have made their size requirement smaller. 1024 is apparently taking too much time for their site to handle.
It is a bold demonstration as to why we
Re:And BOOM (Score:5, Funny)
Re:And BOOM (Score:5, Informative)
Re: (Score:2)
If I were entering this competition, I'd just take some old 2K atari or VIC-20 games and modify them. Stuff like Space War, Combat, Breakout, Pitfall
Re: (Score:2)
It might still be tricky to make them fit – those were often written entirely or partly in assembly language plus you had the BIOS which basically gave you a direct connection to the video display and peripherals. Printing a character or plotting a pixel was as simple as copying a number from one memory location to another. In Javascript you’d have to use a language that was intended to be human-readable (even if you obfuscate it to make it smaller) and furthermore the program itself would have
Re: (Score:2)
It's because their server is written in Javascript.
I'm pretty sure they put pictures bigger than 1K !
the most uberest slashdotting evar (Score:2)
"Hey slashdot kids. It's 4pm east coast. Here's 10 games you can play, hosted on this site here. See you all at the coffee machine in 180 seconds."
Re: (Score:2)
HUH? I do not see what the big deal is. Each script is only one single friggin kilobyte! Even though each page includes the source and some comments, and the usual HTML wrappers, I cannot imagine each page being more than about 5K to 10K each. Evan an old Pentium should be able to keep up with that kind of load.
Re: (Score:2)
...and if they used Nginx they could easily withstand both slashing and dotting
Too bad they've only got Apache with PHP
Re: (Score:2)
The size of the payload is not included??
Found a bug in tiny ches... (Score:1)
Re:Found a bug in tiny ches... (Score:4, Informative)
"[...]it will validate moves, queen-only promotion, without castling and en passant." http://nanochess.110mb.com/ [110mb.com]
Re:Found a bug in tiny ches... (Score:5, Funny)
Re: (Score:2, Funny)
That's nothing. Try this short game written in BASIC.
10 GOTO 40
20 PRINT "YOU WIN"
30 GOTO 50
40 PRINT "YOU LOSE"
50 PRINT "GAME OVER"
Re: (Score:1)
That's easy to win. Just start the program like this:
GOTO 20
Re: (Score:2)
Ok, wise guy... figure out what this does! (in the MS GW-BASIC 3.23 interpreter... I have no idea how it will behave in anything else)
1 REM my super cool game ,1
2 ON ERROR GOTO 6551
51 GOTO 6552965529
61 PRINT "game over!"
62 END
521 ON ERROR GOTO 52529
522 PRINT "wat";
523 GOTO 1652916529
651 PRINT "you lose!"
652 GOTO 61
6551 RESUME 521
16529 LOCATE
16551 IF ERL>0 AND ERL<65529 THEN PRINT "you win!"
16621 GOTO 61
52529 PRINT "the universe is broken!"
52659 RESUME 65129
65129 PRINT "you divided by zero didn't you!"
Re: (Score:2)
Re: (Score:3, Informative)
Today, a day that will live in infamy, I was beaten by a 1000 byte program.
Whippersnapper. I seem to recall being beaten more than two decades ago by a 1k chess program on a Timex/Sinclair 1000 (aka ZX81).
Possibly even this one:
http://users.ox.ac.uk/~uzdm0006/scans/1kchess/ [ox.ac.uk]
Re: (Score:2)
Re: (Score:2)
The horror!!!
(same here)
Asteroids (Score:4, Interesting)
I'm wondering what they can do if given some extra bytes."
If they use bankswitching, maybe they can pull off Asteroids [atariage.com]
Re: (Score:2)
I wish I was a better JS programmer, I'd have entered the contest (I've only done a little JS programming, and it's been a few years since I have). I made a fully functional battle tanks game back in 1982 that you could play single-player or two players playing against each other at the same time. It was under 4k as that's all the computer had without an expansion pack; I don't remember how big the actual code was, probably less than 1k. However, it was in hand-assembled Z-80 machine code for the Sinclair 1
Re: (Score:2)
I wouldn't think Asteroids would be too hard.
You're right. In Racing the Beam they say that Asteroids on the 2600 could have been done in 4k with some extra time for optimization but Atari decided that time was money and sprung for the extra ROM chips.
I wonder if this kind of thing is easier to do in Javascript. Given the size of the javascript language themselves, they have a lot more to actually work with. But then javascript is a lot more verbose than 6502 machine language.
Re: (Score:2)
Assuming that everybody wrote in assembly and used an assembler to convert it to machine code is even more stupid. I clearly remember entering "CD 27 00 ..." (bonus points to those who remember what these three bytes translated to in Zilog Z80 code) when programming.
nice (Score:1)
Re: (Score:1)
initial loading it's still important (for me at least). Big homepages remind me of MS Live search engine that had a 500k homepage and that search engine lost the race.
Also, not only dialup is slow. Broadband but shitty internet connection is also slow. Free internet is slow (airports etc). In developing countries it is slow. In Africa it is slow.
I was thinking that maybe it would be possible a lite version.
Good to know that they will remove support for old browsers.
Re: (Score:2)
Re: (Score:2, Interesting)
for my work i built a JSON-RPC development environment which automated the client and server creation like you're asking for... it's not that complicated.
jQuery is for prototyping... if you're depending on it for production systems, you're lazy.
Re: (Score:3, Insightful)
jQuery is for prototyping... if you're depending on it for production systems, you're lazy.
Or saving your employer time and money. Sometimes being "lazy" isn't so bad.
Re: (Score:1)
Re: (Score:2, Insightful)
Fast, cheap, good. Pick two. [wikipedia.org] If you're able to duplicate all the functionality you need, better than jQuery, in less time than it would have taken to use jQuery then good for you! For those of us bound by reality, perfection comes at a cost. What if, in the time it takes you to ship the "Highest Quality" product, y
Re: (Score:1)
you are NOTHING
Re: (Score:1)
to be clear, i'm tired of all of you idiots and your self-loathing justification of being as such.
Re: (Score:1)
i am capable of ceasing my injection of insight into this computer based message board. you are, however, incapable of ceasing to be an idiot.
i am incredible. you are NOTHING.
Re: (Score:1)
Re: (Score:1)
you are NOTHING.
Closure (Score:4, Informative)
You want a static code analysis tool that can perform dead code elimination. It looks like Google's Closure Complier [google.com] will do that for JavaScript code.
Re: (Score:1)
Re: (Score:1)
i'm not sure they WILL remove support for old browsers, but as they did the size would reduce.
coral-cached copies of each one (Score:5, Informative)
Legend Of The Bouncing Beholder [nyud.net]
Tiny chess [nyud.net]
Tetris with sound [nyud.net]
WOLF1K and the rainbow characters [nyud.net]
Binary clock [nyud.net]
Mother fucking lasers [nyud.net]
Graphical layout engine [nyud.net]
Crazy multiplayer 2-sided Pong [nyud.net]
Morse code generator [nyud.net]
Pulsing 3d wires [nyud.net]
Re: (Score:2)
Nope. Slashdotted those, too. Someone needs to put these on some embiggener iron.
Re: (Score:1)
Not that it matters at all, but the "Tiny Chess" cannot castle with the king rook (at least).
Other than that, it looks pretty nice!
Re: (Score:2)
Genetic approach (Score:3, Interesting)
Re: (Score:2)
Sure. But how do you define "minor variations" such that more than a handful out of "thousands" function at all?
Re: (Score:2)
Re: (Score:2, Offtopic)
I think if you can devise a few variation methods that work at all, you could make a good guess at which lead to the smallest code.
What you need are thousands of methods of varying the code, and millions of iterations looking for working results, and then a cost function (in this case merely size) to choose the optimal result.
Re:Genetic approach (Score:4, Insightful)
Checking each if it followed the predefined rules would be time consuming. For instance, in Pacman, you might have to have the computer play a full game to check if the rules are met.
Almost all the programs would be utter nonsense.
Re: (Score:2, Informative)
Sorry to spoil your party, but you will be dealing with issues in automatic software verification which themselves are infeasible.
This is one problem you can't just throw a bunch of computing power (yet) and it will magically find it a small solution in a reasonable amount of time.
Just fyi, assuming each character has 256 different possibilities in a 1000 byte program in js, there are 256^1000 possibilities, or 2^8000 possible programs to choose from.
To put that into perspective, current estimates on the nu
Re: (Score:2)
Not even close ... 10^80 == 2^333
Re: (Score:2)
Your problem then lies in making a PERFECT "driver". If it's not perfect, you'll end up with code highly effective at tricking it, and doing NOTHING ELSE. This is what viruses are for.
Your suggestion is just like using a random number generator to write books... First, spell-check.
Reminds me of thek5.org (Score:2, Interesting)
Re: (Score:2)
I remember that, and I still have the Mandlebrot applet I wrote for it. I've also had good fun with the Java 4k [java4k.com] contest.
Playing some chess... (Score:1, Funny)
Chess in 1024 bytes and I can't win it. What a shame.
Nostalgic Terminology (Score:3, Interesting)
Re: (Score:3, Informative)
I remember them, there were lots of 'em. All computer magazines back then had programs you could type in. IIRC most of them were BASIC, although a few were assembly. Heck, the original Wolfenstein came on a 540k floppy and shareware DOOM was two of them IIRC.
Re: (Score:2)
COMPUTE!'s Gazette including listings each month. If I remember, maybe a third of the magazine was devoted to pages upon pages of hex listings. You'd use their machine language entry program "MLX" (BASIC code for which was included verbatim in every single issue -- you'd have to type THAT in first) and sit there for hours typing in the code. It had a simple checksum scheme, so each line was 9 bytes with the last byte being a checksum. If you made a mistake, you found out at the end of the line when the thin
Re: (Score:2)
Alas, mine got left behind after my divorce when I moved from the big two story house to a small apartment. My then-teenaged daughter, seeing what I'd rented for us, wailed "My ROOM was bigger than this apartment!"
I miss the old IBM XT even more, though. It would probably be worth some money now.
Grrr (Score:2)
Got beaten by the feckin' 1K chess game in about a dozen moves. Feck!
Re: (Score:1)
Don't feel bad, the game doesn't even let you castle...
wtf (Score:1, Insightful)
>>Now that the contest is finished and there is a top-...
WTF tell me I can win shit then say it's over >:/
What to do with extra bytes (Score:1)
I'm wondering what they can do if given some extra bytes
Get them all to work in Internet Explorer. Most demos give errors in IE8x64.
Re: (Score:2)
window.onerror=function(){this.onerror=void(alert('Get a better browser!'))}
Done.
Re: (Score:2, Flamebait)
Part of the competition was to use Canvas tags in interesting ways, and considering IE9 doesn't even support Canvas I think you're out of luck unless you get a standards compliant browser.
Re: (Score:2)
What standard you are talking about? Wikipedia: HTML5 is currently under development.
Readability... (Score:2, Interesting)
Re: (Score:2)
Re: (Score:2)
That is called magic...
Chess (Score:3, Interesting)
Re: (Score:2)
Doesn't do castling... but he's got one byte left...!
Very impressive.
Just.
Tweets (Score:2)
So that kid that made the self-posting Twitter worm the other day wins by default?
1K programs bring back the old days. (Score:1)
What about Perl? (Score:3, Interesting)
It just hit me--think of all the stuff you could do in a Perl program that would fit into one tweet?
Re: (Score:2)
Think of all of the things you COULDN'T do in Lisp if you could only use 1k parens...... :D
Re: (Score:2)
It just hit me--think of all the stuff you could do in a Perl program that would fit into one tweet?
I hope it hits you unconscious next time. Because I'd hate to see that piece of Perl, my day job already exposes me to an indecent amount of vulgar Perl :-)
Re: (Score:2)
That's a good point.
Note to self: When hiring Perl programmers, look for heavy drinkers.
Kilobytes, as God (Knuth) intended (Score:3, Funny)
I can't believe this story's been up for nearly two hours and no one's rushed in to explain that these are one kibibyte demos, thus depriving us of our right to make fun of them and their dumb-sounding pet units.
Re: (Score:2)
Really? Only 1k? (Score:1, Redundant)
Re: (Score:2)
Is this list [pouet.net] looking better to you? And some of those are even released on multiple platforms :)
Making of the WOLF1K entry (Score:1, Interesting)
Here's the making of of WOLF1K and the rainbow characters [p01.org] the Wolfenstein 3D-ish game sans violence in 1k that game #4
IE9? (Score:1)
Hardly any on those work in IE9.
Raymarching using Distance Fields in 1K (Score:1)
madness...? (Score:1)
Re: (Score:2)
Re: (Score:2)
# Must work on current fx, sa, ch and o. (Let's level the playing field)
It doesn't say it supports IE anyway.
Have a nice day.
Re:Internet Explorere cannot open... (Score:4, Funny)
That's a joke, right? Do you really expect Internet Explorer to run cutting-edge web stuff?
Try Chrome, Safari, Opera or Firefox.
Re: (Score:2)
That's why it's the last on my list. Opera has some catching-up to do too, last time I tested a few things, Chrome and Safari ran fine but Opera hadn't implemented them yet, such as HTML5 file uploading (for client-side progress bars).
Re: (Score:2)
I believe the site is "wicked witch of the west.com" and someone threw a bucket of water at it. Maybe its server is programmed in javascript?