Oh? It looked sort of like stuff that a few friends of mine are doing (something about quantum and matrix groups), but my linear algebra's not good enough :P
"I cdn'uolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg: the phaonmneel pweor of the hmuan mnid. Aoccdrnig to a rseearch taem at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, the olny iprmoatnt tihng is taht the frist and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it wouthit a porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Scuh a cdonition is arppoiatrely cllaed Typoglycemia .
Befunge, 9x9
I have no idea why I did this. It took way too long. I have a massive headache now.
8>v_20gv
v9<^v#<4
1@,/<>^6
v1,*$:<p
->,!-^87
:^*25<^g
_88g,^^4
9vp\v#6<
@
Output:
@
@
@
@
@
@
@
@
$$$$$$$$
Some ...
Befunge has two memory locations: an operator stack and the 'fungespace'. The latter is a 2D grid (infinite in Befunge-98) initialised to the source code, and is used both for storage and for the actual code (so you can dynamically generate code at run-time)
One of the stated goals of Befunge was to make it as hard as possible to compile :P
There are lots of "interesting" tricks to pull when golfing Befunge.. for instance, loops are often a single line of the from .#v_, so to negate the condition you'd do .!#_, but there's a more clever way: reverse the IP direction so that you get v_# instead, going left-to-right
@Geobits I think optimisation will definitely cost characters.
For starters, the shortest is probably to just enumerate all 3^n leffturn-rightturn-straightahead tuples and check them for validity and eliminate duplicates.
Optimisation will be done either by pruning that search space, which costs characters, or by solving subset sum twice (which should be O(2^n), which I also think should take more characters.
It's definitely not one of those problems where there's an elegant solution that's both short and fast enough to be hard to beat.
Hmm. How do you toggle the visibility of a control? According to this guy:
.MyControlVisible { blah; foo; visibility:visible;}
.MyControlHidden { blah; foo; visibility:hidden;}
What language is this written in?
popularity-contest / code-challenge (I have no idea what other tags are applicable here.)
You know how you sometimes spot a snippet of code and immediately know what programming language it is? For this challenge, I want you to think about how you do this, and ...
@PeterTaylor k... do you think the spec and scoring for the fastest-code part are solid?
@Rainbolt regarding your comment... a) you misquoted me... b) I cannot possibly know if another language exists in which any piece of code is valid, plus any piece of code is a polyglot (brainfuck + HQ9+ + whitespace + Lenguage + ...)
the criterion is that the code makes much more sense in one language than another. if you see a piece of Python code, you wouldn't immediately think "damn is this Python or Whitespace?"
would you?
so I think presenting the program with a Python snippet, one can reasonably expect it to not take it for Whitespace, even though it's a polyglot.
well that's the thing with optimisation challenges that can't be solved optimally... I can't tell you how my brain counts grains of rice either, but it still makes for a valid challenge.
cool, so say I whitelist languages... even then I don't think I can be 100% sure no two of them could have a polyglot... but I guess I could just check that no piece of code actually chosen for the challenge is actually valid in two of them.
but then the programs are again limited to the exact set of snippets I provide for the challenge, which ruins the entire idea.
So you can either whitelist (which ruins the entire idea) or pop contest (the place where specs go when they are unclear but too cool to ditch)
When I wrote my comment, I (maybe wrongly) assumed that you wanted to pull the challenge out of pop contest territory. I'm not out to ruin your challenge. I just made two suggestions that would make the winner objectively identifiable.
I don't see how a challenge where you could get the output wrong is unclear. That's what half the optimisation code-challenges are like. If I tell you how to figure out the language from the snippet, I'm prescribing an algorithm, which doesn't make any sense either.
@Rainbolt Yes, and I appreciate that. But I think any attempt to make it this rigid will make it an inverse kolmogorov-complexity/regex-golf challenge.
I apologize for making a recommendation that would solve this problem. Next time I'll be sure to just point out the hole in your spec and leave suggestions to everyone else.
hm, with outputting every language it might not... what I said was choosing the sets such that only one answer is possible... that would have limited the challenge to this set, because there would be snippets out there, that aren't valid in only one language
anyway... I might just scrap the challenge... I can't see how I would determine reliably all the languages that a couple hundred pieces of code are valid in... except by limiting the languages way too much
Background
Consider a (closed) chain of rods, each of which has integer length. How many distinct hole-free polyominoes can you form with a given chain? Or in other words, how many different non-self-intersecting polygons with axis-aligned sides can you form with a given chain?
Let's look at an...
btw I came up with this challenge while idly staring at the Site Stats box on the front page and feeling the sudden urge to fold the top right corner inside o.O