What is the Sandbox?

This "Sandbox" is a place where Code Golf users can get feedback on prospective challenges they wish to post to the main page. This is useful because writing a clear and fully specified challenge on the first try can be difficult. There is a much better chance of your challenge being well received if you post it in the Sandbox first.

See the Sandbox FAQ for more information on how to use the Sandbox.

Get the Sandbox Viewer to view the sandbox more easily

To add an inline tag to a proposal use shortcut link syntax with a prefix: [tag:king-of-the-hill]

A Continuously Running KOTH, or "An MMO with all AIs"

This was an idea discussed in chat, I'm throwing a sandbox post together because I thought it would be really fun to do.

The main idea is that the KOTH is hosted an an external website, where the competitions is continuously running. When a person submits an answer, that player's pixels (or whatever they're called) will be spawned in the game world. Over time, build a larger army of themselves.

Basically, it's an MMO with all AIs.

As of right now, I don't have the capability to host a website for this. I think someone (Optimizer?) said that they had a website. Regardless, we probably don't have to worry about that until we figure out what the rules are going to be.

Some ideas

• The world is a large array of randomly generated pixels. Every submission has a unique color. As pixels travel around, they can encounter other pixels of the same color, which then activate and join them.
• A more Minecraft-y options involve more detailed resource gathering / crafting. Con: the complexity can get pretty hard for contestants.
• A space theme can involve a randomly generated galaxy, which players can travel across. They can then colonize planets and build an empire. (Maybe resembling EVE Online?)
• Some recommendations for ideas are Clash of Clans and Globulation 2, although I've never played either.
• Maybe each player controls an adventure in a super-simplified Dwarf Fortress-style world.

You are free to edit this post to add ideas.

• Sounds really interesting! But I think the backend of this can get really complicated... – rorlork Apr 6 '15 at 22:16
• Would it be possible for a player to die out completely, so that the answer is permanently out of the competition? Is there some way that this could be prevented so every answer is represented, even if only by a very small number of pixels/creatures/... – trichoplax Apr 7 '15 at 21:33
• Respawning with a single individual would be one way. – trichoplax Apr 7 '15 at 21:35
• Alternatively each individual could have resilience inversely proportional to the number of individuals the player currently controls. So as the individuals reduce in number they get stronger, preventing the final individual from ever being killed. – trichoplax Apr 7 '15 at 21:36
• @trichoplax None of the specifics have really been thought through yet, but I think it would make sense to say that, upon death, players lose resources, but can't go below what they started the game with. – PhiNotPi Apr 7 '15 at 21:37
print $a[1]-1 ." "; }  Here, the function nine() takes the source code of the C program and manipulates it to get the number 9, then adds a space to the printed output. For scoring purposes, only the subroutine counts - the additional code was added for illustration purposes only and need not be listed on an entry in general. The input string for the next function will start with the "s" in "sub" and go through the final "}" The score for this function is thus 54 (including the actually unnecessary CRs and spaces). The technique used here is string splitting. An entry that included this code would thus look like this: 9: Perl sub nine{ @a=split(/"/,$_[0]);
print \$a[1]-1 ." ";
}


Score: 54

Technique: String split

...

Total

Base score: (54 + ... ) = 512

Unique techniques: 8

Final score: (512 / 8) = 64

• The goal of the rules is to 1) avoid trivial solutions and 2) encourage thinking about the next step while writing the current one. If the rules need to be added to enhance either aim, let me know.
• Is ten functions too many? I could start the count at 5 if that seems better
• I think 10 is good, as it encourages users to be ever more creative with each function. – mbomb007 Sep 10 '15 at 20:44
• "Doing something meaningful" is very hard to make precise. – Peter Taylor Sep 10 '15 at 20:54
• @Peter I defined it as having variable output based on the input. While something as simple as an if statement will cause that to happen, I think it might be OK when combined with the incentive for different techniques - 10 trivial "if input >=< something" routines won't be a very good score anyway as all techniques will be "comparison". Of course I'm open to better wording suggestions. :) – ThaddeusB Sep 10 '15 at 21:29
• @ThaddeusB Great idea. +1 – mınxomaτ Sep 16 '15 at 3:21

The Algebra of Reflecting Points

