567
\$\begingroup\$

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

To post to the sandbox, scroll to the bottom of this page and click "Answer This Question". Click "OK" when it asks if you really want to add another answer.

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
  • Comments addressing specific points mentioned in the proposal
  • 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 requires more feedback, but it's been ignored, you can ask for feedback in The Nineteenth Byte. It's not only allowed, but highly recommended! Be patient and try not to nag people though, you might have to ask multiple times.

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".

\$\endgroup\$
0

4480 Answers 4480

1
138 139
140
141 142
150
-1
\$\begingroup\$

RGB to Hexadecimal

\$\endgroup\$
3
  • \$\begingroup\$ Instead of 0 < r < 255 (both inclusive), which is a bit of a nonstandard way to write that, why not MathJax: \$0\lex\le255|$ \$\endgroup\$ Nov 2, 2022 at 13:05
  • \$\begingroup\$ Added it, but there was an escaping error where the $ had to be escaped to end the MathJax. Fixed it by changing | with \, and it worked. \$\endgroup\$ Nov 2, 2022 at 13:13
  • \$\begingroup\$ Oh oops, that was a typo on my part. Yeah, backslash is correct. \$\endgroup\$ Nov 2, 2022 at 13:27
-1
\$\begingroup\$

LS, Part 2: Sebald Code

WARNING: You still not gonna answer a challenge about ponies?


Sebald code is a code developed by Dr. Gustav Sebald purely for communication through movies. It is decoded like this:

  1. We look for an instance of "ring" case-insensitive
  2. Starting from the word just after the "ring" we add this to an empty string
  3. We jump 11 words and add the next word after that
  4. Repeat 2 and 3 until we pass one of the words "ring"
  5. The string we've been adding to is the plaintext.

Note that if the string doesn't contain "ring", just return an empty string ''.

Testcases (TODO)

This is , so shortest answer wins!

\$\endgroup\$
-1
\$\begingroup\$

Output your Votes

The challenge is simple: Print to stdout the current total score (upvotes minus downvotes) of your answer.

For obvious reasons, you do not have to include the ID of your answer in the program; you may take it from stdin or specify a place in the code where the ID must be inserted. Your program may assume that the computer it is running on has internet access and isn't restricted by SE API ratelimiting. Your program does not need to use the SE API to get the vote count, but that's probably the easiest way to do it.

This is , so shortest code wins.

Meta

Is this a dupe? I wouldn't be surprised if it is.

\$\endgroup\$
-1
\$\begingroup\$

Help Santa Rest

Santa has finally delivered presents to everyone at the stroke of midnight in a day, and now he wants some well-deserved rest. He is just about to sit down when the present managing computer suddenly calls out: "ME NEED REST." Now he is asking you to write him a program that does... nothing.

You will be given command line args, you will be given STDIN input. You must swallow/ignore the input and after some length of time, quit the program. You may have no externally visible effects (other than RAM/CPU usage obviously), and the program must not hang.

Testcases

NullPointerException

Scoring

Santa wants to type this in as quickly as possible so he can rest, so this challenge is scored in bytes, as standard .

