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


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.


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


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!


3554 Answers 3554

76 77
79 80

Addmod, Mulmod, Powmod


Imagine defining the modulo operation in terms of repeated addition or subtraction, so that a mod b is found by starting with a and repeatedly adding or subtracting b until the answer is in the range [0, b).

Call this operation addmod (which is equivalent to just mod), and similarly define mulmod and powmod, where the definitions are the same apart from replacing "addition or subtraction" with "multiplication or division" and "raising to the bth power or taking the bth root".


a mulmod b is found by starting with a and repeatedly multiplying or dividing by b until the answer is in the range [1, b). Note the range here is not [0, b) as that would allow multiplying or dividing a number within the range without leaving the range.


a powmod b is found by starting with a and repeatedly raising to the power of b or 1/b until the answer is in the range ( um, I'll think about this ).

For powers that give more than one result, always take the one that is positive and real.


There are three input values:

  • "Dividend" (a in "a mod b").
  • "Divisor" (b in "a mod b").
  • Function indicator. This can be one of:
    1. 0 for addmod, 1 for mulmod, 2 for powmod.
    2. 1 for addmod, 2 for mulmod, 3 for powmod.

Here "number" is not necessarily a base 10 representation, but must support non-integer input.

You may take the inputs in any defined order, or as a container holding them in any defined order.

Input ranges

  • addmod: a is in (-65536, 65536), b is in (0, 65536).
  • mulmod: a is in [0, 65536), b is in (1, 65536).
  • powmod: a is in (0, 65536), b is in (1, 65536).

Where [ and ] are inclusive, and ( and ) are exclusive.


A number corresponding to a mod b using the appropriate variation of mod (addmod, mulmod or powmod).

Test cases

[ To be added ]


  • \$\begingroup\$ Just for the record, I'm still in favour of limiting this to mulmod. :) \$\endgroup\$ Dec 14 '16 at 8:23
  • \$\begingroup\$ @MartinEnder I haven't ruled that out. I'm letting them all grow in parallel before deciding whether to prune. \$\endgroup\$
    – trichoplax
    Dec 14 '16 at 13:04

Graphical Stars

Meta: this is currently pretty rough so I could get some ideas down quick. I'm also probably not using the right terminology as I'm not very familiar with graphs and graph theory. Looking for feedback.

example star

Take an input integer 50 <= n <= 300 and construct a circular graph of n points. Randomly connect them with n/2 chords. Some points will likely have more than one edge - that's fine. Then, take a regular 5-pointed star of the same diameter as the circle, and use it as a stencil. Output the inner part of the star either to the screen or an image file.

  • \$\begingroup\$ You might want to find/make a better picture for this. The current one isn't a regular star. \$\endgroup\$
    – Geobits
    Dec 13 '16 at 21:46
  • \$\begingroup\$ You could also change it from "n points, with n/2 connected" to "n chords", which I think might give a better aesthetic. \$\endgroup\$
    – Geobits
    Dec 13 '16 at 21:47
  • \$\begingroup\$ @Geobits The star was taken from the header of an email Timmy got. n chords means n edges, right? Chords are generally for circles. \$\endgroup\$
    – Pavel
    Dec 13 '16 at 21:49
  • \$\begingroup\$ @Pavel I know where it came from, but while it's good for inspiration, it's misleading if that's the only one presented. \$\endgroup\$
    – Geobits
    Dec 13 '16 at 21:51
  • \$\begingroup\$ @Geobits Dang, you're right - the edges aren't quite straight across. I'll need to construct a different image. Thanks! \$\endgroup\$ Dec 13 '16 at 21:55
  • \$\begingroup\$ "Output the inner part of the star either to the screen or an image file." So should the outline of the star not be output? \$\endgroup\$ Dec 14 '16 at 8:22
  • \$\begingroup\$ @MartinEnder I see how that wording is confusing. When I have got my updated star, I'll edit that section appropriately. Thanks! \$\endgroup\$ Dec 14 '16 at 13:25

Radiation hardening meta-program (Cops)

Nuclear winter is coming, so you feel the need to radiation harden every program you've ever made in order to preserve your sanity during the fallout. Unfortunately, time is short, so you have to pick and choose which functionality to support.

Write a program that can take any valid program in the same language as input. Your program must then output a radiation hardened program that should do the same thing. Note that verifying that two programs are functionally equivalent is a form of the halting problem.

A counterexample will be a valid input program where the output will not be a correct, radiation-hardened version of the input. It is the job of the robber to find any such valid counterexample, showing that your meta-program is not a complete solution.

Radiation hardening meta-program (Robbers)

Nuclear winter is coming, and your buddy has gone insane. He claims he has a program that will save his sanity and preserve his life's work. You need to prove him wrong, because that's on your bucket list and time is short.

Find a valid program in the same language as the meta-program that, when given as input, the meta-program does not produce a correct, radiation-hardened version as output.

  • \$\begingroup\$ I think it is possible, as there are standard formats for radiation hardened programs in most 2D languages. The scoring method seems reasonable. +1 \$\endgroup\$
    – FlipTack
    Dec 14 '16 at 18:10
  • \$\begingroup\$ @Flp.Tkc The thing is that the program might be rather large to accomplish this task, and then hardening it with itself might take a long time to run. And then, how do we test programs? \$\endgroup\$
    – mbomb007
    Dec 14 '16 at 18:49
  • \$\begingroup\$ @Flp.Tkc those standard formats often assume that the workload program itself can be expressed as a linear program. plus, 2D languages also will almost always have some weird features that can make any program very brittle with respect to any kind of modification (like reading the source code). \$\endgroup\$ Dec 14 '16 at 18:57
  • 1
    \$\begingroup\$ @mbomb007 The main problem I see with this challenge is verifying the correctness of solutions. \$\endgroup\$ Dec 14 '16 at 18:58
  • \$\begingroup\$ @MartinEnder Same. If someone submitted a solution, it might be really long, and the output could be many times as long as the input. Then you have to determine what inputs to test, and verify each output. \$\endgroup\$
    – mbomb007
    Dec 14 '16 at 19:04
  • \$\begingroup\$ Perhaps we could go about it sort of like a KOTH. Write a controller that supports a bunch of languages, and it has a bunch of programs for each language that it will test and verify for a given submission, as well as running the submission on itself. I think the results would be worth it. \$\endgroup\$
    – mbomb007
    Dec 14 '16 at 19:05
  • \$\begingroup\$ @mbomb007 Then you'll get solutions that will work exactly for these tests. \$\endgroup\$ Dec 14 '16 at 19:07
  • \$\begingroup\$ @MartinEnder So? If someone can find a counterexample, then the answer is invalidated. \$\endgroup\$
    – mbomb007
    Dec 14 '16 at 19:10
  • \$\begingroup\$ Then I don't see how this helps with verifying the correctness of answers. \$\endgroup\$ Dec 14 '16 at 19:10
  • \$\begingroup\$ Let us continue this discussion in chat. \$\endgroup\$
    – mbomb007
    Dec 14 '16 at 19:11
  • \$\begingroup\$ You need a requirement that the language is a programming language. (Otherwise, it can trivially be solved using a "language" in which all programs are cat.) \$\endgroup\$
    – user62131
    Dec 14 '16 at 21:13
  • \$\begingroup\$ @ais523 That's really a default. \$\endgroup\$
    – mbomb007
    Dec 14 '16 at 21:19
  • 1
    \$\begingroup\$ @mbomb007: There are multiple contradictory Meta posts about it. Until we can get our act together and come to a conclusion on it, it's best for challenges to say explicitly when it's relevant. \$\endgroup\$
    – user62131
    Dec 14 '16 at 21:25
  • \$\begingroup\$ Nah. If it's not within the spirit of the challenge, it'll be pretty obvious and deleted soon after. \$\endgroup\$
    – mbomb007
    Dec 14 '16 at 21:31

Anagrammatic quine

Your task is to create a program which is a quine, with the added challenge that all permutations of characters of the program still generate the same output as the first program.

So, for example, if your program is


this program must output


exactly, with optional leading or trailing newlines.

Any permutations of the program's characters, so


must also output abc.


  • You must have at least 2 distinct characters in your program.
  • No comments.
  • \$\begingroup\$ I doubt this is possible for quines longer than one or possibly two characters? \$\endgroup\$ Dec 18 '16 at 9:51
  • \$\begingroup\$ @StewieGriffin It's always impossible until Dennis shows up and does a less than 20-byte Jelly solution. Then it's possible. TBH, I have no idea how this is going to turn out - perhaps it's going to be like a "Tetris in GoL" question? \$\endgroup\$
    – clismique
    Dec 18 '16 at 9:57
  • \$\begingroup\$ Less than 20, sure... more than 2 (distinct) characters; I'd be very surprised. It would mean all combination of those characters must be a quine. \$\endgroup\$ Dec 18 '16 at 10:14
  • \$\begingroup\$ @StewieGriffin In the current situation, acb outputs abc, not acb (so it's not a quine in itself). Would it be easier or harder if I make it a quine instead of a single output? \$\endgroup\$
    – clismique
    Dec 18 '16 at 10:24
  • \$\begingroup\$ @Qwerp-Derp depends on what you want the challenge to be. Now it's like almost impossible (though I already have a solution lol, thanks esolangs.org) ; but saying 'all permutations must be quines too' make it even harder I think. \$\endgroup\$ Jul 18 '17 at 14:01

Interweaved quine

Your task is to create a program that, when run, returns itself as output (this is known as a quine). However, this quine must, when it is copied n times, returns the quine, but with each of its characters duplicated in place n times.

If your original program is Derp:

Derp -> Derp (must return itself as output to be a quine)

DerpDerp -> DDeerrpp
(the "Derp" is copied twice, so each character in the output has to be copied twice)

DerpDerpDerp -> DDDeeerrrppp
etc. etc.

Rules and Specs:

  • You are allowed to have leading and/or trailing newlines in your program.
  • Your program must contain at least two distinct characters (which implies that your code must be at least 2 bytes long).
  • Standard quine rules apply.
  • \$\begingroup\$ What happens if the program is copied -1 times (ie layed out in reverse)? \$\endgroup\$
    – user41805
    Dec 21 '16 at 10:52
  • \$\begingroup\$ @KritixiLithos It doesn't really matter, it could do whatever it wants. \$\endgroup\$
    – clismique
    Dec 21 '16 at 11:13
  • 1
    \$\begingroup\$ The first sentence also seems unnecessarily complicated, especially for people who don't know what a quine is. How about something like "Your task is to write program which prints its own source code (a quine). However, when the program's source code is repeated N times, it should print its code with each character repeated N times instead." The examples could also be condensed into a single code block, which would allow you to add one or two more examples for clarity without using lots of vertical space. \$\endgroup\$ Dec 21 '16 at 13:47
  • \$\begingroup\$ You should say n is guaranteed to be a positive integer larger than (or equal to) 1 \$\endgroup\$
    – FlipTack
    Dec 24 '16 at 20:07

ASCII TIE-Fighter Fleet Stereogram

ASCII Sterograms are pretty rare and there's been quite a few noteable ones that I've seen. However, there is one that I've had the most success with and it's also one of the more simple ones. I used to send this one to people on AIM way back when that existed. View the picture below, notice that it's 3 separate lines of "TIE-Fighters". For one to view the fleet in 3D, they must try to make 4 lines out of the 3 lines by crossing their eyes just enough to get it to line up perfectly. Once you see four lines the TIE Fighters should seem to "pop out".

Give it try:

      (-O-)      (-O-)      (-O-)
     |-O-|       |-O-|       |-O-|
    (-O-)        (-O-)        (-O-)
   |-O-|         |-O-|         |-O-|
  (-O-)          (-O-)          (-O-)
 |-O-|           |-O-|           |-O-|
(-O-)            (-O-)            (-O-) 

If you can't see what I'm talking about, try being extremely close to your monitor while viewing it. If that doesn't work, try transferring it to a notepad using "Courier" as the font. If you can't see it at all, then I apologize to you for getting your hopes up.

The Challenge

Your challenge is to take in a number 100 > n > 3 and output that many rows of TIE fighters. The fighters must be centered as shown in the example art and must alternate between the following patterns, (-o-) and |-o-| starting with (-o-). Columns should be separated initially by 6 spaces, increasing by 1 each iteration to create the forced perspective we're looking for.

This is lowest byte-count wins.

  • \$\begingroup\$ -1 for giving me a headache :p \$\endgroup\$ Dec 22 '16 at 21:00
  • \$\begingroup\$ @TimmyD try ANY of the others on the link I put. This one is tame in comparison haha \$\endgroup\$ Dec 23 '16 at 1:14


Tic-Tac-Toe is a solved game. It is possible on current hardware to generate a complete game tree using the minimax algorithm. However, doing so is CPU and memory intensive. There are various ways of generating an incomplete game tree that will still solve the game using, for example, sorting, pruning, lookup tables and other means.


Your task is to code a function that, given a particular game state, will construct a game tree and "solve" the game. Your function is expected to return the best possible move given the current game state and also output the game tree, along with a total count of the nodes constructed, to the console. The objective is to generate the smallest tree, by node count, while still solving the game. The function must accept at least two arguments. 1) a string representing the game state. 2) an integer representing who's turn it is to play.