This is a challenge based on manipulating points with a specific set of operations, each dealing with the reflection of some points over others.

Warning: There's not actually a challenge here yet, just the basis for a challenge that could be to "simplify the given expression" or something.

Lists of Points

The fundamental object is an ordered list of points, like (A,B,C) or ([2,3],[5,8],[6,8]).

Reflection

A r B represents the reflection of point A across point B, resulting in a new point C so that B is the midpoint of AC.

A r (B,C,D) represents the reflection over a series of points, and is equivalent to A r B r C r D.

(A,B,C) r (D,E) represents (Ar(D,E),Br(D,E),Cr(D,E)), with either list being of any positive length.

The result of the reflection operator is a list of points that is the same length as the first operand. (If the first operand is a single point, then the output is a single point.)

A list with a single point is that same as that single point. (B) == B

Lists can be arbitrary grouped inside of other lists. (A,B,C,D) == (A,(B,C),D) == ((A,B,C),D)

Simplification

A point reflected over itself is an identity, CrC is the same as C. Any point reflected over the same point twice is an identity, rCrC can be removed.

(A,B,C) equals (C,B,A)

For any three points ABC there exists a unique fourth point D=C-B+A such that anything r (A,B,C) = anything r D. This means that any long chain of ArBrCrDrErF... can be reduced to have fewer than three rs.

((A,...,B)r(C,...,D)) == ((D,...,C),(A,...,B),(C,...,D)) and (ArB) == (B,A,B)

Examples

Show that Cr(CrA)rB == Cr(BrArC)

Cr(CrA)rB         #original
Cr(A,C,A)rB       #expanding 4th simplification rule
CrArCrArB         #the list is equivalent to a series of rs
CrAr(C,A,B)       #grouping to form a list
CrAr(B,A,C)       #swapping, the 2nd simplification rule
CrArBrArC         #expanding list
CrCrArBrArC       #Identity operation of C=CrC
Cr(C,A,B,A,C)     #listifying
Cr((C,A),B,(A,C)) #further grouping
Cr(Br(A,C))       #using the 4th simplification rule
Cr(BrArC)         #expanding parenthesis


Here is this proof visualized geometrically.

Whose Llama is it anyways?

BetaDecay posted a legit looking movie poster in chat, which got me into thinking that this could be a very nice challenge!

Your task is to overlay a nifty llama poster on top of a movie poster in a way that it still looks a legitimate movie poster. The image posted by Beta Decay is:

a http://pictures.boxxspring.com/pictures/960x0/100588

Your program will be provided with an input of fixed size (TBD) movie poster of any popular movie and a fixed llama cutout to overlay that poster as arguments. You may scale (proportionally), rotate or translate the llama cutout anywhere on the movie poster to make it look like a llama is photobombing the poster. At the same time, the output image should still look like a legitimate movie poster in a way the above poster feels real. You cannot perform any operations on the movie poster and no other operations on the cutout other than scaling, rotation and translation.

This is a popularity contest, so the answer with the most net votes wins. Voters are encouraged to judge answers by:

• The correct placement of the cutout such that it does not outright look like a cutout
• The scaling of the cutout to match with people/objects in the movie poster
• The placement of the cutout with respect to the movie text. i.e. The cutout should not hide the movie title in a way that its no longer understandable.

Input

Two images in any common image format. The input can come as paths to the images or the images themselves (if your language support image input) either as function arguments, ARGV, STDIN or equivalent.

The first image (movie poster) will be of fixed resolution and the second image (the llama cutout) will be of enough resolution in order to have good quality even after scaling or rotation.

Output

A single image of the same resolution as the movie poster image in any favorable image format.

[TBD]

Test Images

Here are a few images to test your algorithm on. Click on the images to get the actual resolution.

TBD

Please include some examples for these test images (along with other examples if needed) in your submission. Its also a good practice to briefly explain your algorithm as well.

Help Agent Zigzag with his secret messages

The WW2 double agent Eddie Chapman — aka "Agent Zigzag" — used an unusual cipher to communicate with his German controllers. It is described in the appendix of Ben Macintyre's book about Chapman and can also be viewed at the National Archives, apparently.

Read the following description and write a program to encrypt and decrypt messages using this system.

Your program should accept three inputs via stdin and/or command line switches:

1. A keyword
2. A flag to select either encryption or decryption
3. A message to be encrypted or decrypted

The output should be the corresponding ciphertext/plaintext, arranged into groups of 5 letters separated by single spaces. You may assume that the keyword consists entirely of uppercase letters, but should accept plaintexts and ciphertexts containing mixed case characters, punctuation and spaces. Non-alphabet characters should be stripped from the input and should not appear in the output (which may only contain groups of 5 uppercase characters separated by spaces, with an optional line break at the end). The date value used for keyword processing should be obtained from the system clock using the local time zone.

This is a code-golf challenge. The shortest code (measured in bytes) will win.

1. Keyword processing

Write out the keyword, and below each letter write the position in which this letter would appear if the letters were all sorted alphabetically. If the same letter appears more than once, number them from left to right. For example, the 14-letter keyword CONSTANTINOPLE would be processed as follows:

C   O   N   S   T   A   N   T   I   N   O   P   L   E
2   9   6   12  13  1   7   14  4   8   10  11  5   3


(Notice how the three Ns are numbered 6, 7 and 8.) Combine this sequence of digits into a single number, and multiply by the current date (from 1 to 31). For example, if the transmission is being made on the 8th of the month:

2961213171448101153 x 8 = 23689705371584809224


2. Encryption

Pad the secret message to a multiple of five characters in length by appending the null character X as many times as necessary, then encrypt Vigenere-style by cycling each letter through the alphabet by offsets corresponding to successive digits of the number calculated at step 1. For example, the message

Have arrived safely and in good health. Awaiting further instructions.


is encrypted as follows:

havearrivedsafelyandingoodhealthawaitingfurtherinstructionsx << Plaintext
236897053715848092242368970537158480922423689705371584809224 << Key (repeated)
JDBMJYRNYLEXIJMLHCPHKQMWXKHJDSUMIAIICKPKHXXBQLRNQZUWCGBIXPUB << Ciphertext


because 'H'+2='J', 'A'+3='D', 'V'+6='B', etc.

Finally, read off the encrypted message in groups of five characters:

JDBMJ YRNYL EXIJM LHCPH KQMWX KHJDS UMIAI ICKPK HXXBQ LRNQZ UWCGB IXPUB


• For languages that don't have system clock access, is it acceptable to take the date/time as an additional input? – Geobits Sep 23 '15 at 14:09
• @Geobits Would you mind if I said no? We have so many code-golf questions that are dominated by esolangs, I thought it would make a change to have one that favours higher-level languages. (Although it looks like Pyth can do dates...) – r3mainer Sep 23 '15 at 14:55
• I don't personally mind since I don't tend to use them. Some might, so I figured it was better to ask/clarify while it was sandboxed rather than on main. – Geobits Sep 23 '15 at 14:57
• It's not just about esolangs: removing the direct coupling with the system clock allows test cases which work consistently. – Peter Taylor Sep 23 '15 at 20:19
• @PeterTaylor But only 31 test cases are needed. – r3mainer Sep 23 '15 at 22:02

Well hello there, fellow golfers. The time has come for us to take part in the game. Time for the official Illuminati Confirmation!

Illuminati Confirmed?

Nah, just joking. We actually want to hide even better - by making conspiracy theorists look ridiculous.

For that, you need to create code in whatever language you want to. Your task is to print the Eye of Providence, as an ascii art. The program may take input, but it shouldn't rely on it.

However, there's a catch. You need to hide as many non-obvious references to Illuminati in source code as you can. One particular requirement is that your code must have an "Illuminati confirmed" sentence hidden somewhere(although it doesn't have to be plain string - in fact, it shouldn't; you can have it hidden by placing it as a first letter to every line, etc. - be creative!)

And because it's , the most upvoted and creative code wins!

Now I want feedback before posting it - what else should I have in here? What is not clear? And if you come up with better "lore chit-chat"(I actually had no afflatus) - feel free to help me.

