Play a game whose entire code fits inside a tweet

Oh dear, dear samsam :). Lack of an xhtml or html5 doctype means it forces the browser into quirks mode. Which is why it can disregard the initial html root element (malformed), the Head element (malformed), and closing tags. Furthermore, since it is in quirks mode, many browser will happily support style=float: left, but I’m not convinced the p tag was needed in the first place.

1 Like
print SOME SHIT calculate+REALLYBIGNUMBERSTUFF'nMULTIPLYITYO ifthatringdon'tshine THEN FUCKIT results "varied"-img.{bag o' dicks] HELL YEAH

Lit majors, AHOY!!

1 Like

If the p tag wasn’t used, what would you use to apply the positioning-style + onclick-code to the X? a p or i are most of the single-char tags out there.


[edit] Or do you mean the closing tags? In FireFox, at least, the closing p and body tags can be omitted, saving another 11 chars.


How is that cheating? IIRC, most of the entrants is JS1K contents use minifiers, and write with the goal of maximizing those optimizations in mind. If they can get a speech synthesizer out of it, I dinnae think it counts as cheeting, d’ye kennit?

That’s why I said slightly. And just position it in body, like a Mensch.

obscure joke ahead
And as much as I love JAPH, if you use both a map and eval, or two of each (even if encoded!) You are offside sir!

I SAID GOOD DAY SIR!!

There’s no need to condescend.

I stand by my statement that no one in their right minds would need to use a minifier for this. The only thing that is similar to what a minifier would do is to use one-letter variable names. I don’t see any others.

Furthermore, a minifier generally does not use the first-letter of the original names, instead most use fairly arbitrary letters. Using the reasonable variables date, time, score, and elapsed, I threw this unto UglifyJS and it spit back r, n, a, and t. This was obviously done by hand – and not necessarily because he “was mimicking a minifier” but because that’s what any programmer would do to fit the code in 140 chars, whether or not they’d seen a minifier.

The other minimization steps, like declaring and incrementing score inside the Date.now() method, are lateral-thinking and not something that any minimizer would do.

As for quirks mode, yes, that is indeed malformed html (again, could have said that without the condescension), though I’m not sure how you could do it without the p tag. There also don’t seem to be any extra quotes that are not needed.

1 Like

L ALL B

<body onload=d=Date.now,t=d(s=0) onclick="(e=d(++s)-t)<15e3?style.margin=e%300+' 0 0 '+e*7%300:alert(s)">X

That’s 106 characters, now (was: 139).

I like the trick of variable initialization and incrementalization taking place in the parameter-passing to a method that takes no parameters.

I don’t think he was being condescending so much as… overly familiar. Just tell him he smells like a spoilt cheese, and he’ll run away to check that his fridge is not causing his cheeses to spoil, and all will be well.

Or do I need to put that in words of less that one syllable? *

 

 

* Now that’s condescension!


If you look at the code I posted above, it seems that @japhroaig was correct (aaaargh, it pains me to say that!), and we can dispense with both the p-tag, and at least one pair of quotes; it saves 33 characters.

Unfortunately, that doesn’t work, unless you explicitly shrink the body size to the size of the X (which will take more characters). As it is, you can click anywhere to the bottom or right of the X and it will count as a click.

That’s why I think p is necessary, as it shrink-wraps its contents.

1 Like

Hrm. Now that you mention it, it seems that anywhere to the right of the X (same line) takes a click (FF, IE11, Chrome).

Still, worked better than I was expecting.

At any rate, we can lose a pair of quotes and all closing tags:

<body onload=d=Date.now,t=d(s=0)><p style=float:left onclick="(e=d(++s)-t)<15e3?style.margin=e%300+' 0 0 '+e*7%300:alert(s)">X

Sadly, that only saves ud 13 characters, but does restrict clicks to the X. Which seems somewhat important.


#NOTE TO MODDERS/HACKERS/CHEATERS

If your cheat/mod/hack plus original code doesn’t fit within 140 characters, your hack/cheat/mod is doesn’t count, as it wouldn’t even fit into the Starfleet Academy network.

Yup, that works fine now.

Note, though, unless you plan to add more functionality to the game (e.g. changing the X into boobies, as @Daneyul’s nude mod), it doesn’t change much to make it less than 140 chars, though. :wink:

You’ve got 13 extra characters. Go, make the game more interesting.

I wasn’t being condescending. The code is entirely readable. At least one online minifier creates code with almost identical cadence (maybe they have the same authors).

IS MY CHEESE IN DANGER!?

Oh thank FSM, still perfect.

2 Likes

I’m on it!

<body onload=d=Date.now,t=d(s=0)><p style=float:left onclick="(e=d(++s)-t)<15e3?style.margin=e%300+' 0 0 '+e*7%300:alert(s)">(   o    )(    o    )
1 Like

What the goatse?!?!? A pair of gaping buttocks?

I strive for that very ambiguity in all my <144 character games. It’s what makes them so compelling. There are no “right” answers. I’m glad to see my hours of coding and careful design succeeded.

(But seriously, it’s boobs. Really wide boobs.)

Yeah, no. Assholes.

So, this is like a goatse stimulator?

Are you blind??? Here’s what you’re thinking of:

<body onload=d=Date.now,t=d(s=0)><p style=float:left onclick="(e=d(++s)-t)<15e3?style.margin=e%300+' 0 0 '+e*7%300:alert(s)">(   *    )(    *    )

Not quite done though. Do you happen to know the Ascii symbol for anal wart?

nah, mang, those are puckering, they aren’t even stretched.

Sorry for the… gaping omission. I was going by memory. Long repressed memory, and I’d, uh, like to keep it that way?

What the hell, I’ll probably lose a buttload, but I hearby ass-ign you full rights to all further development of the Goatse Simulator. Take it. Take it all. All of it!

1 Like

Well with my current load it’s a bit of a stretch, but I’ll see if anything opens up.

1 Like