\$\endgroup\$
8
  • \$\begingroup\$ So, what should the program do? Quit? Probably loads of 0-byte solutions to this. \$\endgroup\$
    – Adám
    Dec 8, 2022 at 17:14
  • \$\begingroup\$ @Adám the program should do nothing and exit. true, but 0 byters are not possible in quite a few languages (i.e. Java, golflangs that implicitly print the input, C(++)(#), Kotlin) \$\endgroup\$
    – Seggan
    Dec 8, 2022 at 18:04
  • \$\begingroup\$ Wouldn't it be more fun to have to swallow all input? \$\endgroup\$
    – Adám
    Dec 8, 2022 at 18:12
  • \$\begingroup\$ @Adám isn't that what I'm describing? \$\endgroup\$
    – Seggan
    Dec 8, 2022 at 18:13
  • 1
    \$\begingroup\$ Well, if the program quits immediately, it won't have a chance to swallow any input. \$\endgroup\$
    – Adám
    Dec 8, 2022 at 18:52
  • \$\begingroup\$ @Adám not quit immediately. i meant do nothing from an outside perspective, as in no STDOUTput or alert boxes or whatever \$\endgroup\$
    – Seggan
    Dec 8, 2022 at 21:57
  • \$\begingroup\$ Then it is still unclear to me. How long should the program run and swallow input before quitting? \$\endgroup\$
    – Adám
    Dec 9, 2022 at 12:16
  • \$\begingroup\$ @Adám as long as it does not hand (i.e. enter into an infnite loop) \$\endgroup\$
    – Seggan
    Dec 9, 2022 at 16:22
-1
\$\begingroup\$

Print my Country

This challenge is simple: Your program must output the two-character country code of the computer it is currently being run on, according to the computer's locale settings. (Capitalization doesn't matter.) For example, were I to run your program on a computer with a location set to the United States, your program should output US. You may assume that your program is running on the latest version (Bullseye, if I'm not mistaken) of Debian Linux. This does not need to be accurate; I could easily set the locale to Antartica while being in Britain.

This is , so shortest program wins!

\$\endgroup\$
3
  • \$\begingroup\$ Is this even possible? How can the computer possibly know where it is physically? And who says it even is in a country? \$\endgroup\$
    – Adám
    Dec 13, 2022 at 14:34
  • \$\begingroup\$ @Adám The program only needs to print the system's locale, which may or may not be accurate. I could easily set my location to Antartica while actually being in Britain. I have clarified some of the language. \$\endgroup\$
    – Ginger
    Dec 13, 2022 at 15:48
  • 1
    \$\begingroup\$ Removing the restriction of system could make it more interesting. Answers should specify what system / environment they are running on. \$\endgroup\$
    – tsh
    Dec 15, 2022 at 7:13
-1
\$\begingroup\$

Generate 3d Christmas tree using "3d pixel art"

Imagine you are building Christmas tree from 1x1x1 sized cubes that can be attached just by sharing a side. At least one input - size, but can be more granular (height, bottom_width, etc.).

Any kind of algorithm you like, data representation should be set of 3d int vectors containing positions of each cube.

The more natural looking, the better.

If you want to visualize it too, even better. But it's not essential (I may try to visualize some of your creations).

\$\endgroup\$
-1
\$\begingroup\$

Halting detector (Archived)

Choose a Turing complete language and write a program in this language that, given a program in 1TB, decide whether it halts.

Your program would likely be more than 1TB, which results in transferring difficulty1. Therefore, you only need to show your construction and prove your code length.

Shortest code in each language win. A Turing complete language which write 2TB of program to do a loop would make short submission but that won't be fun (and I don't think such language exist now)

1 Yeah it isn't the main point

\$\endgroup\$
8
  • 3
    \$\begingroup\$ This is literally impossible, due to the halting problem. Also how are we to submit an entire terabyte of code? \$\endgroup\$
    – Seggan
    Dec 18, 2022 at 19:53
  • \$\begingroup\$ @Seggan I'm not the OP, but the problem specifies the program is less than 1 TB, so in principle you could solve it with a very large lookup table. And it says "you only need to show your code construction and prove your code length". \$\endgroup\$ Dec 18, 2022 at 22:27
  • 1
    \$\begingroup\$ There are so many unsolved conjectures in mathematics that may impact the halting or non-halting of a program. For example, if you can express Collatz conjecture (specifically, an infinite loop that stops when a nontrivial Collatz loop is found) in 1TB of code in language X, you can't solve this challenge in X. \$\endgroup\$
    – Bubbler
    Dec 18, 2022 at 23:13
  • \$\begingroup\$ @Bubbler True, I suppose whether you can solve it depends on what counts as a solution. Like could you just say "this solution exists, but you would need to solve a lot of conjectures to actually construct it"? \$\endgroup\$ Dec 18, 2022 at 23:55
  • \$\begingroup\$ @Seggan For example, you can just create a language called PythonAfter1TB which simply ignore first 1TB source and interpret following source as Python 3.10 (or do nothing and halt if your source is less than 1TB). \$\endgroup\$
    – tsh
    Dec 19, 2022 at 9:23
  • \$\begingroup\$ @tsh "but that won't be fun (and I don't think such language exist now)" \$\endgroup\$
    – l4m2
    Dec 19, 2022 at 9:46
  • \$\begingroup\$ @tsh and what would that achieve? besides, it doesn't change the fact that this problem is impossible \$\endgroup\$
    – Seggan
    Dec 19, 2022 at 14:05
  • \$\begingroup\$ @l4m2 I don't think there is some language (defined by implementation) support a single file with 1TB content as its source code currently. \$\endgroup\$
    – tsh
    Dec 20, 2022 at 6:09
-1
\$\begingroup\$

Character Values Quine

Write a program that prints out a sequence of integer values corresponding to the character codes in the source code.

For example, the program:

print("Hello, World!")

has a valid corresponding integer sequence of:

112 114 105 110 116 40 34 72 101 108 108 111 44 32 87 111 114 108 100 33 34 41

Rules

  • You may use a non-numerical sequence delimiter of your choice.
  • The order of values in the sequence must be maintained for this challenge.
  • The integers may be in any numerical base with a radix of 2 or larger. (binary or up). All the integers must have the same base.
  • Code comments are permitted.
  • The program may not read from its own source code.
  • Standard loopholes apply.
  • This is , so the shortest-length solution wins.
__

My first question, so please let me know what could/should be changed. Thanks!

\$\endgroup\$
7
  • \$\begingroup\$ Why the arbitrary restriction to ASCII? \$\endgroup\$
    – Adám
    Jan 5 at 18:49
  • \$\begingroup\$ @Adám That might be unecessary, but I was mainly thinking that a mixture of unicode and ascii characters wouldn't be great. Is that a concern? \$\endgroup\$
    – Bob th
    Jan 5 at 18:51
  • \$\begingroup\$ @Adám Okay, after thinking about I believe you're right in that it's rather arbitrary so I've removed it. \$\endgroup\$
    – Bob th
    Jan 5 at 19:18
  • \$\begingroup\$ Welcome to Code Golf SE and thanks for using the Sandbox! You may want to think though the allowed encodings - some languages use special code pages (not Unicode nor ASCII, see 05AB1E or Nibbles). I suggest allowing them and even allowing code pages specifically crafted for this challenge (eg. program adcbd returning 1 2 3 4 2 with encoding a:1 b:4 c:3 d:2). But that's up to you. \$\endgroup\$
    – pajonk
    Jan 6 at 14:08
  • \$\begingroup\$ This seems to fall under generalized quines, a type of challenge we'd rather avoid \$\endgroup\$
    – mousetail
    Jan 7 at 16:03
  • \$\begingroup\$ @mousetail I think that allowing custom encodings may result in some clever solutions that don't use the standard quine approach. I don't know however if the probability is high enough to post it against the generalized quine discouragement. \$\endgroup\$
    – pajonk
    Jan 8 at 8:30
  • \$\begingroup\$ I really don't see how using a different base could ever lead to a different approach to the standard quine \$\endgroup\$
    – mousetail
    Jan 8 at 9:19
-1
\$\begingroup\$

Generate a random halting Brainfuck code

Generate a random valid halting brainfuck program using []+-<>. Every halting program should be possibly outputted.

Sandbox Notes:

  • What should I add?
  • Is it a duplicate?
\$\endgroup\$
3
  • \$\begingroup\$ I would add "Every halting program should be possibly outputted with nonzero probability." Also, I don't think there is any other viable approach than implementing this and randomly quitting when a program halts, which makes your challenge a possible duplicate. \$\endgroup\$
    – Bubbler
    Jan 19 at 6:52
  • \$\begingroup\$ @Bubbler They can be wrapped into each other(this+loop outputting unseen entries=that,that+random output then halt=this), if these two wrappers treated non-trivial then it's not a dup \$\endgroup\$
    – l4m2
    Jan 20 at 0:07
  • \$\begingroup\$ This is impossible, since you can't determine if a program halts. Should it generate a program that solves the colatz conjecture or not? \$\endgroup\$
    – mousetail
    Jan 20 at 8:38
-1
\$\begingroup\$

Sum of numbers of arbitrary length

\$\endgroup\$
2
  • 1
    \$\begingroup\$ This seems like it would be fairly trivial in most languages. Maybe add a restriction that there shouldn't be floating point errors (e.g. in many languages, 0.2 + 0.3 = 0.30000000000000004) \$\endgroup\$
    – noodle man
    Feb 5 at 20:13
  • \$\begingroup\$ @Jacob If there will be floating point errors then it will not meet the condition "summarize them as normal numbers" \$\endgroup\$
    – EzioMercer
    Feb 5 at 20:54
-1
\$\begingroup\$

Route Planning for a delivery driver

There is a town that consists of a single long road with evenly spaced houses. Each house either needs rice, represented with a negative number, or can provide rice, represented with a positive number.

[-1, 50, -1, -1, -1, -50, 3, 1]

Here, the first house needs one grain of rice, the second can provide 50 etc.

Your delivery truck starts at the very left edge of the town, and must end on the very right edge. It has a infinite capacity, but you can't deliver if it's empty.

The sum of the input list is guaranteed to be 0.

Given a list of requirements, output the shortest possible path that can deliver to every address.

Test cases

Test Case Output
5, -5 3
-5, 5 5
2, -5, 3 6
-1, -1, 1, 1, 1, -1 12
\$\endgroup\$
-1
\$\begingroup\$

Paint you a Picture for Piet Perfection

Make a Piet program that does whatever you want—but make it pretty.

Your goal is to paint a beautiful picture with an interesting function.

Your program may do anything, but your submission is much more likely to gain upvotes if it is interesting or related to the content of the picture. Likewise, your program could be incredibly interesting but look very ugly and thus receive few upvotes.

This is a , so the submission with the highest score wins.


Meta sandboxing: This might be too vague, should the program guidelines be more specific?

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Unfortunately, this kind of popularity contest ("do whatever you want but make it pretty") is exactly the kind that we've decided isn't a good fit for the site. \$\endgroup\$
    – DLosc
    Mar 10 at 16:38
  • \$\begingroup\$ @DLosc Booooooo \$\endgroup\$
    – noodle man
    Mar 10 at 22:13
  • \$\begingroup\$ Yeah, I understand the reasons, but I'm not entirely happy with the outcome. Tweetable Mathematical Art was one of my favorite questions. Popularity contests and what to do with them have been one of the site's most vexing questions for a lot of years. We still discuss the issues in chat from time to time. \$\endgroup\$
    – DLosc
    Mar 11 at 16:20
  • 1
    \$\begingroup\$ Improvement idea: Create a Piet program that describes what it does in the picture itself. \$\endgroup\$
    – Bubbler
    Mar 17 at 1:07
-1
\$\begingroup\$

My prefix is food, my suffix is rude

My prefix is food.
My suffix is rude.
My infix comes in rounds.
I keep you off the ground.

What am I?

This is the first "Riley riddle", created by Riley. Riddles of this sort has become a trend in the Puzzling SE. Let us do a code-golf challenge equivalent of it.

The challenge is to write a program/function that expects the input to be one of three distinct values of your choice, and output what the code's prefix/suffix/infix of your choice would output, respectively.

To be more specific, the affixes shall have no input or have the input ignored, and have a constant output. For sake of preventing trivial solutions, their outputs shall be all different.

As for the full code, any input that matches none of the three values falls into don't care situation. Standard loopholes apply.

This is a code-golf, so the submission whose full code is the shortest in length wins. The lengths of the affixes won't compromise the score.

If possible, please include a poem describing what your code does, just like the original riddle! ;-)