The winning entry will be the one that generates the least amount of nodes while still solving the game. If there is a tie, the function that was submitted first will win, unless the subsequent entry can be shown to run 25% faster. Scoring (number of nodes), will be done only with the input given in the input example below. Note that your function is still expected to work properly given any valid tic-tac-toe game state.

Example Input and Output

The first agument passed to the function is the game state. It is represented by a string of 9 comma seperated integers. Each integer represents the state of a square on the tic-tac-toe board sequentially. 0 reprensents an empty square, 1 a square with an X and -1 a square with an O.

The second argument is the player who's turn it is to make the next move. It is an integer where 1 means player X and -1 means player O.

Input example:

"0,0,0,1,0,0,-1,0,0", 1

This example input represents the following game sate, with player X making the next move: Tic-Tac-Toe board


The function will return an integer 0-8 representing the next move.


The function must also output the game tree to the console and how many nodes were created.


Final instructions

If you end up using look-up tables, they must be empty to begin with and be generated as the tree is being created/traversed.

Node values should be dependant on children terminal/leaf node actual values. Your are not allowed to use some kind of heuristic or simulation to evaluate a node. If a tree branch is not expanded all the way to terminal nodes, it must be because the algorithm figured out that it would be useless to do so or because it has already come across the same game state node elsewhere in the tree and can use that information instead of expanding further.


What can I spell?

My mother-in-law has a set of wooden blocks that together spell out fRoSty The Snowman. Specifically, f, R, o, S, t, and y are all painted on separate blocks (note that R and S are capitalized). And then there's one longer block that says The Snowman.

However, each block also has a different letter on the reverse side. For example, if you flip the f block around, it shows a B. So you could instead spell out BRoSty The Snowman. (Sidenote: Googling Brosty the Snowman reveals several Twitter users with that alias. Those people are not me, and their opinions are their own. I do not endorse their comments.)

Similarly, the reverse side of the R is an e, and on the back of the t is a u.

Or actually, I'm not really sure if that's a u or an n on the other side of the t. So I guess it could really be either one!

So the full set of blocks is

f <--> B

R <--> e

o <--> M <--> W

S <--> i

t <--> u <--> n

y <--> E

The Snowman <--> xo xo xo <--> ox ox ox

Note that The Snowman has a space, and xo xo xo includes two spaces, as does ox ox ox.

Of course, when writing out a phrase you can re-order the blocks, you don't have to use every block, and you can't use a block twice. (If you like: from each block, either zero or one of the two or three options may be used.)

Finally, you can insert at most 1 space in between any two blocks. So both fRoSty The Snowman and fRoStyThe Snowman are possible, but fRoStyTheSnowman is not possible because the block with The Snowman includes a space.

So the question is, Given a phrase, can I spell it out using these blocks?


A string of printable-ASCII characters, of length 1 or more. If you like, you may assume the input has only letters (A-Z a-z) and spaces .

You may also assume that the input won't begin or end in a space, and will never have multiple spaces in a row.

You may take the input as a string or array of characters or whatever is convenient and conventional in your language.


You should output a Truthy value if the message can be spelled using the blocks, and a Falsey value otherwise.

Truthy Examples:

fRoSty The Snowman

fRoStyThe Snowman

SMuRfy The Snowman

fRy SuM ox ox ox

xo xo xo MRS BEn

