# Sandbox for Proposed Challenges

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

Sandbox FAQ

## Posting

Write your challenge just as you would when actually posting it, though you can optionally add a title at the top. You may also add some notes about specific things you would like to clarify before posting it. Other users will help you improve your challenge by rating and discussing it.

When you think your challenge is ready for the public, go ahead and post it, and replace the post here with a link to the challenge and delete the sandbox post.

## Discussion

The purpose of the sandbox is to give and receive feedback on posts. If you want to, feel free to give feedback to any posts you see here. Important things to comment about can include:

• Parts of the challenge you found unclear
• Problems that could make the challenge uninteresting or unfit for the site

You don't need any qualifications to review sandbox posts. The target audience of most of these challenges is code golfers like you, so anything you find unclear will probably be unclear to others.

If you think one of your posts needs more feedback, but it's been ignored, you can ask for feedback in The Nineteenth Byte. It's not only allowed, but highly recommended!

It is recommended to leave your posts in the sandbox for at least several days, and until it receives upvotes and any feedback has been addressed.

## Other

Search the sandbox / Browse your pending proposals

The sandbox works best if you sort posts by active.

To add an inline tag to a proposal use shortcut link syntax with a prefix: [tag:king-of-the-hill]. To search for posts with a certain tag, include the name in quotes: "king-of-the-hill".

Get the Sandbox Viewer to view the sandbox more easily!

# Output all of printable ASCII using all of printable ASCII

Posted

• "Irreducible" isn't really an observable requirement; I'd recommend looking into using pristine-programming to make it an objective criterion. – hyper-neutrino Oct 12 '20 at 18:31
• What do you mean by "observable"? "irreducible" simply means you can't purely remove characters (not purely substrings) from the program and have it still work (not merely not error). That's pretty objective, is it not? – pxeger Oct 12 '20 at 18:39
• Actually, yes it seems you're right, I was probably thinking of some other common criteria that isn't valid. Otherwise challenge looks good, doesn't seem to be a duplicate. I would say this isn't kolmogorov complexity since it's not constant but it is restricted source albeit not in the common usage. – hyper-neutrino Oct 12 '20 at 18:48
• Can my program contain additional non-ASCII bytes? – Adám Oct 12 '20 at 19:00
• @Adám yes, in the post it says "Your program, and its output, can contain any additional non-printable-ASCII bytes (bytes, not characters) if you like, such as newlines". "non-printable-ASCII" includes "non-ASCII" – pxeger Oct 12 '20 at 19:01
• Ah, I see. Maybe clarify that you mean both non-[printable-ASCII] and [non-printable]-ASCII. – Adám Oct 12 '20 at 19:03
• Perhaps subtract 95 from each score so that scores look more reasonable – lyxal Oct 13 '20 at 10:51
• @Lyxal my reasoning for not doing that was because I suspect most answers will be quite a lot longer in order to make sure they're irreducible, it would complicate things, and IMO it doesn't really matter if they're that length – pxeger Oct 13 '20 at 10:55

# Round a Matrix

Your input is a 2d array of nonnegative floats A. It can be supplied in whatever format is most acceptable for your language. It can have any dimensions.

Let r and c be the 1d arrays of row and column sums of A respectively, rounded to the nearest integer, with the rule that 0.5 is rounded up to 1.

Your task is to output a 2d array of nonnegative integers B such that |b_{ij} - a_{ij}| < 1 for all i and j, and also the row and column sums of B are equal to r and c respectively.

In other words, B is obtained by rounding each element of A up or down, in such a way that the row and column sums are preserved.

There may be many possible solutions. In this case, you only need to output one of them.

If there is no solution, your program's behaviour can be undefined.

Example:

 A = 1.2 3.4 2.4
3.9 4.0 2.1
7.9 1.6 0.6


in this case, the row sums are [7.0, 10.0, 10.1] and the column sums are [13.0, 9.0, 5.1] so after rounding these, you get r = [7 10 10] and c = [13 9 5]. One acceptable solution is

 B = 1   3   3
4   4   2
8   2   0


This is code golf, so the shortest code wins.

## Motivation

I am also interested in what clever algorithms people can come up with. I guess the most obvious is just to do a random search, but that can take a very long time, even if the array is only 10x10 or so.

## Questions

• Is it clear? Please can you edit it if it's not in the right format?
• Has it appeared here before? (I don't think so, because I was searching Stackoverflow for a while in order to come up with a solution to this.)
• Is there always a solution under the conditions given here?
• Would it be better in some other format than code golf?
• Should the condition |b_{ij} - a_{ij}| < 1 be |b_{ij} - a_{ij}| <= 1?
• Since you want optimal, interesting solutions, rank by time complexity. You'll get fewer answers, but they will be more optimal than a direct brute force approach. – Razetime Oct 22 '20 at 6:53
• The suggestion of using complexity isn't often a good one - most challenges here that try to do that wind up closed or unanswered. It would be much simpler to go by execution time for some number of test cases that you pick. For the actual question, I think you should explicitly say that r and c are computed by summing and then rounding (assuming that is the correct order) as it isn't precisely clear from what you have right now. – FryAmTheEggman Oct 22 '20 at 20:34

# The Fibonacci Rectangular Prism Sequence (posted)

• There are the square roots of A127546. It looks like there are ways to generate this sequence shorter than just generating Fibonacci numbers and adding their squares. So, this doesn't strike me as a duplicate but an interesting challenge in its own right. I'd recommend removing the square-root step from the challenge and just asking for the sum of the three squares, which is a whole number. This might also allow for more interesting recursive solutions. You should include test cases, perhaps something like the first 15 elements of the sequence and maybe one big one. – xnor Oct 27 '20 at 0:39

# Unique languages

As we found out before, each of the 680 languages on Try it online! has a "TIO uniqueness", defined as the length of the shortest substring that appeared in the language's name and no others'.

This time, we're going to make it more general. Given a list of strings S and a target T, output the length of the shortest substring of T that is not in any other element of S. You may choose whether T is part of S or not. The elements of S will always be unique. All elements of S, and T, will only contain lowercase letters (abcdefghijklmnopqrstuvwxyz). You may also take input as uppercase if you wish.

Your score will be calculated as code length × TIO uniqueness, where code length is measured in bytes and TIO uniqueness is the TIO uniqueness as specified here. If a language has an undefined TIO uniqueness, it cannot compete in this challenge.

The answer with the lowest score wins.

# Check B-powersmoothness - posted

• Can you link to the wiki article please. – Alex bries Mar 29 at 8:57
• @Alexbries I added a link – Command Master Mar 29 at 9:06