\$\endgroup\$
2
  • \$\begingroup\$ Why the downvote tho? \$\endgroup\$ Mar 25 at 9:56
  • \$\begingroup\$ I'm not the downvoter, but I'm not sure I understand what the challenge means. Could you give an example program? \$\endgroup\$ Mar 29 at 19:02
-1
\$\begingroup\$

Play turn-less chess


In this challenge, you'll write a chess bot...but with a twist. Your bot can move at any time, so the faster you can think, the faster you can move. You'll write code for a custom CPU (so that precise timing is possible), and try to checkmate your opponent's king.

Rules:

  • White doesn't necessarily move first; both bots get the opportunity to start moving immediately. If both bots move in the same CPU cycle, white moves first
  • If a bot tries to make an impossible move (pushing a pawn into an occupied square, castling with a moved rook, etc.), the move fails, and the bot is penalized by losing a certain amount of time (or possibly the number of cycles the opponent spent on their last move)
  • Instructions will cost 1 CPU cycle, with the exception of moving, which will cost a fairly large number of cycles to make rapidly moving pieces to overwhelm smart bots less overpowered
  • Bots will play each other round-robin style, both as white and black. Bots will be scored using a modified Elo system (designed such that the order in which the games are played doesn't matter)
\$\endgroup\$
13
  • \$\begingroup\$ I would strongly suggest 1 cycle per instruction, anything else will get way to complex way to quickly while adding nothing. Plus it won't actually effectively prevent ties. Instead, one bot could maybe start half a cycle earlier like in regular chess. \$\endgroup\$
    – mousetail
    Mar 27 at 14:59
  • \$\begingroup\$ @mousetail I don't see how it would get "way too complex", or how it would "add nothing". It would happen all the time that two bots move at the same time. I don't want white to have an advantage, since it would cause the games to run faster and result in less draws if only one balanced game took place. As for complexity, I don't see how it adds any, and it adds a bit of strategy for people who really want to optimize their bots. \$\endgroup\$ Mar 27 at 15:01
  • \$\begingroup\$ You could run games with both sides starting once, then the overall winner is whoever won the fastest to eliminate ties \$\endgroup\$
    – mousetail
    Mar 27 at 15:03
  • \$\begingroup\$ @mousetail Maybe, but draws still exist. And if everything is integer numbers of cycles, bots winning in the same number of cycles could also happen. And I don't see how that's less complex than what I'm doing. \$\endgroup\$ Mar 27 at 15:05
  • 1
    \$\begingroup\$ I really dislike needing do do anything complex to calculate the speed of a section of code other than counting the lines. I'd need to reference the instruction set to understand the impact of every line, instead of being able to quickly tell if one snippet is faster than another \$\endgroup\$
    – mousetail
    Mar 27 at 15:05
  • \$\begingroup\$ If I wanted to need a calculator to find the speed of my program I'd rather program in x86 \$\endgroup\$
    – mousetail
    Mar 27 at 15:06
  • \$\begingroup\$ Ties to exist, obviously if one side ties the other decides. If both games tie then they'd tie without a first move advantage also so it wouldn't make any difference \$\endgroup\$
    – mousetail
    Mar 27 at 15:06
  • 1
    \$\begingroup\$ Hmm, I do see your point. I think I'm still going to make some things cost multiple cycles (moving, mainly), but I guess I'll do integers. \$\endgroup\$ Mar 27 at 15:08
  • 1
    \$\begingroup\$ On a completely different note: I'd recommend making the winning condition capturing the king since keeping track of check rules in such a limited time would be near impossible \$\endgroup\$
    – mousetail
    Mar 27 at 15:08
  • \$\begingroup\$ @mousetail You'd still need to do the exact same process as "keeping track of check rules" if you want to avoid your king being captured... \$\endgroup\$ Mar 27 at 15:09
  • \$\begingroup\$ True, but that adds a interesting element to the game. Can you move out of check before your opponent realizes? Instead of having to wait for a long time due to a invalid move in which your opponent will probably have time to checkmate you anyways \$\endgroup\$
    – mousetail
    Mar 27 at 15:11
  • \$\begingroup\$ @mousetail Ooh...what if when you're put in check, you receive some sort of interrupt, like your opponent saying "check"? And maybe making a move that would put your king in check is handled differently from just making an invalid move. \$\endgroup\$ Mar 27 at 15:15
  • \$\begingroup\$ Possible, but that might make the rules too complex. Not sure how to fix it though \$\endgroup\$
    – mousetail
    Mar 27 at 16:58
-1
\$\begingroup\$

Minimum Buttons on a calculator to get from one number to another

My calculator looks like this:

·   ·   ·   ·   ·
  1   2   3   +
·   ·   ·   ·   ·
  4   5   6   -
·   ·   ·   ·   ·
  7   8   9   * 
·   ·   ·   ·   ·
  =       0   /  
·   ·   ·   ·   · 

Given a starting number and a ending number, calculate the minimum sequence of button presses required to get from the starting number to the ending number.

Notes:

  • / is integer division, no need to handle floats
  • Simple calculators always calculate from left to right, no complex order of operations
  • A = is needed at the end to display the final number if the start and ending number are different

Test Cases

A B Result
1 1
2 3 +1=
49 33 -16=
120 1081 *9+1=

More test cases TBD

\$\endgroup\$
5
  • \$\begingroup\$ Should there be an = at the end of the third test case? \$\endgroup\$
    – The Thonnu
    Apr 13 at 14:36
  • \$\begingroup\$ Isn't +97= a shorter solution for the last test case? \$\endgroup\$
    – Arnauld
    Apr 15 at 14:36
  • \$\begingroup\$ Is +961= also a valid answer for the last test case? \$\endgroup\$
    – The Thonnu
    Apr 15 at 16:54
  • \$\begingroup\$ @TheThonnu Yes. \$\endgroup\$
    – mousetail
    Apr 15 at 17:13
  • 2
    \$\begingroup\$ Must first button be one of "+-*/" or what happened if I press "1" at beginning? May input already equals to output? Could you add more testcases that require using more than 1 operators in the output? \$\endgroup\$
    – tsh
    Apr 18 at 5:51
-1
\$\begingroup\$

What is the shortest python code which implements a string-to-float function?


Goal

Write the shortest variadic to_float, str2float, or standardizing function you can write subject to the constraint that the code is written in python.


Rules and Examples

The variadic str2float shall be some callable which accepts any one of the following inputs:

Input Data-type Example Input Output float
string "4.992" float 4.992
float s 4.992 float 4.992
int 9021 float 9021.0
a shallow iterable of strings ["4", ".", "9", "9", "2"] float 4.992
a string with zeros padded on the right and/or white-space padding on left "1234.650000\n" float 1234.65
a string with zeros padded on the left "016" float 16.0
a deeply nested iterable of strigs [["4", [[".", "9"]], ("9", "2")], ((((("1")), "0"), "1"), "0")] float 4.992101
a deeply nested iterable of a mix of floats, int, and strings [[4.0, [[".", 9]], (9, "2")], (((("1")), "0"), "10")] float 4.992101

The main assumptions about the variadic *args parameter are that there is a correctly-working method named __iter__ defined and that if you recursively search until isinstance(obj, str) returns True or not hasattr('__iter__', obj), then the object which is not a string has a __repr__ method which returns a string representation of a decimal point, integer, or floating point number.

Scoring

The scoring will be something in between code-golf and popularity contest:

Score = (upvotes - downvotes) - floor((bytes in code that outputs question) / 3)

The highest score wins.

(You can use http://mothereff.in/byte-counter as a byte counter.)

\$\endgroup\$
1
  • 6
    \$\begingroup\$ It's not recommended to have popularity-contests any more. Also, it's not recommended to restrict the challenge to one language \$\endgroup\$
    – The Thonnu
    Apr 22 at 11:24
-1
\$\begingroup\$

Infinitely spew corporate B.S.

(Throwing a touch of shade at some recent decisions made by StackExchange over on Mother Meta)

If you've ever read a company's announcement blog post or press release, you've likely thought to yourself "Wow, I couldn't understand a word of that!" This is the effect of a marketing technique often referred to as "spewing corporate B.S." which, while often frustrating to read, can help you and your business dodge a lot of bullets in the P.R. department (or at least, buy yourself some time).

After recent actions made by the company you work at, you've realized that your company doesn't have time to formulate a good response to its customers' concerns—but you know just how to deal with the problem.

In this challenge, your task is to write a program or function that, given no input (or a seed), infinitely writes randomized company-speak.

How to write it

SANDBOXING: TODO - spec out how this will work. I'm thinking that it will just choose random words from a word bank, but I should specify how grammar can work, or maybe it would make sense for the word list to be taken as input (leaning towards this)f? Please comment any suggestions.

Here are some example corporate sentences your program may write, according to the above criteria:

We are revisiting a broader approach to improving the user-experience of our new experiment concerning recent concern.

We are excited to share a more holistic initiative to produce positive results from our new experiment.

We are committed to hearing your feedback in a more positive exploration of the product.

Rules

  • Your submission can be a full- program or a function
  • You may return a generator that can generate sentences infinitely rather than printing.
  • Your “randomness” doesn’t have to be evenly distributed, but there must be a non-zero chance that any possible sentence might be outputted by your submission.
  • SANDBOXING: more rules
\$\endgroup\$
5
  • \$\begingroup\$ +1 for humor but needs to be a lot better specified. You need a objective scoring critereum at least \$\endgroup\$
    – mousetail
    May 31 at 12:47
  • \$\begingroup\$ @mousetail Sorry, it’s code-golf, forgot to mention. I don’t have time to update it yet but will do so in a few hours. It’s definitely not specified enough, since I’m still not entirely sure how the challenge will work—just wanted to post it so I A) don’t forget it, and B) can get some initial feedback on the idea \$\endgroup\$
    – noodle man
    May 31 at 12:48
  • \$\begingroup\$ How are you going to check if a answer is sufficiently corporate or sufficiently B.S.? \$\endgroup\$
    – mousetail
    May 31 at 12:48
  • \$\begingroup\$ Just make sure none of the SE staff notice… \$\endgroup\$ May 31 at 12:52
  • \$\begingroup\$ Is the output allowed to be a sentence that doesn't make sense? \$\endgroup\$ May 31 at 15:05