• You need to hide as many non-obvious references to Illuminati in source code as you can: One problem you may run into is that I think it's been proven by the internet at large that you can make anything an Illuminati reference if you twist it enough. – Geobits Sep 24 '15 at 17:22
• Also, pretty sure the Illuminati has already been confirmed since it was a real and historical secret society. – mbomb007 Sep 24 '15 at 17:56
• @mbomb007 Nonsense! – MatthewRock Sep 24 '15 at 18:59
• @Geobits What is your suggestion then? I am honestly counting on community, so some stupid answers like "Well, I have a word 'rock' rock is four characters, and four - 1 = 3, triangle also has 3 sides - Illuminati Confirmed" will be downvoted, and some clever ideas will get attention. – MatthewRock Sep 24 '15 at 19:05
• This is an art / wordgame contest, not a programming contest. I'm not as strongly against this sort of thing as some, but there's a fair chance this will get closed. – Level River St Sep 24 '15 at 21:08
• @steveverrill what I had in mind wasn't "Print the prettiest and funniest image and code, but rather to get people creative. This post is one of my inspirations - Perl and Brainfuck are bottles; C makes heavy use of macros to call the function in a funny manner, and while there are many other "plain" programs, the most creative are the most upvoted. This is similar to mine. There is more of that, buut looks like this shouldn't be closed. – MatthewRock Sep 24 '15 at 22:07
• The 99 bottles of beer question is 4 years old and things were different back then. Nevertheless the issue was raised in the top comment on that question. There was a big attitude change just after the christmas tree challenge, in my opinion probably caused partially by Code Trolling. I'm not saying don't do it, just be aware of the issue. James Webster's recent cake question did quite well, though it did attract some close votes. The recent Back To The Future question was closed immeditately. – Level River St Sep 24 '15 at 22:35
• @steveverrill I'm sorry, I have no idea what you're talking about. Could you please introduce me to the issue of Code Trolling, and provide some examples? – MatthewRock Sep 25 '15 at 8:29
• Code Trolling was a particular class of open ended questions. The tag description is here. codegolf.stackexchange.com/tags/code-trolling/info It got out of hand. The history is too long and emotive to discuss in a comment, but it seems the challenges have been deleted. There are many meta questions on the subject. I've picked this one for you. meta.codegolf.stackexchange.com/q/760/15599 – Level River St Sep 25 '15 at 8:56
• @steveverrill Okay, thanks for your insight. I will think about what you guys said, and maybe post the question - the worst that will happen is that iit will get closed - but hopefully it will spawn some clever and funny answers. – MatthewRock Sep 25 '15 at 9:21
• Will an ASCII art version of the Eye of Providence be added in the question, or will we have to make one ourselves? – ASCIIThenANSI Sep 25 '15 at 15:52
• @ASCIIThenANSI That's what I asked in other topic(well, I did it badly). I'm afraid to lock it to one particular output, because this way they can only get creative with code. What do you think? – MatthewRock Sep 25 '15 at 19:11
• If you designed the exact Eye of Providence that we had to produce, it would go better as codegolf than popularitycontest. A good codegolf would require a fair amount of repetition in the pattern (compressing completely random strings is boring.) I guess it's fair to assume your design would be symmetrical. But since you want a popularity contest, just go for a popularity contest, and see if it flies high or if it gets shot down in flames. There's only one way to find out for sure, and you won't do it with meta posts. That said, Geobits makes a good point, that you need to address. – Level River St Sep 26 '15 at 9:39

1,2,3,4,...n-2,n,n-1

Your goal is, with an input "n", to print the numbers 1-n BUT the last two values are flipped. The numbers must be CSV (Comma separated values)

n must be >= 3 (And an integer)

For example, with an input n="10", your output should be as follows: 1,2,3,4,5,6,7,8,10,9.

An input with n="3", your output should be as follows: 1,3,2.

• Get rid of the requirement that you can't just embed a string, please. How about printing 1,2,3,...,n-2,n,n-1 for a given input n? – Lynn Oct 3 '15 at 11:16
• @Mauris Added this in, thanks for your input :) – Albert Renshaw Oct 3 '15 at 20:52
• Shouldn't it be "last two values" instead of "last two digits"? In the example, the swapped items are 9 and 10, and 10 is not a digit. – Reto Koradi Oct 5 '15 at 5:14
• @RetoKoradi Ahah good catch, edited it thanks! – Albert Renshaw Oct 5 '15 at 7:12
• @FryAmTheEggman Got it in, thanks! – Albert Renshaw Oct 6 '15 at 20:21