xo xo xo MR BEn (don't need to use every block)

eW (Both e and E appear in the set of blocks)

WRiThe Snowman

R u The Snowman

y i M The Snowman Rn

BRThe Snowmano

Box ox oxy

xo xo xo

t o yS


Falsey Examples:

The Snowman BRoW (the o and W can't occur simultaneously)

TheSnowman (again, the block in question clearly reads The Snowman)

The snowman (input is case-sensitive)

The Snowmen

The SMuRfy Snowman



xo xo xo The Snowman



yo yo yo

Ho Ho Ho

xo xo xo MR bEn

More egg nog please

Invalid inputs (you are allowed to assume such inputs will not occur):

The Snowman (adjacent multiple spaces)

(has space at the beginning/end of the string)

fRo5ty (only letters and spaces allowed)

Is there any more egg nog left?

Should we make some more egg nog?

Is there any alcohol at all in the house?

I'll be back in a bit

`` (The empty string)

Other rules

My mother-in-law's Internet access is not the best, so the shorter your code, the better. Hence, this is . Shortest code wins! You may use any of the default input and output methods, and standard loopholes are forbidden.

If you have a built-in that will do this for you, then I guess this is your chance to use it! Please feel free!

Room for improvement

Obviously, let me know if this is too close to another question, or if it's unclear.

Please let me know if you'd rather see different rules. Please feel free to propose any suggestions that would improve the challenge.

Other test cases that I need to include?

Would different formatting be more convenient?

  • \$\begingroup\$ "it could really be either one" What does that mean? \$\endgroup\$ Dec 28 '16 at 1:56
  • \$\begingroup\$ I mean that the block could function as either a u or an n. (Because if you turn a u upside down, it becomes an n.) \$\endgroup\$
    – mathmandan
    Dec 28 '16 at 13:37
  • \$\begingroup\$ Well, that's more clear now. \$\endgroup\$ Dec 28 '16 at 13:41

Create an equation who's only solution is the numerical ASCII code of the equation itself

Your equation will be run as a Wolfram Alpha query with Solve prepended to it.

The equation must start with (spaces optional):

y = 

Output is considered to be the string in the second box of Wolfram Alpha, after your prefix (above) is stripped. If the string is not numerical, it is disqualified.

Only these functions are allowed.

  • \$\begingroup\$ This is a duplicate of the standard quine challenge with a language restriction slapped on top. Its not uninteresting or boring but I and I would think others will vote to close this if it is posted as is. I don't have any recommendations for how to fix this, but if you want to see this answered I would suggest offering a bounty rather than posting a question. \$\endgroup\$
    – Grain Ghost Mod
    Dec 27 '16 at 5:25

Golf a Sound Change Applier

(Snappier title suggestions appreciated)


The pronunciation of human languages changes over time. Often, sound changes follow discernable rules, with the same change applied consistently across many words in a language. For example, a lot of words that started with f in Latin now start with h in Spanish: facere -> hacer, fervere -> hervir, fīcus -> higo, and fīlius -> hijo.

Mark Rosenfelder, a well-known name in conlang circles, wrote a program called Sound Change Applier to help simulate this process. Actually, the SCA constitutes a small pattern-matching and substitution language. For this challenge, we're going to implement a pared-down version.

The language

An SCA program transforms a list of words according to a collection of sound change rules. It consists of two sections: category definitions and substitutions.

Category definitions are lines of the form V=aeiou, where V is the category name (must be a single character) and aeiou are the category entries. Categories define groups of similar speech sounds (we'll use the term "letters," though strictly speaking that's a bit misleading); for instance, the above example is the category of vowels.

Substitutions are where the magic happens. They take the form target/replacement/environment, where the constituent parts are as follows:

  • target and replacement are strings containing any number of letters and 0 or 1 category names, in any order. They represent the string to be replaced and the string to replace it with, respectively.
  • environment is a string containing exactly 1 underscore (_), representing the substitution, and any number of letters and category names, representing the required context for the substitution to take place. It can also contain the # character, representing the beginning or end of a word.

Some examples, assuming the V category from earlier:

ii/i/_    Change ii to i anywhere in a word
i/j/_V    Change i to j when followed by a vowel
u/o/_#    Change u to o at the end of a word
p//V_t    Delete p if preceded by a vowel and followed by t

Categories in substitutions

When category names are used in the environment, the environment matches if any member of the category is in the appropriate place. For example, the last rule above will delete the p from apt, opt, inept, or scripting, but not from thbpt.

The same is true when categories are used in the target but not the replacement. For example, the rule V/e/Vr_# will delete any vowel if it matches the environment: opera -> oper, sombrero -> sombrer, calamari -> calamar (but not cobra -> cobr because the environment vowel isn't matched).

However, if categories are used in both the target and replacement, the replacement letter must come from the same position in its category as the matched target letter does in its category.

For example, suppose we have these category definitions: S=ptc, Z=bdg. (These are unvoiced and voiced stops, respectively.) Then the substitution S/Z/V_V (changed unvoiced stops to voiced between vowels) represents three possible substitutions: p -> b, t -> d, and c -> g.


An SCA program accepts as input a list of words to be transformed. It goes down the list of substitutions in order, applying each one to all words in the word list. Each substitution is applied repeatedly until the environment and/or target no longer matches. Then the next substitution is applied. When all substitutions have completed, the program outputs the transformed list of words.

Miscellaneous rules

If a category is used in the replacement, a category must also be used in the target.

The replacement may be empty, but the target may not be empty.

Category names, letters, and words in the word list will never use the characters =/#_ or space.

The challenge

Write a program or function that takes an SCA program and a list of words and outputs/returns the result of running that program on those words.

You may assume that the SCA program is syntactically valid and that the words do not contain any forbidden characters. If these assumptions are broken, your code may do anything (handle it gracefully, crash, output gibberish).

I/O format

Input format is flexible. You may take the program as a multiline string or a list of strings. The category definitions and substitutions may be in the same string/list or two different strings/lists (or contained in a two-item list). The input words may be in a list or a space- or newline-delimited string. Similarly, output may be a list or a space- or newline-delimited string.

Any of the default I/O methods are acceptable. You may use different input methods for category definitions, substitutions, and input words if it makes the task easier in your language.

Linguists use many letter forms that are not present in ASCII. Therefore, your program must be able to accept Unicode characters up through U+1FFF (at least) in both the rules and the word list.


Adapted from Mark Rosenfelder's site, here is a simplistic Latin-to-Portuguese converter.





Given the following input list:


the output list should be as follows:


This is ; the shortest code wins.

  • \$\begingroup\$ "Sound Change Applier" is so XKCD thing-explainer style! Although I admit it might not be a good fit here on PPCG. As for the challenge itself, I'd say, try to make it a bit more clear, have explicit definitions for all the important words you pick, so that there is no confusion on what counts as substitution and what doesn't, as an example. \$\endgroup\$ Dec 28 '16 at 1:53

Output every string

Your task here is simple. Write a program, in as few bytes as possible, which prints every single possible string. Your program should, given infinite memory, never terminate, however for any given string there should be a finite time to be generated. (that is, a aa aaa aaaa ... Won't work as it will never generate b).

The strings to be generated should consist of all the characters in the same encoding as your answer, which you must specify if not utf-8.

The exception is that you must choose a character to exclude from your strings, which you will use to delimit strings. You may optionally have one leading delimiter.

Remember to include the empty string!

  • 4
    \$\begingroup\$ I think this would be a duplicate of output all strings. \$\endgroup\$
    – xnor
    Dec 28 '16 at 20:14
  • \$\begingroup\$ @xnor that one takes input, this one just encompasses every possible string. I think it's worth having a challenge for that. \$\endgroup\$
    – Pavel
    Dec 28 '16 at 20:25
  • 1
    \$\begingroup\$ I disagree here: the new part is generating one of every character (except a separator), which I don't think merits a new challenge. \$\endgroup\$
    – xnor
    Dec 28 '16 at 20:28

Arrange ranges of numbers in columns

Write a program to print from m to input n with step s, arranging the numbers in either horizontal or vertical columns.


  • You can use any two values, or kinds of values, for signifying horizontal and vertical columns, specifying these in your answer.

Test cases

m = 1, n = 15, s = 1, vertical columns

m = 1, n = 11, s = 2, horizontal columns

m = 1, n = 11, s = 2, vertical columns

Any more clarifications or test cases?

This challenge is based on a chat mini challenge by Helka Homba, which is allowed to be used in real challenges under the conditions of Calvin's Hobbies Public License.


Natural Order Sorting

Goal :: Writing a sorting algorithm that doesn't need preceding zeroes to sort music files properly.

Natural Order Sorting will be defined in this way:

  • Consecutive Digits (ie [0-9]+) are considered one character and its value is the evaluation of those digits as an integer (eg int("0123"))
  • Uppercase Letters (ie [A-Z]) are each their own character and its value is the ASCII value of the letter
  • Lowercase Letters (ie [a-z]) are each their own character and its value is the corresponding uppercase value plus .5
  • Symbols (ie [^0-z]) are each their own character and its value is the ASCII value of the symbol
  • Symbols are always before Digits which are always before Letters
  • If two characters are in the same category, the one with the small value precedes the other


  • Input :: An unordered list of strings (flexible on how)
  • Output :: A list of strings that are naturally ordered (flexible on how)
  • Victory :: Shortest program/function in bytes, wins

Test Cases

Input                             Output
-----                             ------
10,11,8,9                      -> 8,9,10,11
appleA,CiderB,AppleC           -> AppleC,appleA,CiderB
File1,File12,File143A,File031B -> File1,File2,File031B,File143A


Source code standard deviation

Your program should accept as input a string, convert it to a unsigned byte array using UTF-8 encoding and output the standard deviation of the n bytes.

Standard deviation is given by this formula, where x1...xn are the string's bytes:



Input hello:

  • UTF-8 encoding returns the list [104,101,108,108,111]
  • mean is 106.4
  • standard deviation is 3.49857113690718

More test cases:

  • ppcg: 5.678908345800274
  • aaaaa: 0
  • azazaz: 12.5
  • smiley☺: 41.12432220162674


Your score is the standard deviation of your source code, using the above algorithm, divided by the length of your source in bytes, using UTF-8 encoding. The higher the better.

For example, the score for the program hello is: 3.49857113690718 / 5 = 0.699714227381436

Related: Calculate Standard Deviation

  • \$\begingroup\$ Programs can pad their standard deviation by including a huge number of the highest and lowest possible character in equal amounts in a comment. \$\endgroup\$
    – xnor
    Jan 12 '17 at 6:18
  • \$\begingroup\$ @xnor yes, but after some time, the score decreases when adding these characters. For example, hello scores 0.69, hello ÿ scores 6.15, hello ÿ ÿ scores 5.31. \$\endgroup\$
    – Arnaud
    Jan 12 '17 at 7:08
  • \$\begingroup\$ I see you now this doesn't raise your score arbitrarily, though the numbers I'm getting are different. \$\endgroup\$
    – xnor
    Jan 12 '17 at 7:19
  • \$\begingroup\$ @xnor I think you need to use statistics.pstdev, not statistics.stdev \$\endgroup\$
    – Arnaud
    Jan 12 '17 at 7:31
  • \$\begingroup\$ So an answer in Unary is guaranteed to score 0? \$\endgroup\$ Jan 12 '17 at 10:40
  • \$\begingroup\$ @PeterTaylor yes, an answer in Unary is guaranteed to lose, as the higher score the better. \$\endgroup\$
    – Arnaud
    Jan 12 '17 at 10:42
  • \$\begingroup\$ @SuperChafouin I see. Putting in pstdev still gives different numbers from yours. \$\endgroup\$
    – xnor
    Jan 12 '17 at 21:45
  • \$\begingroup\$ ÿ is interpreted by the python command ord as integer 255 - while it should be the two bytes 0xC3 0xBF. \$\endgroup\$
    – Arnaud
    Jan 13 '17 at 4:09

The many errors of twin primes

Note: this is a repost of my earlier challenge, but with a different winning condition and better rules.


Bob was handed the following assignment for his programming class (this is not the actual challenge).

Homework assignment 11: Twin primes

Take as input an integer n ≥ 8 and print a single character, depending on n:

  • If n is not a prime number, print N for "Not prime".
  • If n is a prime number, but neither of n - 2 and n + 2 is, print I for "Isolated prime".
  • If n and n + 2 are both prime numbers, print L for "Lower twin prime".
  • If n and n - 2 are both prime numbers, print U for "Upper twin prime".

Bob tried hard to solve the assignment, but his program kept crashing, and in the end, he gave up and submitted it in hope of partial credit. Nevertheless, Bob's program has the curious property that even though it never does what it's supposed to, the input is still classified correctly depending on the program's behavior: non-primes result in no output, isolated primes in a crash, lower twin primes in an infinite loop with no output, and upper twin primes in an infinite loop that keeps printing the correct message.

The Task

Your task is to replicate the behavior or Bob's solution: you shall write a program or function that behaves as follows. Your input is a single integer n ≥ 8.

  1. If n is not a prime number, print nothing and exit gracefully.
  2. If n is a prime number, but none of n - 2 or n + 2 is, print nothing and exit with a runtime error of some kind (like stack overflow or division by 0).
  3. If n and n + 2 are both prime numbers, print nothing and keep running indefinitely (or until you run out of memory).
  4. If n and n - 2 are both prime numbers, repeatedly print the character U to STDOUT indefinitely (or until you run out of memory). The output can contain newlines, commas or other separators.

Input can be taken with any of our default methods, but all output must go to STDOUT (and STDERR in case of error) or closest alternative.

The lowest byte count wins.

Test cases

8 -> [no output]
9 -> [no output]
10 -> [no output]
11 -> [infinite loop]
12 -> [no output]
13 -> UUUUUUUUU[continues indefinitely]
14 -> [no output]
15 -> [no output]
16 -> [no output]
17 -> [infinite loop]
18 -> [no output]
19 -> UUUUUUUUU[continues indefinitely]
20 -> [no output]
21 -> [no output]
22 -> [no output]
23 -> [runtime error]
29 -> [infinite loop]
31 -> UUUUUUUUU[continues indefinitely]
37 -> [runtime error]

Sandbox notes

To keep the rules simple, I decided to only allow output to STDOUT.

  • \$\begingroup\$ that's not really simplifying? couldn't you allow functions, but mandate output through stdout and stderr? \$\endgroup\$ Jan 5 '17 at 9:30
  • \$\begingroup\$ @DestructibleWatermelon Yeah, that's actually much more reasonable. \$\endgroup\$
    – Zgarb
    Jan 12 '17 at 7:49
  • \$\begingroup\$ Would it not be better to edit the previous question and try to get it reopened? \$\endgroup\$ Jan 12 '17 at 16:28
  • \$\begingroup\$ @PeterTaylor Ideally, yes. But it has existing answers, which are not competitive at all in a pure golf context. Won't that be an issue? \$\endgroup\$
    – Zgarb
    Jan 12 '17 at 18:15
  • \$\begingroup\$ Hmm. I noticed that golfing was taken into account in the previous scoring system, but I didn't notice that 2 out of the 3 answers didn't golf. I retract my previous suggestion. \$\endgroup\$ Jan 12 '17 at 19:47

Prime Factors that Weren't there Before

Given a list of integers a, calculate the prime factorization for each integer in the array. Then, return a list of factors that do not appear in the original input, even as part of another number. For instance, if you were given:

a = [1243,11311]

The prime factors would be calculated as:

a' = [[11, 113], [11311]] = []

Because 11 appears in 11311, and 113 appears in 11311, the result would be [], an empty set.

Lets look at another example:

a = [270,325,192] = [[2, 3, 3, 3, 5], [5, 5, 13], [2, 2, 2, 2, 2, 2, 3]] = [13]

Another example:

a = [27072,32585,19296] a' = [[2, 2, 2, 2, 2, 2, 3, 3, 47], [5, 7, 7, 7, 19], [2, 2, 2, 2, 2, 3, 3, 67]] a'' = [47,67]

A bigger example:

a = [56,3924,10000,1240124]
a' = [[2, 2, 2, 7], [2, 2, 3, 3, 109], [2, 2, 2, 2, 5, 5, 5, 5], [2, 2, 31, 73, 137]]
a'' = [7,109,31,73,137]

This is code golf, lowest byte-count wins.


Play time

Hello. It is time to play the most popular portuguese card game: Sueca! So for people who does not know the game, it is needed to print a wall poster to make them know the power and the points each card has.

So, the job is to print an ASCII art wall as:

    11        10        4         3         2        ———       ———       ———       ———       ———
╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ 
|A     A| |7     7| |R     R| |V     V| |D     D| |6     6| |5     5| |4     4| |3     3| |2     2| 
|♥     ♥| |♥     ♥| |♥    /♥| |♥    /♥| |♥    /♥| |♥     ♥| |♥     ♥| |♥     ♥| |♥     ♥| |♥     ♥| 
|       | |  ♥ ♥  | | ♔ /  | | ♗ /  | |  ♕ /  | |  ♥ ♥  | |  ♥ ♥  | |  ♥ ♥  | |       | |   ♥   | 
|   ♥   | |   ♥   | |   /   | |   /   | |   /   | |  ♥ ♥  | |   ♥   | |       | |  ♥ ♥  | |       | 
|       | |  ♥ ♥  | |  / ♔ | |  / ♗ | |  / ♕  | |  ♥ ♥  | |  ♥ ♥  | |  ♥ ♥  | |   ♥   | |   ♥   | 
|A     A| |7 ♥ ♥ 7| |R/    R| |V/    V| |D/    D| |6     6| |5     5| |4     4| |3     3| |2     2| 
|♥     ♥| |♥     ♥| |♥     ♥| |♥     ♥| |♥     ♥| |♥     ♥| |♥     ♥| |♥     ♥| |♥     ♥| |♥     ♥| 
╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ 
╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ 
|A     A| |7     7| |R     R| |V     V| |D     D| |6     6| |5     5| |4     4| |3     3| |2     2| 
|♦     ♦| |♦     ♦| |♦    /♦| |♦    /♦| |♦    /♦| |♦     ♦| |♦     ♦| |♦     ♦| |♦     ♦| |♦     ♦| 
|       | |  ♦ ♦  | | ♔ /  | | ♗ /  | |  ♕ /  | |  ♦ ♦  | |  ♦ ♦  | |  ♦ ♦  | |       | |   ♦   | 
|   ♦   | |   ♦   | |   /   | |   /   | |   /   | |  ♦ ♦  | |   ♦   | |       | |  ♦ ♦  | |       | 
|       | |  ♦ ♦  | |  / ♔ | |  / ♗ | |   / ♕ | |  ♦ ♦  | |  ♦ ♦  | |  ♦ ♦  | |   ♦   | |   ♦   | 
|A     A| |7 ♦ ♦ 7| |R/    R| |V/    V| |D/    D| |6     6| |5     5| |4     4| |3     3| |2     2| 
|♦     ♦| |♦     ♦| |♦     ♦| |♦     ♦| |♦     ♦| |♦     ♦| |♦     ♦| |♦     ♦| |♦     ♦| |♦     ♦| 
╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯
╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ 
|A     A| |7     7| |R     R| |V     V| |D     D| |6     6| |5     5| |4     4| |3     3| |2     2| 
|♣     ♣| |♣     ♣| |♣    /♣| |♣    /♣| |♣    /♣| |♣     ♣| |♣     ♣| |♣     ♣| |♣     ♣| |♣     ♣| 
|       | |  ♣ ♣  | | ♚ /  | | ♝ /  | |  ♛ /  | |  ♣ ♣  | |  ♣ ♣  | |  ♣ ♣  | |       | |   ♣   | 
|   ♣   | |   ♣   | |   /   | |   /   | |   /   | |  ♣ ♣  | |   ♣   | |       | |  ♣ ♣  | |       | 
|       | |  ♣ ♣  | |  / ♚ | |  / ♝ | |  / ♛  | |  ♣ ♣  | |  ♣ ♣  | |  ♣ ♣  | |   ♣   | |   ♣   | 
|A     A| |7 ♣ ♣ 7| |R/    R| |V/    V| |D/    D| |6     6| |5     5| |4     4| |3     3| |2     2| 
|♣     ♣| |♣     ♣| |♣     ♣| |♣     ♣| |♣     ♣| |♣     ♣| |♣     ♣| |♣     ♣| |♣     ♣| |♣     ♣| 
╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ 
╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ 
|A     A| |7     7| |R     R| |V     V| |D     D| |6     6| |5     5| |4     4| |3     3| |2     2| 
|♠     ♠| |♠     ♠| |♠    /♠| |♠    /♠| |♠    /♠| |♠     ♠| |♠     ♠| |♠     ♠| |♠     ♠| |♠     ♠| 
|       | |  ♠ ♠  | | ♚ /  | |  ♝/  | |  ♛ /  | |  ♠ ♠  | |  ♠ ♠  | |  ♠ ♠  | |       | |   ♠   | 
|   ♠   | |   ♠   | |   /   | |   /   | |   /   | |  ♠ ♠  | |   ♠   | |       | |  ♠ ♠  | |       | 
|       | |  ♠ ♠  | |  / ♚ | |  / ♝ | |  / ♛  | |  ♠ ♠  | |  ♠ ♠  | |  ♠ ♠  | |   ♠   | |   ♠   | 
|A     A| |7 ♠ ♠ 7| |R/    R| |V/    V| |D/    D| |6     6| |5     5| |4     4| |3     3| |2     2| 
|♠     ♠| |♠     ♠| |♠     ♠| |♠     ♠| |♠     ♠| |♠     ♠| |♠     ♠| |♠     ♠| |♠     ♠| |♠     ♠| 
╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯
  • \$\begingroup\$ You should specify which specific characters should be used. Of note, several of the ones you used don't appear to fall in the ASCII range. \$\endgroup\$ Jan 13 '17 at 0:51
  • \$\begingroup\$ @FryAmTheEggman: Should I call it Unicode Art? \$\endgroup\$
    – sergiol
    Jan 13 '17 at 1:30
  • \$\begingroup\$ @FryAmTheEggman If you know better chars than ♔♗♕ ♚ ♝ ♛ for me to put in the question, please tell me. I don't like the effect they have on the white space width after them. \$\endgroup\$
    – sergiol
    Jan 13 '17 at 1:33
  • \$\begingroup\$ I'm afraid I don't know of any better characters, but yes, that would be less confusing. I still think adding the exact character codes would be a good idea. \$\endgroup\$ Jan 13 '17 at 1:47
  • \$\begingroup\$ The "ascii-art" looks aweful in my browser (firefox on win): i.stack.imgur.com/keYgN.jpg \$\endgroup\$
    – flawr
    Jan 13 '17 at 14:48
  • \$\begingroup\$ @flawr: In mine (Vivaldi on Windows) they look better: i.imgur.com/OIILDbB.png but not perfectly drawn; it is due to the chess Unicode characters. I am waiting for opinions on better characters, please. The queen card (D) seems a lot the King card! The Jack (V) doesn't even seem to be a Jack! And the King (R) also does not seem the King! \$\endgroup\$
    – sergiol
    Jan 13 '17 at 19:42

Left-to-Right calculator

Given the opinion I posted on https://ux.stackexchange.com/a/99984/51560 , I want to have a calculator where the least-significant least digits are placed on the left.

The input must come from stdin. It only needs to support non-negative integers. Additions must support any number of parcels, and to end the input of parcels input an empty line. In every example, all above the first ——— line is input, the first ——— line itself and the lines below are output.



Subtractions input is always composed by two operators:


Multiplications input is also two operands.Must support at multiplications where the second operator is < 100 and output the auxiliary addition like the way it is done by hand.


Contiguous Palindromic Subsequencing

Given a word a, perform the following operations:

  1. Group string into palindromic subsequences of length > 2 and non-palindromic subsequences. (You should prioritize partition length over partition index, for instance esse shouldn't result in ['e','ss','e'], it should be ['esse']. However, if the lengths are the same for two subsequences, use index to prioritize which you choose).
  2. Make all non-palindromic subsequences palindromic (single characters are palindromic here).
  3. Put it back together.

You may assume only printable ASCII characters are used.


raggamuffin -> ['r','agga','muffin'] -> ['r','agga','muffiniffum'] -> raggamuffiniffum

bananaracecar -> ['b','anana','racecar'] -> ['b','anana','racecar'] -> Unchanged.

(Since each palindrome grouping would be the same length, use the first one).
abaca -> ['aba', 'ca'] -> ['aba','cac'] -> abacac

(Always choose the bigger palindrome, THEN go by index)
cheesewheels -> ['che','ese','wh','ee','ls'] -> ['chehc','ese','whw','ee','lsl'] -> chehcesewhweelsl

(Always choose the bigger palindrome, THEN go by index)
1223224 -> [1,22322,4] -> Unchanged.

abbabbababbababba -> ['a', 'bb', 'abbababbababba'] -> Unchanged.

abcdefg -> ['abcdefg'] -> ['abcdefgfedcba'] -> abcdefgfedcba

slammedintoacardoor -> ['sla', 'mm', 'edinto', 'aca', 'rd', 'oo', 'r'] -> ['slals', 'mm', 'edintotnide', 'aca', 'rdr', 'oo', 'r'] -> slalsmmedeintotniacardroor

eeefffgegffhi -> ['eee','f','ffgegff','hi'] -> ['eee','f','ffgegff','hih'] -> eeefffgegffhih

This will be , lowest byte-count wins.

  • \$\begingroup\$ The term "subsequence" doesn't usually imply that they are contiguous. ac is a subsequence of abc. You should either use "substring" or "contiguous subsequence" to avoid confusion. \$\endgroup\$ Jan 13 '17 at 8:42
  • \$\begingroup\$ I can't tell whether this is covered by any of your test cases, but it's also not explicitly mentioned in the rules, what about a test case like abaca. Is it ab,aca or aba,ca, since the palindromes have the same length? What about abacada? aba,c,ada? ab,aca,da? \$\endgroup\$ Jan 13 '17 at 8:46
  • \$\begingroup\$ Also, string challenges should specify which characters can appear in the input. \$\endgroup\$ Jan 13 '17 at 8:46
  • \$\begingroup\$ In test case slammedintoacardoor, shouldn't ed and into be combined into one substring? \$\endgroup\$
    – Zgarb
    Jan 13 '17 at 12:09
  • \$\begingroup\$ @MartinEnder I worded it wrong, you should be prioritizing length of substring, THEN position. So it would be aba,ca. \$\endgroup\$ Jan 13 '17 at 14:43
  • \$\begingroup\$ @Zgarb yes, you're right. \$\endgroup\$ Jan 13 '17 at 14:43
  • \$\begingroup\$ @MartinEnder aba,c,ada because aba is before both aca and ada using index. Then ada and c are what would be prioritized to be grouped next. \$\endgroup\$ Jan 13 '17 at 15:49

1 line ASCII Domino play

The game is described on my own question I posted on Domino game maximum achievable points.

The rules for scoring are on the link, and I am reposting them here:

The rules for scoring are: every time a part is placed, if the sum of both ends of the dominoes chain is a multiple of 5, you add it to you current score.

example: [4|2] [2|1] makes 5 points

A double (every part where the two halfes are equal) is always placed rotated by 90º; so for accounting purposes, unlike other pieces, both sides ot the part are taken into account.


___       ___
|6|       |4|
——— [6|4] ———  
|6|       |4|
———       ———

makes for 20 points.

One single part placed accounts as the two tips.

Example [2|3] accounts as 5 points


———  accounts as 10 points.

The challenge is to write a game that is an ASCII one line domino game for me to play.


  • You must output to stderr/stdout
  • Line Width is 80 chars
  • The first two chars are reserved for displaying points, aligned at right. By definition, it will always be a multiple of 5; and the third is always a space
  • Given space is limited:

    • Every join of two parts will conjoin and they will be separed by a | they will share instead of ][
    • Double parts (those where the two halves are equal) will be represented abbreviate:

      • [ | ] => [ ]
      • [1|1] => [=]
      • [2|2] => [+]
      • [3|3] => [*]
      • [4|4] => [&]
      • [5|5] => [X]
      • [6|6] => [%]
    • Except for white double, all whites are represented by only the other half
    • Every other part is represented by [NM], where N and M are the number of each half
  • The ends of the whole dominoes chain are always terminated by []
  • The initial state is an empty table. First piece placed will be at the center
  • When chain begins to not fit, at one of the ends, it must be adjusted to fit by pushing the whole placing a little bit to the left or the right.
  • The last 3 chars of the line are reserved for user input. User can only input a piece not yet placed. User input is NM which is displayed; and a keypress of + or - which will NOT be displayed to avoid a newline feed. The key press tells what side of the chain will the new piece will be snapped:
    • - to left
    • + to right
    • It also must validate the snapping. If user snaps to a non-matching piece, just do nothing. The program will NOT be smart enough to make guesses; so it will NOT make a piece to snap on the other side if piece does not match user specified side
    • And after each valid placing of a piece, must update the points display if there are some to score.

Example of an INVALID placed chain, containing a sequence which would not be possible, because there are pieces snapped to not-matching pieces.

  5 [ |=|+|*|&|X|%|1|2|3|4|5|6|12|13|14|15|16|23|24|25|26|34|35|36|45|46|56] 12{+}

The {+} is not displayed, it is there just to illustrate the input:

  • 1
    \$\begingroup\$ I find this rather confusing. After reading it three times I think I begin to understand the spec, but 1. Why those random characters for the doubles? IMO !@#$%& would be preferable: it's easy to refer to for people with a US-layout keyboard, and it corresponds to the ASCII characters at an offset of 32 from the digits. 2. What's all that about ][? The question should be self-contained: don't confuse things by assuming that people have read another related question. 3. Following on from that, you should explain the scoring. \$\endgroup\$ Jan 13 '17 at 13:30
  • 2
    \$\begingroup\$ 4. Don't give an example of an invalid chain: the example which would be actually useful is a valid chain. 5. Doesn't the abbreviated form for 0s create ambiguities? If the board is currently [6] then which is valid out of 46-, 46+, 64-, 64+, 4-, 4+? 6. What's the initial state? Empty board, and either of - or + does the same thing? \$\endgroup\$ Jan 13 '17 at 13:31
  • \$\begingroup\$ @PeterTaylor: Those chars have been decided on the appearance they have. = seems [11] rotated vertically; + being a four-point star is the most similar I get to [22]; the same goes for * as it is a 6 point star; & seems an 8, which are the points of [44]; X is an way to say 10, which are the number points of a [55]; % seems to have a 10 and a 2 number implicit on it, as the slash and final ball seem a 10, and the existent balls are two, then twelve which are the points of [66]. \$\endgroup\$
    – sergiol
    Jan 14 '17 at 12:04
  • \$\begingroup\$ Given the space is limited, the joining of two pieces must conjoin, so ][ becomes | to save space. Example: [23][34] becomes [23|34] \$\endgroup\$
    – sergiol
    Jan 14 '17 at 12:09
  • \$\begingroup\$ Reproduced ipsis verbis from the link the rules for scoring. \$\endgroup\$
    – sergiol
    Jan 14 '17 at 13:29
  • \$\begingroup\$ @trichoplax: It is clearly stated: "User can only input a piece not yet placed". There are only 28 dominoes and the statement makes clear there are no repetitions. I am already getting issues trying to put the whole chain in only one line and you want to make the problem even worse?! \$\endgroup\$
    – sergiol
    Jan 14 '17 at 14:48
  • \$\begingroup\$ @PeterTaylor :Just made clear The initial state is an empty table \$\endgroup\$
    – sergiol
    Jan 14 '17 at 15:02
  • \$\begingroup\$ @trichoplax: I upvoted your comment: Is there a missing second half of sentence after "When chain begins to not fit"?.Sentence is now fixed! \$\endgroup\$
    – sergiol
    Jan 14 '17 at 15:03
  • \$\begingroup\$ My apologies for overlooking "User can only input a piece not yet placed". I've deleted both my comments now that they have been addressed. \$\endgroup\$
    – trichoplax
    Jan 14 '17 at 17:41
  • \$\begingroup\$ @trichoplax: I made now clear the program will not have any kind of "smartness". So if user specifies 64- and left side is not a 4, placing is simply rejected. \$\endgroup\$
    – sergiol
    Jan 14 '17 at 18:32

Graphical Borromean Rings

Here is an SVG rendering of the Borromean Rings:

<svg xmlns="http://www.w3.org/2000/svg" height="200" width="200">
    <radialGradient id="green">
      <stop stop-color="transparent" offset="70%"/>
      <stop stop-color="#0F0" offset="75%"/>
      <stop stop-color="#CFC" offset="85%"/>
      <stop stop-color="#0F0" offset="95%"/>
      <stop stop-color="transparent" offset="100%"/>
    <radialGradient id="blue">
      <stop stop-color="transparent" offset="70%"/>
      <stop stop-color="#00F" offset="75%"/>
      <stop stop-color="#CCF" offset="85%"/>
      <stop stop-color="#00F" offset="95%"/>
      <stop stop-color="transparent" offset="100%"/>
    <radialGradient id="red">
      <stop stop-color="transparent" offset="70%"/>
      <stop stop-color="#F00" offset="75%"/>
      <stop stop-color="#FCC" offset="85%"/>
      <stop stop-color="#F00" offset="95%"/>
      <stop stop-color="transparent" offset="100%"/>
    <mask height="100" width="100" y="0" x="0" id="back">
      <rect fill="#FFF" height="100" width="50" y="0" x="0"/>
      <rect fill="#FFF" height="50" width="50" y="25" x="50"/>
    <mask height="100" width="100" y="0" x="0" id="front">
      <rect fill="#FFF" height="25" width="50" y="0" x="50"/>
      <rect fill="#FFF" height="25" width="50" y="75" x="50"/>
  <circle mask="url(#back)" fill="url(#green)" r="50" cy="50" cx="50"/>
  <circle fill="url(#blue)" r="50" cy="93.3" cx="75"/>
  <circle fill="url(#red)" r="50" cy="50" cx="100"/>
  <circle mask="url(#front)" fill="url(#green)" r="50" cy="50" cx="50"/>

Please write a full program to generate a which resembles the above rendering reasonably well. In particular:

  • Solid colours, aliased pixels or overlap artefacts are not acceptable
  • Your colours should contrast with each other
  • Your circles must default to at least 100px in diameter (I wanted larger circles in my snippet but I get a scroll bar if I try)
  • Your circles must have the appearance of overlapping impossibly
  • Rotations and reflections are perfectly acceptable

Output is via any generally acceptable output format e.g. writing to vector or raster image format or displaying directly to the screen. This is , so the shortest program wins.

Related: ASCII Borromean Rings

  • \$\begingroup\$ Related. Related. \$\endgroup\$
    – DLosc
    Jan 19 '17 at 10:35
  • \$\begingroup\$ @DLosc Well, those are interlocking rings... Borromean rings don't interlock in pairs ;-) \$\endgroup\$
    – Neil
    Jan 19 '17 at 16:25

Number that includes the amount of digits of itself

Create a number where each digit represents the amount of this digit the number itself contains. Maybe my english is too bad to describe it clearly so here is an example:

6               -> this number contains 6 times '0'
 2              -> this number contains 2 times '1'
  1             -> this number contains 1 time  '2'
   0            -> this number contains 0 times '3'
    0           -> this number contains 0 times '4'
     0          -> this number contains 0 times '5'
      1         -> this number contains 1 time  '6'
       0        -> this number contains 0 times '7'
        0       -> this number contains 0 times '8'
         0      -> this number contains 0 times '9'

We will call those numbers self-describing. Each self-describing number must be 10 digits long to be able to represent all digits from 0 to 9.

I have two possible goals for this challenge:

  1. Create a program which prints out all self-describing numbers in the range 0000000000 < X < 99999999999
  2. For a given integer in the range 0000000000 < X < 99999999999 print out true if it's a self-describing number, else false.

I can add further examples and rules if i move it out of the sandbox.

  • \$\begingroup\$ @Fatalize Yes my bad i will search for a correct number \$\endgroup\$
    – izlin
    Jan 16 '17 at 15:52
  • 3
    \$\begingroup\$ "I can add further examples": no, you can't. That's the only one. If you want to get an interesting question out of this you're going to have to open it up to other bases. \$\endgroup\$ Jan 16 '17 at 17:11
  • \$\begingroup\$ Related. Also related. \$\endgroup\$
    – user62131
    Jan 18 '17 at 19:45

Digit stream with no 42

You should write a program or function which receives no input and outputs a stream of digits.

  • The stream should contain at least once every positive integer number which does not contain the digit sequence 42. E.g. The string 1231 contains the integers 1 12 123 1231 2 23 231 3 31 (and 1 again)

  • The stream should not contain the digit sequence 42.

  • If your interpreter can't handle infinite output gracefully you can add code to only print the first n digits. This added code does not count to your score.

  • Note that the stream 203204205... contains 42.

  • No randomness should be used.

This is code-golf so the shortest entry wins.

Do we have infinite output tag?

  • \$\begingroup\$ I think you need to say something about random numbers. Either require that the program always outputs the same stream or be very specific about requirements on the RNG for an answer which outputs random digits avoiding 2 when the previous one was a 4. \$\endgroup\$ Jan 18 '17 at 12:30
  • \$\begingroup\$ @PeterTaylor Right, forbidding randomness is probably the cleanest solution. Showing whether an RNG-using code solves the problem seems pretty complex. \$\endgroup\$
    – randomra
    Jan 18 '17 at 15:13
  • \$\begingroup\$ So a program that always prints 1234567890 will satisfy this, or am I missing something? \$\endgroup\$ Jan 18 '17 at 20:33
  • \$\begingroup\$ @carusocomputing The stream should contain every integer not just every digit. E.g. 1234567891011121314... fulfills this point. \$\endgroup\$
    – randomra
    Jan 18 '17 at 23:29

Where am I?

(Some other tags pls help)

Your task in this challenge is to output the location of the user. This may be done by means of GeoIP, a builtin GPS device, or any other means. Output should either be in the format (latitude, longitude) accurate to at least one degree, or (City, [optional state/province/etc], Country). Errors due to the GPS device being inaccurate or similar which are not the fault of your code are allowed. Fewest bytes wins.

  • \$\begingroup\$ Accurate to one degree? Holy hell, do you know how much one degree is? google.com/maps/dir/11.00000,+2.000000/10,1/… \$\endgroup\$ Jan 18 '17 at 20:09
  • \$\begingroup\$ Also, this is more or less "output the location of the users ISP"... \$\endgroup\$ Jan 18 '17 at 20:10
  • \$\begingroup\$ @carusocomputing one degree of Latitude/Longitude. That's just 11, 2. \$\endgroup\$
    – Pavel
    Jan 18 '17 at 20:16
  • \$\begingroup\$ I was just pointing out that if you look at 10,1 compared to 11,2 it's in a different country. If you say closest to the nearest degree the answers will not be constant. \$\endgroup\$ Jan 18 '17 at 20:31
  • \$\begingroup\$ @carusocomputing Oh, I misunderstood. I know 1 degree is a lot, but I think it's good enough. It requires actually finding the location rather than relying on other information, which is all that's really needed. This way could cut out some code necessary for formatting which isn't part of the challenge. \$\endgroup\$
    – Pavel
    Jan 18 '17 at 20:36
  • \$\begingroup\$ Ping the router. Ask the router where it is. Done. (No idea if this would work) \$\endgroup\$ Jan 22 '17 at 15:49

Do you accept me?


Being accepted is very important to people. But words are also people (right!?). So they also want to be accepted. However most people work non-deterministically and as such it's only fair to transfer that into our decision whether we accept a word. Of course, because a stupid human can't remember much the instructions to decide whether to accept a word must be short...


Your input will be

  • a list of non-negative integers - the "word" (this is easier than using strings and actual alphabets)
  • a list of triples of non-negative integers - the transitions, you may also use unordered data structures here
  • an integer - the starting state
  • a list of non-negative integers - the accepting states, you may also use unordered data structures here

You may use any other object or whatever than integers if it pleases you.


A truthy or a falsey value.

What to do?

Basically implement an NFA.
That is, read every single character (ie every number) from left to right and for each one of them look whether there exist a transition from your current state using this character. If so follow it and repeat the process for the next letter. If you face an empty list, your current state must be in the list of accepted states if it is output true and stop examining other paths if it isn't continue examining the other options. If you get stuck (ie the word isn't empty but there's no way to continue), output false.

Who wins?

This is so the shortest answer in bytes wins.


For the following examples I'm going to use this automaton: Example NFA

which has starting state 10, accepting states [13] and transitions


These three parameters are assumed to be also passed in the examples. Word examples for this automaton are:

[1,2,3,4] -> false
[4,1,3,4] -> false
[4,1,3] -> true
[4,1,3,3,3] -> true
[2,1,3,4,3,2] -> false
[4,1,4] -> false
[4,3,1] -> false
[4,3,3] -> true
  • \$\begingroup\$ I'm aware of this other challenge but truly believe that mine is different enough because a) it uses relations instead of a function b) it only asks for NFAs and not for three different automatons c) it asks for truthy / false instead of hard-coded strings d) it's not limited to strings e) it doesn't assume an implicit starting state. \$\endgroup\$
    – SEJPM
    Jan 19 '17 at 11:24

Simulate a vibrating string

Vibrations are an integral part of physics. In this challenge, you will be implementing a simulation of a vibrating string.

This is actually rather easy to do as a result of the Huygens–Fresnel principle, which allows us to use a simulation process similar to cellular automata.

(don't have time to write a full spec right now. Also, I have a 2D version working but figured 1D was enough for a challenge)

Below is an example of a string vibrating at its second harmonic, with each row being 1 tick of the simulation.

  1.00  2.00  1.00 -1.00 -2.00 -1.00
  0.95  1.90  0.95 -0.95 -1.90 -0.95
  0.85  1.70  0.85 -0.85 -1.70 -0.85
  0.71  1.42  0.71 -0.71 -1.42 -0.71
  0.54  1.07  0.54 -0.54 -1.07 -0.54
  0.33  0.67  0.33 -0.33 -0.67 -0.33
  0.11  0.23  0.11 -0.11 -0.23 -0.11
 -0.11 -0.22 -0.11  0.11  0.22  0.11
 -0.33 -0.66 -0.33  0.33  0.66  0.33
 -0.53 -1.07 -0.53  0.53  1.07  0.53
 -0.71 -1.42 -0.71  0.71  1.42  0.71
 -0.85 -1.70 -0.85  0.85  1.70  0.85
 -0.95 -1.90 -0.95  0.95  1.90  0.95
 -1.00 -2.00 -1.00  1.00  2.00  1.00

This challenge is based off the math found on this website.


Task Scheduling

Given as input:

  • A unix time at which to first run the program
  • Delay between runs (can be 0)
  • Number of times to run the program (-1 if infinite)
  • A program to be run through the console when triggered

Run the program under specified conditions.

  • You can assume your program will always be running
  • Run the equivalent of nohup <command> &.
  • \$\begingroup\$ What happens if the unix time is before now? What is the delay measured in? What should I do if the delay is 0? What do you mean by "You can assume your program is always running?" Isn't the ability to keep my program running up to my program?. nohup is not a command I'm familiar with, so I'd definitely explain that. \$\endgroup\$ Jan 20 '17 at 17:05
  • \$\begingroup\$ @NathanMerrill 1. undefined behavor, ie do whatever you want 2. seconds 3. undefined behavior 4. if you want to 5. it isn't? \$\endgroup\$ Jan 20 '17 at 18:17
  • \$\begingroup\$ All of that needs to be in the in the post. \$\endgroup\$ Jan 20 '17 at 18:19

The many names of Túrin

Tolkien's character Túrin had a multiple personality disorder and consequently needed to change name on a regular basis to be called by something fitting its current mood. He has been known as Turambar, Mormegil, Gorthol, Adanedhel, Dagnir Glaurunga, the Wildman of the Woods, Neithan and some other unofficial nicknames alluding to his tenderness for his sister.

This must have been a real headache for the author: not only had he to find the new names but he also had to remember the translation in English1, since every new name is introduced along the lines of "From this day he was known as [Compound_Elvish_word], that is [Word of word]"

Your task is to automatize the production of epithets to help Tolkien finish his Unfinished Tales.

Given a list of Sindarin2 substantives and their English translations (see list below) as an external file, a list or any reasonable format, randomly take two Sindarin substantives (repetition is possible) and print "From this day he was known as Sindarin1sindarin2, that is English2 of English1"

(Note the inversion of words in the translation, and the capitalisation)

Input: none

Output: A string

The list: (names can be capitalized in your own list, but the formatting must be consistent. The order of the couples can also be changed)

Sindarin    English
amarth      fate
ang         iron
aur         morning
brethil     birch
carch       fang
celeb       silver
draug       wolf
galad       glittering
glor        light
gwathel     sister
manadh      doom
megil       sword
melethron   lover
mor         darkness
naur        flame
taur        forest


  • From this day he was known as Galadaur, that is Morning of Glittering
  • From this day he was known as Mormelethron, that is Lover of Darkness
  • From this day he was known as Draugdraug, that is Wolf of Wolf

Hobbits played golf and Codë was the Vala of challenges in the Silmarillion, so this is .

1 Sorry, Tolkien specialists, I'm probably massacring Quenya, Sindarin and many other concepts

2 I think

  • \$\begingroup\$ Children do visit this website, so if you consider something unsuitable for them, do not mention it at all, even to hint at avoiding mentioning it. \$\endgroup\$
    – trichoplax
    Jan 20 '17 at 15:32
  • \$\begingroup\$ Changed as asked, the example as well. \$\endgroup\$
    – drolex
    Jan 20 '17 at 15:48
  • \$\begingroup\$ 1. Substantives are far more commonly called nouns in English. 2. This would be a more interesting challenge if the word list had a lot of common substrings to exploit for compression. Maybe it would work better with a fictional language rather than Sindarin? \$\endgroup\$ Jan 20 '17 at 22:32

Minimum exchange of bills

You're at the supermarket, buying groceries for the week. At the end, the cashier rings up your cart and declares that your total cost is exactly $76. You reach into your wallet, and find a $50, four $20s, and a $1, for a total of six bills.

We consider a transaction to be you paying money to the cashier, and the cashier giving you your change (if applicable). Your total for a transaction is the net amount of money you owe the cashier, which is calculated by the amount you pay less the amount of change you get. We can think of a transaction as adding the bills you pay to the cashier, and subtracting the bills you get in return. Thus, the following is a non-exhaustive list of possible transactions in this scenario:

$50 + $20 + $20 - $10 - $1 - $1 - $1 - $1 (8 bills)
$20 + $20 + $20 + $20 - $1 - $1 - $1 - $1 (8 bills)
$20 + $20 + $20 + $20 + $1 - $5           (6 bills)
$50 + $20 + $20 + $1 - $10 - $5           (6 bills)

Given a total of $76, and having 1 $50, 4 $20s, and 1 $1, the minimum exchange of bills comes out to 6 bills.


Given an integer Bill and a list of bills in your wallet [Ones Fives Tens Twenties Fifties Hundreds], calculate the number of bills in a minimum exchange of bills between you and the cashier.


  1. Your program can accept your input in any reasonable way. You can accept an integer followed by a list of six integers separated by reasonable means. You can accept seven integers separated by any reasonable means. If your language cannot accept input in any reasonable form, you may, at no penalty, hardcode the input into your program. You may only hardcode input if your language cannot reasonably accept meaningful input.
  2. Your program must output the number of bills in the minimum exchange transaction. Your program may not print any of the possible transactions themselves.
  3. You may assume that you will always have enough money to cover your bill, possibly requiring some change from the cashier.
  4. You may assume that the cashier has an unlimited number of all bills at their disposal.
  5. You may assume that all inputs are non-negative integers. It is possible that your bill comes out to $0. No integer input will ever be greater than 1000. That's too many bills and quite frankly, too many groceries.
  6. This is , so fewest bytes wins.

Test cases

Input                        Output
[76,1,0,0,4,1,0]              6

I'll come up with and post some more test cases if people think this is a good challenge.

Possible bonus challenge:

In the United States, a $2 is a rare, but legal, bill issued by the treasury. If you wish, you can have your program accept another integer, between the number of Ones and Fives, representing the number of $2-bills you have in your wallet, which you can use to pay for your groceries. However, since such bills are so uncommon, the cashier will not have any on-hand to give to you as change.

  • \$\begingroup\$ Never allow arbitrary separators in the input, at least without some length limit; some languages may be able to slip the entire program in there. The easiest method is normally to say that the program takes a list of integers as input via any reasonable means; we have various rulings on Meta about which means are reasonable, and that saves you having to duplicate it in your challenge. I'd recommend against the bonus challenge, by the way; it just makes entries harder to compare. \$\endgroup\$
    – user62131
    Jan 20 '17 at 17:24
  • \$\begingroup\$ Essentially the making change problem ( codegolf.stackexchange.com/q/70847/194 and probably others) but adding negative value coins (bills). There's a risk it will be closed as dupe; it's borderline enough that I wouldn't cast a supervote. One thing I will suggest, as I have in the past on this type of question, is making the coin (bill) system be input rather than hard-coded. That way you can forget about the bonus challenge and the question feels a bit less culture-specific. \$\endgroup\$ Jan 20 '17 at 22:26
  • \$\begingroup\$ I vote no on $2 bills, that sounds like it doesn't add much. \$\endgroup\$ Jan 23 '17 at 19:39


The purpose of this challenge is to emulate the functionality of the loripsum.net website. This website takes in a "number of paragraphs" and a list of randomized HTML5 stylizations and outputs a pre-formatted HTML5 lorem ipsum text that is REALLY good for placeholders on a prototype website. Your code, however, will focus more on the stylization aspect of this website.

Given a block of lorem ipsum text in the following format:

<segment> := <paragraph> | <paragraph><new-line><segment>

<paragraph> := <sentence> | <sentence><paragraph>

<sentence> := <character_run><sentence_end>

<character_run> := <printable_ascii_without_newline_or_period>|<pawnop><character_run>

<sentence_end> := \n | . | ? | !

Here's an example of a possible input:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quonam, inquit, modo? Progredientibus autem aetatibus sensim tardeve potius quasi nosmet ipsos cognoscimus. Quod non faceret, si in voluptate summum bonum poneret. Duo Reges: constructio interrete.

Tubulo putas dicere? Cum salvum esse flentes sui respondissent, rogavit essentne fusi hostes. Dat enim intervalla et relaxat. Satisne ergo pudori consulat, si quis sine teste libidini pareat? Negare non possum. An hoc usque quaque, aliter in vita? Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Quid ei reliquisti, nisi te, quoquo modo loqueretur, intellegere, quid diceret?

Itaque ad tempus ad Pisonem omnes. Universa enim illorum ratione cum tota vestra confligendum puto. Haec dicuntur inconstantissime. Dicimus aliquem hilare vivere; Qui non moveatur et offensione turpitudinis et comprobatione honestatis? Sed quot homines, tot sententiae; Quippe: habes enim a rhetoribus; Omnes enim iucundum motum, quo sensus hilaretur. Tria genera bonorum; Profectus in exilium Tubulus statim nec respondere ausus;

Certe non potest. Dempta enim aeternitate nihilo beatior Iuppiter quam Epicurus; Graece donan, Latine voluptatem vocant. Itaque a sapientia praecipitur se ipsam, si usus sit, sapiens ut relinquat. Quid est igitur, inquit, quod requiras? Atque haec coniunctio confusioque virtutum tamen a philosophis ratione quadam distinguitur. Ego vero volo in virtute vim esse quam maximam;

Verum hoc idem saepe faciamus. Huic mori optimum esse propter desperationem sapientiae, illi propter spem vivere. Si enim ita est, vide ne facinus facias, cum mori suadeas. Indicant pueri, in quibus ut in speculis natura cernitur. Apparet statim, quae sint officia, quae actiones. An est aliquid per se ipsum flagitiosum, etiamsi nulla comitetur infamia? Non autem hoc: igitur ne illud quidem. Res enim se praeclare habebat, et quidem in utraque parte.

Your task, given the input t from above, is to apply one formatting operations at random once per paragraph, defined by the following list of operations:

  • Character Run Operations (Should be performed on 1-5 word runs chosen at random. This should NEVER cross sentence boundaries (\n|.|?|!))
    • Bold <b></b>
    • Italic <i></i>
    • Underline <u></u>
  • Sentence Operations (Should be performed on 1-2 sentences in the paragraph)
    • Block Quote <blockquote></blockquote>
    • Preface <pre></pre>
    • Heading <h1></h1> ... <h6></h6> (Chosen at random)
  • Paragraph Operations (Should turn entire paragraph into this format, separated by sentences if the operation is segmented (like a list)).
    • Unordered List <ul><li>Sentence 1</li>...<li>Sentence n</li></ul>
    • Ordered List <ol><li>Sentence 1</li>...<li>Sentence n</li></ol>

So, here is one possible random output:

[1:HEADING(h1 chosen),2:BOLD(4 times),3:PREFACE(1 sentence),4:UNORDERED-LIST,5:BLOCKQUOTE(2 sentences)]

Applied to the input from above (t):

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Quonam, inquit, modo? Progredientibus autem aetatibus sensim tardeve potius quasi nosmet ipsos cognoscimus. Quod non faceret, si in voluptate summum bonum poneret. Duo Reges: constructio interrete.

Tubulo putas dicere? Cum salvum esse flentes sui respondissent, rogavit essentne fusi hostes. Dat enim intervalla et relaxat. Satisne ergo pudori consulat, si quis sine teste libidini pareat? Negare non possum. An hoc usque quaque, aliter in vita? Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Quid ei reliquisti, nisi te, quoquo modo loqueretur, intellegere, quid diceret?

Itaque ad tempus ad Pisonem omnes. Universa enim illorum ratione cum tota vestra confligendum puto. Haec dicuntur inconstantissime. Dicimus aliquem hilare vivere; Qui non moveatur et offensione turpitudinis et comprobatione honestatis?

Sed quot homines, tot sententiae;
Quippe: habes enim a rhetoribus; Omnes enim iucundum motum, quo sensus
Tria genera bonorum; Profectus in exilium Tubulus statim nec respondere ausus;

  • Certe non potest.
  • Dempta enim aeternitate nihilo beatior Iuppiter quam Epicurus; Graece donan, Latine voluptatem vocant.
  • Itaque a sapientia praecipitur se ipsam, si usus sit, sapiens ut relinquat.
  • Quid est igitur, inquit, quod requiras? Atque haec coniunctio confusioque virtutum tamen a philosophis ratione quadam distinguitur.
  • Ego vero volo in virtute vim esse quam maximam;

Verum hoc idem saepe faciamus. Huic mori optimum esse propter desperationem sapientiae, illi propter spem vivere.
Si enim ita est, vide ne facinus facias, cum mori suadeas. Indicant pueri, in quibus ut in speculis natura cernitur. Apparet statim, quae sint officia, quae actiones. An est aliquid per se ipsum flagitiosum, etiamsi nulla comitetur infamia? Non autem hoc: igitur ne illud quidem. Res enim se praeclare habebat, et quidem in utraque parte.

Wow! Isn't that much prettier? Here's the code view:

<h1>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</h1> Quonam, inquit, modo? Progredientibus autem aetatibus sensim tardeve potius quasi nosmet ipsos cognoscimus. Quod non faceret, si in voluptate summum bonum poneret. Duo Reges: constructio interrete.

Tubulo <b>putas dicere</b>? Cum salvum esse flentes sui respondissent, rogavit <b>essentne fusi</b> hostes. Dat enim intervalla et relaxat. <b>Satisne ergo pudori consulat, si quis sine</b> teste libidini pareat? Negare non possum. An hoc usque quaque, aliter in <b>vita</b>? Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Quid ei reliquisti, nisi te, quoquo modo loqueretur, intellegere, quid diceret?

Itaque ad tempus ad Pisonem omnes. Universa enim illorum ratione cum tota vestra confligendum puto. Haec dicuntur inconstantissime. Dicimus aliquem hilare vivere; Qui non moveatur et offensione turpitudinis et comprobatione honestatis? <pre>Sed quot homines, tot sententiae; Quippe: habes enim a rhetoribus; Omnes enim iucundum motum, quo sensus hilaretur.</pre> Tria genera bonorum; Profectus in exilium Tubulus statim nec respondere ausus;

<ul><li>Certe non potest.</li><li>Dempta enim aeternitate nihilo beatior Iuppiter quam Epicurus; Graece donan, Latine voluptatem vocant.</li><li>Itaque a sapientia praecipitur se ipsam, si usus sit, sapiens ut relinquat.</li><li>Quid est igitur, inquit, quod requiras? Atque haec coniunctio confusioque virtutum tamen a philosophis ratione quadam distinguitur.</li><li>Ego vero volo in virtute vim esse quam maximam;</li></ul>

<blockquote>Verum hoc idem saepe faciamus. Huic mori optimum esse propter desperationem sapientiae, illi propter spem vivere.</blockquote>Si enim ita est, vide ne facinus facias, cum mori suadeas. Indicant pueri, in quibus ut in speculis natura cernitur. Apparet statim, quae sint officia, quae actiones. An est aliquid per se ipsum flagitiosum, etiamsi nulla comitetur infamia? Non autem hoc: igitur ne illud quidem. Res enim se praeclare habebat, et quidem in utraque parte.

Take note specifically of how I split the sentences on the paragraph operators, you delimit by ONLY periods and NEWLINES, nothing else ends a sentence. Also, make not of how the character run operators can span multiple words, BUT NOT MULTIPLE SENTENCES, you must stop before the next sentence begins (EXCLUDING THE ENDING NEWLINE OR PERIOD). As in, it's only applicable to the <character_run> language definition.

This is lowest byte-count will be declared the winner.

  • \$\begingroup\$ I think you're missing ; from <sentence_end>. I also don't see any sentences ending in \n, but perhaps you were referring to the end of a paragraph? Also, I think the <paragraph> rule should be <sentence> | <sentence><paragraph>. \$\endgroup\$ Jan 20 '17 at 2:27
  • \$\begingroup\$ @ETHproductions that sentence doesn't end due to the ;, rather it ends due to the newline. \$\endgroup\$ Jan 20 '17 at 18:20
  • \$\begingroup\$ Coulda sworn at least one person would like this haha. \$\endgroup\$ Jan 26 '17 at 14:55
  • \$\begingroup\$ Are you sure about character runs including any ASCII char except newline or period? I would restrict it to [A-Za-z ], at least for the most part. \$\endgroup\$ Jan 26 '17 at 16:41
76 77
79 80

You must log in to answer this question.

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