-1
\$\begingroup\$

Detect sloppy randomness

The C rand() function is often implemented like so:

static unsigned long int next = 1;

int rand(void) // RAND_MAX assumed to be 32767
{
    next = next * 1103515245 + 12345;
    return (unsigned int)(next/65536) % 32768;
}

void srand(unsigned int seed)
{
    next = seed;
}

However this is not a very good rng and definitely not a cryptographically secure one. Your task is to write code that detects this rng.

Specifically your code takes as input a sequence of 100 (or fewer if you so wish) numbers between 0 and 32767 inclusive.

For a random input the code should output "random" with at least 99.9999% probability and "not random" with at most 0.0001% probability (one in a million).

However if the input is generated using (successive calls to) rand then your code must output "not random" always.

Also, your code must be fast. Specifically it should run in under a second. Output as per standard rules.

Meta

Should I use a 64-bit rng? Solutions in fast languages can probably just brute force the 31-bit state. This would also allow to relax the time requirements.

\$\endgroup\$
1
  • \$\begingroup\$ Under a second on what hardware? \$\endgroup\$
    – mousetail
    Jun 1 at 13:26
-1
\$\begingroup\$

Inspired, maybe copy background from there

Given a map, output a shortest possible input.

Test cases:

Start here _ /  => / \
             \

               /
              /
Start here _ /\/ => /// /\/ \/\
             \/\

                /
               /
              /\
Start here _ /\/\ => //// //\\ /\/ \/\/
             \/\/

                   /\/
                /\/\/
Start here _ /\/\/\/\/ => /\//\//\/ \/\//\// /\/\/\/\/ \\\
             \/\/\  /\    \/\/\\//\
              \   \/
               \
\$\endgroup\$
5
  • \$\begingroup\$ What do you mean by shortest? Smallest number of paths? Do the paths also need to be shortest possible? (in your last example first or second path can skip the last / and the third I think is simply wrong (: ) \$\endgroup\$
    – pajonk
    Jul 13 at 6:09
  • \$\begingroup\$ @pajonk Sum new path, ` \ ` and /. Don't see problem on Test Case 3 or 4 \$\endgroup\$
    – l4m2
    Jul 13 at 6:16
  • \$\begingroup\$ In the last test case, third path, you have /\/\\//\/ but the 6th segment (first of two /s) doesn't exist in the map (or I don't understand something). \$\endgroup\$
    – pajonk
    Jul 13 at 9:48
  • \$\begingroup\$ @pajonk Misread as 3rd test case. \$\endgroup\$
    – l4m2
    Jul 13 at 10:32
  • \$\begingroup\$ It is unclear what the challenge is. \$\endgroup\$ Jul 13 at 11:37
-1
\$\begingroup\$

Python: *args or **kwargs?

Is it a regular argument or a keyword argument?


In Python, there are two types of specifying arguments to a function:

Regular argument (arg): f("regular argument")

Keyword argument (kwarg): f(keywordarg="keyword argument")

Keyword arguments in Python always are in the form of variable assignments and regular arguments are anything else. If you want to learn more about *args and **kwargs, click here.


Task

Given an input string consisting of only ascii characters that is a valid argument (regular or keyword), you must output one of two constant, distinct values representing whether it is an arg or a kwarg. Shortest code wins!


Test cases

3              -> arg
num = 3        -> kwarg
num=3          -> kwarg
a=b            -> kwarg
a==b           -> arg
False          -> arg
"kwarg"        -> arg
arg="arg"      -> kwarg
"kwarg=kwarg"  -> arg
a=b==c         -> kwarg
b==c           -> arg
[1,2,3,4]      -> arg
dict={1:2,3:4} -> kwarg
[1,2][i:=0]    -> arg

"""more than
one line!"""   -> arg

mstring='''
indeed more
than one line
'''            -> kwarg

Tags


Meta

  • Is this a duplicate?
  • Is this too focused on Python?
  • Do I need more test cases?
  • Any other feedback?
\$\endgroup\$
17
  • \$\begingroup\$ Explain the downvote. \$\endgroup\$ Jul 14 at 11:17
  • \$\begingroup\$ Can we assume ASCII only? \$\endgroup\$
    – mousetail
    Jul 14 at 11:32
  • \$\begingroup\$ @mousetail why are you asking? \$\endgroup\$ Jul 14 at 11:32
  • \$\begingroup\$ This question is just "does this string start with a valid python identifier followed by a =". But what constituted a valid identifier in python for weired unicode edge cases gets extremely complex. If you want unicode support you need a very large number of unicode test cases. \$\endgroup\$
    – mousetail
    Jul 14 at 11:34
  • \$\begingroup\$ @mousetail sure I’ll allow ascii only (but maybe a bonus for non-ascii as well?) \$\endgroup\$ Jul 14 at 11:35
  • \$\begingroup\$ codegolf.meta.stackexchange.com/a/8106/91213 \$\endgroup\$
    – mousetail
    Jul 14 at 11:36
  • \$\begingroup\$ @mousetail no bonus it is. \$\endgroup\$ Jul 14 at 11:38
  • \$\begingroup\$ @mousetail and about the valid identifier part: I said only valid arguments, so you won’t get £=1 or class. \$\endgroup\$ Jul 14 at 11:39
  • \$\begingroup\$ What if you get some weird Unicode character that normalizes to =? \$\endgroup\$
    – mousetail
    Jul 14 at 11:56
  • \$\begingroup\$ @mousetail i only allowed ascii \$\endgroup\$ Jul 14 at 11:58
  • \$\begingroup\$ £ is not ASCII \$\endgroup\$
    – mousetail
    Jul 14 at 12:02
  • \$\begingroup\$ @mousetail wait WHAT!?! \$\endgroup\$ Jul 14 at 12:03
  • \$\begingroup\$ @mousetail should we move this to chat? \$\endgroup\$ Jul 14 at 12:07
  • \$\begingroup\$ Let us continue this discussion in chat. \$\endgroup\$ Jul 14 at 12:07
  • \$\begingroup\$ Suggested test case [1,2][i:=0] is args \$\endgroup\$
    – mousetail
    Jul 15 at 15:12
-1
\$\begingroup\$

Decimal to fraction

In the pool of questions on CGCC, I have not found a question with this task.


Given a float in base 10, output a fraction in simplified form, improper or mixed. The output format can be any reasonable one. In , the shortest answer wins!

Test cases

3.5 -> 7/2 or 3 1/2
0.25 -> 1/4 or 0 1/4

Meta

  • Did I miss a duplicate?
  • Any more test cases?
  • Anything else?
\$\endgroup\$
1
-1
\$\begingroup\$

JSON Data? ASCII is better!

Write a function that prints JSON data using ASCII art, and takes a dictionary/object as input.

Example

Input:
{
    "columns": ["firstname", "lastname"],
    "data": [
        {"firstname": "John", "lastname": "Doe"},
        {"firstname": "Jack", "lastname": "Barrock"},
        {"firstname": "John", "lastname": "Skeet"},
        ....
    ]
}

Output:

+---------------------------+
|  firstname  |  lastname   |
+---------------------------+
|     John    |     Doe     |
|     Jack    |   Barrock   |
| ...                       |
+---------------------------+

This is , so fewest bytes win.

Note: The input will always have a column attribute, and will always have a data attribute. Think of it as SQL.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for posting here. Some feedback: 1. Challenge should be fully specified before the test cases. Specifically, how the table is drawn, centered text, what characters are used for table formatting etc. 2. You need more test cases. At least 5 if you can cover all edge cases that way \$\endgroup\$
    – mousetail
    Jul 31 at 13:12
  • 2
    \$\begingroup\$ I'm not sure if you fix those that it would be sufficienly different from this challenge Arnould mentioned. Note challenges don't need to be identical to be duplicates, closely related challenges can also be closed if they have the same general structure for solutions. \$\endgroup\$
    – mousetail
    Jul 31 at 13:14
-1
\$\begingroup\$

Worst algorithm for anything

Now, any coder worth their salt will know how to sort an array in-place in nlogntime. Most can probably figure out a way to do it in n!n time and factorial memory usage. Let's see an algorithm that tops those numbers; can you come up with a way to sort an array in up-arrow time? Can you come up with an algorithm whose O-notation contains the Graham's number series?

Rules:

  • The algorithm must solve a problem that isn't just an obfuscation of 'do a ridiculous amount of NOPs".
  • Highest O-notation in either memory usage or time wins, tie broken by the other one and then by a golfed implementation.

Discussion

I'm not sure whether I should limit this to solving a specific problem. For that matter, I don't know if this would be an interesting challenge.

\$\endgroup\$
-1
\$\begingroup\$

Catouterr

A cat that writes to two streams? I’m in!


Write a full program with these properties:

  • If the input string ends in outerr, remove that part and write the rest to STDOUT and STDERR.
  • If the input string ends in err but not outerr, remove that part and write the rest to STDERR only.
  • If the input string ends in out, remove that part and print the rest to STDOUT.
  • Otherwise, print it to STDOUT unchanged.

STDOUT and STDERR can be replaced by a reasonable alternative. Also, STDERR is not ignored. However, insuppressible messages are ignored.

This is , so shortest code wins!


Meta

  • Ask away!
\$\endgroup\$
5
  • \$\begingroup\$ Does it have to be a program or are functions allowed? \$\endgroup\$ Sep 28 at 17:30
  • \$\begingroup\$ I assume when you say "remove that part and write it" you mean "remove that part and write the rest to"? \$\endgroup\$
    – noodle man
    Sep 28 at 17:40
  • \$\begingroup\$ @CommandMaster full programs only. Added. \$\endgroup\$ Sep 28 at 19:08
  • \$\begingroup\$ @noodleman yes. Fixed. \$\endgroup\$ Sep 28 at 19:09
  • \$\begingroup\$ What would be examples of "reasonable alternatives" for stdout and stderr? Would it be reasonable to output both to stdout, but with a separator? \$\endgroup\$ 2 days ago
-2
\$\begingroup\$

Underhand Bejewled

Help me to write a game of bejewled, which cannot be lost!

Bejewled game rules

If you ever played bejewled, you can skip this, but for those who did not see it ever:

  • Playing field of 8*8 grid is filled in with gems of 7 different types randomly
  • By swapping two adjective stones, your goal is to create a line of at least three same type of stones in the either vertical or horizontal line
  • If did so, the gems will dissappear, points are added (say 20 points for a matching) and new gems are provided randomly from the top
  • image related:

enter image description here

Your challenge

Provide me a game which cannot be lost. In other words, the gems falling from the top are not random at all, but are falling in order that there is always at least one possibility to match three gems

But, from looking at the code at level of newbie programmer, it should look like that game acts as if it was random

Output

Playable game. As long as it is the grid of 8*8 filled in with 7 different types of "gems" the game is ok. It does not to have killer graphics, neither it does not need to be playable by mouse. (But in that case please make sure you show which "gem" is hovered and then selected)

Winning criteria

This is popularity contest. So highest rated game wins

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I think this is too big a task to work well for an underhanded contest. The programs will be way too large for anyone to actually read the source and try to find what's underhanded about it. \$\endgroup\$ Nov 11, 2014 at 8:32
  • \$\begingroup\$ Thats what I was also afraid of. I will either take it as lesson to progress on my programming skill, or abandon the idea completly \$\endgroup\$ Nov 11, 2014 at 8:38
-2
\$\begingroup\$

Create a Drawing Guide for a Polygram

Poor old Jim, he's just terrible at drawing polygrams, and he's asked you to create a "drawing guide" for him - an ascii polygram with numbered edges, so he can follow the instructions.

Challenge

Write a program to produce an ascii polygram with P <= 10; each edge of the polygram should be made of a single digit 0-9, showing the order in which the edges should be drawn.

Input

Your program should receive (via STDIN, as function arguments, or some other language-appropriate method): P, the number of edges/vertices of the polygram, and Q, the spacing. In the notation as per the Wikipedia link, you'll be drawing a {p/q} polygram.

Output

Either print to STDOUT or return (or something else language-appropriate) a multiline string showing the drawing guide for the given polygram. The string can be any size you like, as long as it's large enough to display a clear polygram.

Notes

Your code should be able to handle compound regular polygons as well as regular regular polygons, and also inputs of q > p/2 (poor old Jim doesn't realize that the polygram for {p/q} is the same as for {p/p-q}).

Example Output for {10,3}

              5              
             5 4             
                4            
     21     5        888     
     2 11115     8888  7     
     2    5111888 4    7     
     2     888111  4   7     
     2  888      111   7     
     8885           4117     
  8882               4 711   
 8   2 5               7  111
     25               47     
 9   5                 7    0
  9  2                 74  0 
    52                 7  0  
   9 2                 7 4   
  5 92                 7 04  
     9                 70  4 
 5   2                 7     
5    29                7    4
6666 2 9              07   33
    666              0 7333  
     2 696           337     
     2   9666     333  7     
     2    9  66633 0   7     
     2      333 666    7     
     2   339       666 7     
     2333   9    0    67     
             9  0            
               0 

Scoring

This is code-golf, so shortest in bytes wins. Tiebreaker goes to the most votes.

\$\endgroup\$
2
  • \$\begingroup\$ I have a python solution to this which is ~600 bytes, so it's definitely doable, and it's not easy... \$\endgroup\$ Apr 27, 2015 at 4:31
  • 5
    \$\begingroup\$ I think the spec needs to be more prescriptive for this to make a good question, especially since the example seems to indicate that you're not currently even prohibiting the lines from having gaps. At a minimum I would say that you should require the lines to be equivalent to those produced by Bresenham's algorithm, and specify how overlaps should be handled; at the extreme, you could tie it down so tightly that it becomes a parameterised kolmogorov-complexity. \$\endgroup\$ Apr 27, 2015 at 9:34
-2
\$\begingroup\$

Pointer to pointers to pointers to pointers

You should choose a language supporting pointers like C. And your task is simple: demonstrate a legitimate use of the most level of pointers.

You should justify your code by describing an algorithm that:

  • Has only plain text, number or an array of those as input and output.
  • You think it will make things easier to write those code as a part of the implementation of this algorithm.
  • This implementation would have optimum memory usage (only declared variables and parameters, explicitly allocated space, and the return addresses for recursive functions count).

Other rules:

  • They must be pointers to pointers directly, i.e. a pointer to an object containing a pointer doesn't count. It's better if nobody using this code will want to extend some pointer to an object later.
  • Each pointer must have a different type (if your language can somehow make them the same type).
  • You should create at least one pointer, and either dereference or compare two non-null pointers once in each level.
  • Using pointers as arrays is only half as interesting.
  • Iterators, etc, are considered in essence pointers and allowed in this challenge. But you can't define new types implementing iterators for this purpose.

\$\endgroup\$
3
  • 3
    \$\begingroup\$ Could you specify "legitimate"? This sounds a bit like code bowling (and seems to have the same issues). With enough imagination I'm sure I can justify any depth of pointers. \$\endgroup\$ Apr 30, 2015 at 17:43
  • \$\begingroup\$ @MartinBüttner Edited but, basically, it is subjective. \$\endgroup\$
    – jimmy23013
    Apr 30, 2015 at 17:57
  • \$\begingroup\$ @MartinBüttner Added a restriction to have optimum memory usage. I'm not sure whether it works. \$\endgroup\$
    – jimmy23013
    Apr 30, 2015 at 18:19
-2
\$\begingroup\$

Winning Tic-Tac-Toe lines

For a given tic-tac-toe board of size N**D (for example, a normal tic-tac-toe game is 3**2), the number of winning lines of length N is given by the expression:

$$ 2^{D-1} + \sum_{S=1}^{D-1}2^{S-1}DN^{D-S} $$

(Basically, you are summing the number of lines in each S-dimensional slice of the board.)

The challenge:

Given N and D, your answer should output a list of D-dimensional coordinates for each winning line. Input and output are any reasonable format. You can assume that both N and D are positive integers, with N > 1. (Degenerate cases of N=1, D>1 not included.)

Since this is , fastest answer wins. Please explain your algorithm!

\$\endgroup\$
7
  • \$\begingroup\$ How do you intend to determine which of two answers is fastest? \$\endgroup\$ May 12, 2015 at 19:37
  • \$\begingroup\$ yes, @randomra made the same point on chat. i'll edit this in, but i guess... i'll put together some test cases and then time them? i dunno, i was going back and forth between this and code-golf, but i'd prefer interesting and readable algorithms. \$\endgroup\$ May 12, 2015 at 20:10
  • \$\begingroup\$ i posted this here because i really want the answer, and i hate coming up with brute force solutions... :D \$\endgroup\$ May 12, 2015 at 20:16
  • 2
    \$\begingroup\$ Um. Given that you're asking people to enumerate an exponentially large set, in what sense will the answers not be brute force? \$\endgroup\$ May 12, 2015 at 20:28
  • \$\begingroup\$ well, there's brute force and then there's brute force. but really it's because i don't want to do it myself, haha. \$\endgroup\$ May 12, 2015 at 20:34
  • \$\begingroup\$ also, making use of symmetry can severely reduce the computation. \$\endgroup\$ May 12, 2015 at 20:40
  • 1
    \$\begingroup\$ I imagine that the runtime in any such algorithm will be basically proportional to the number of things you print, so there won't be any good way to improve by algorithm and the speed will be very platform-dependent. \$\endgroup\$
    – xnor
    May 12, 2015 at 23:40
-2
\$\begingroup\$

Ayn Random number generator


Inspired by xkcd 1277:

enter image description here

Write a random number generator that takes no input and generates a random integer between 1 and 100. When run less than 200 times, the frequency of all numbers needs to be between 0 and 2, but when it's ran 50 000 times, the number 42 (obviously) should have a frequence that's more than 4 standard deviations higher than the mean.

Format is code-golf. Your score is the bytecount of your code.

\$\endgroup\$
8
  • 1
    \$\begingroup\$ 1. I think it's difficult to decide objectively whether a PRNG appears to be fair at first sight. 2. The term more often should probably be quantified. \$\endgroup\$
    – Dennis
    May 18, 2015 at 21:49
  • \$\begingroup\$ I see lots of C rand()%1000 and the like incoming... \$\endgroup\$
    – rorlork
    May 18, 2015 at 22:05
  • \$\begingroup\$ @Ypnypn I have changed the criteria to have much lower numbers so they're easier to verify. \$\endgroup\$
    – Nzall
    Jun 6, 2015 at 13:04
  • 1
    \$\begingroup\$ @Dennis I have rewritten the question to clarify what "being fair" is and what "more often" actually entails. \$\endgroup\$
    – Nzall
    Jun 6, 2015 at 13:05
  • 1
    \$\begingroup\$ 1. Are you thinking of a standalone program that you run multiple times or a function that is allowed to keep a state? In the first case, not even a perfect RNG will, with overwhelming probability, satisfy the first condition. 2. Do you mean the mean and standard deviation of a perfect, uniform RNG or the one the code implements? \$\endgroup\$
    – Dennis
    Jun 6, 2015 at 23:44
  • \$\begingroup\$ @Dennis I'm thinking of just a function AynRandom() that gets called. The frequency of numbers with a small number of iterations is subject to change, maybe from 0 to 4. The mean and Standard Deviation must be the one the code implements. \$\endgroup\$
    – Nzall
    Jun 7, 2015 at 9:49
  • \$\begingroup\$ between 0 and 2 ? so print 42 would be a valid program ? \$\endgroup\$
    – Falco
    Jun 11, 2015 at 15:32
  • \$\begingroup\$ @Falco No, because 42 would appear more than 2 times (unless you only run it twice). The problem is that I need a way to indicate that the RNG is fair with a low iteration count, but unfair with higher iteration counts. The only way I can make it work is by stating that with low iteration counts, all numbers should appear about equally often, which is either 0, 1 or 2 times. \$\endgroup\$
    – Nzall
    Jun 11, 2015 at 15:36
-2
\$\begingroup\$

Please nitpick this. If there's anything that wouldn't work or would be inconvenient, however small of an issue it is, tell me about it!
Also, suggestions for [adjective] are more than welcome.


Determine how [adjective] a number is ()

A number would be considered [adjective] if 0 is the result of multiplying its digits together, then multiplying the digits of the resulting number, then repeating until a single-digit number is produced. The more steps it takes to reach 0, the more [adjective] the number is; if the resulting number is not 0, though, the number is not [adjective] regardless of how long it took to finish.
The formula used to determine [adjective]-ness is 10-10/T where T is however many numbers it took to reach 0 (including 0 and the initial input)

Your goal is, as the title says, to write a program or function that determines how [adjective] a number is, and prints every iteration along the way. Here are some example inputs/ouputs:

in: 879
out: 879    <-       (T=1)
     504    <- 8*7*9 (T=2)
     0      <- 5*0*4 (T=3)
            <- optional newline
     6.6... <- 10-10/3 (repeating decimals can be expressed in any way you want)

in: 2468
out: 2468   <-  T=1
     96     <- (T=2) 2*4*6*8
     54     <- (T=3) 9*6
     20     <- (T=4) 5*4
     0      <- (T=5) 2*0

     8      <- 10-10/5

in: -888
out: -888  
     -512   <- -8*-8*-8
     -10    <- -5*-1*-2
     0      <- -1*0

     6.6... <- 10-10/3

in: 1344
out: 1344
     48
     32
     6

     0    <- did not produce 0, so the prog/func returns 0

Your program must follow these rules:

-Takes input from STDIN.
-Throws an "error" (printed to STDOUT) and halts immediately after input if the input has one or more 0s in it or if it's less than three digits in length. The error must be a string, and as it's supposed to be printed to stdout, cannot be one generated by the language itself (eg 1/int(min(input())) to check if it's zero). Lastly, the error message has to clearly define what the error is; ERR:0 and ERR:LEN, for example, would suffice.

Bonuses/Penalties:

-25 if it properly handles decimals. For instance, an input of 99.22 would first turn into 9*9 + 0.(2*2), or 9*9 + 0.4, and so on.


This is , so the shortest answer in bytes wins.

\$\endgroup\$
7
  • 4
    \$\begingroup\$ I don't like the +15 penalty. Whether strings are used is vague in some languages. The constant amount +15 is too little deterrent for some languages but huge for very concise ones. The fact that you've found a short solution you don't like is sign you should rethink the problem, not try to plug the hole. \$\endgroup\$
    – xnor
    Jun 17, 2015 at 7:48
  • \$\begingroup\$ @xnor that's reasonable. I suppose it is a valid way of doing it, anyway, so I removed all mention of strings in that section. Should I also inc/decrease the bonus for decimals? \$\endgroup\$
    – user39326
    Jun 17, 2015 at 22:29
  • \$\begingroup\$ The programming languages I know either don't allow throwing user-defined errors or print them to STDERR. Now, if you just want us to print a message and exit immediately... \$\endgroup\$
    – Dennis
    Jun 17, 2015 at 23:32
  • \$\begingroup\$ ...and should be printed to STDOUT. I had a feeling that wasn't clear; I edited it, is it better now? \$\endgroup\$
    – user39326
    Jun 17, 2015 at 23:33
  • \$\begingroup\$ It's the word throw that throws me off (no pun intended). To throw an error usually means something rather specific. Print an error message to STDOUT (or closest alternative) would be less confusing in my opinion. Also, since this is code golf, I think you should require specific error messages. There's no fun in losing a contest because you chose ERR:LEN and somebody else got away with EL. \$\endgroup\$
    – Dennis
    Jun 18, 2015 at 3:16
  • 5
    \$\begingroup\$ Remove bonuses altogether. It's in the list of things to avoid. \$\endgroup\$
    – mbomb007
    Mar 1, 2016 at 21:31
  • \$\begingroup\$ The error if the input contains a zero seems like a separate challenge. It may be better received if there is only one challenge. There is community support for avoiding Chameleon challenges. \$\endgroup\$ Aug 10, 2016 at 11:40
1
138 139
140
141 142
150

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .