573
\$\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\$
2
  • \$\begingroup\$ What if I posted on the sandbox a long time ago and get no response? \$\endgroup\$
    – None1
    Commented May 15 at 14:05
  • \$\begingroup\$ @None1 If you don't get feedback for a while you can ask in the nineteenth byte \$\endgroup\$
    – mousetail
    Commented May 29 at 13:27

4761 Answers 4761

-3
\$\begingroup\$

Open the browser, polyglot edition.

Your job is to open a browser window of the default browser to https://codegolf.stackexchange.com in as many languages as possible.

Your code must open the browser itself, and cannot rely on an open one.

Rules

  • Versions of the same language are considered a single language
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Define "default browser" in the context of non-Windows OSes. \$\endgroup\$ Commented Sep 25, 2016 at 21:47
  • 3
    \$\begingroup\$ @PeterTaylor Whatever browser the open command works with. There was a previous version of this challenge, it worked then. \$\endgroup\$ Commented Sep 25, 2016 at 22:24
-3
\$\begingroup\$

Mad lads!

Inspired by the paper calculator episode of Numberphile.

Your challenge in this puzzle is to take in two two-bit (0-3) numbers and output the sum of the two numbers... using ordinary household objects.

Some possibilities of how this can be done:
Dominoes
Paper
Marbles
music box (+ some helpers..)

Input:

input must always be involving two sets of two-bit integers, which can be represented by anything you like, so long as the cardinality of the representations is the same.

Output:

The output should be a single 3-bit integer which represents the addition of the two inputs.

Rules:

  • your device cannot have the capability to connect to the internet in any way (sorry, this also disqualifies carrier pigeons). Your device must also not be able to perform this function alone (eg a calculator).
  • It must be somewhat original. put your own twist on it!
  • though, your entry can be alive (does your dog add??), so long as your entry is not in discomfort.
  • Pictures are required for each entry to show how it works. videos would be better, but aren't required!
  • The sole function of your machine does not have to be adding, it can do other things as well. This means that older projects that may serve a slightly different function are welcome, so long as they meet the rules stated above.
  • Your device can be as simple or as complex as you like, so long as it doesn't get to a point where it's completely esoteric.

Judging:

You will be judged based on ease of use, ease of understanding, as well as originality! This means that entries should be easily explained, used, and be unique in some way.

This is a , so the most upvotes wins! good luck!

\$\endgroup\$
7
  • 2
    \$\begingroup\$ In my opinion, this is not a programming challenge. Once we start leaving the realm of a computer-based programming paradigm, a challenge becomes more difficult to test, replicate, and verify. Plus, something done with Dominoes, for example, may not "run" to completion 100% of the time, and in my opinion that makes it non-deterministic. \$\endgroup\$
    – mbomb007
    Commented Sep 26, 2016 at 18:43
  • \$\begingroup\$ Related meta: meta.codegolf.stackexchange.com/a/10151/34718. TLDR, if you want to program with dominoes, find or create a domino simulator where programs can be scored in bytes. Instead of marbles, use Marbelous. \$\endgroup\$
    – mbomb007
    Commented Sep 26, 2016 at 18:52
  • \$\begingroup\$ @mbomb007 what about papers, and counting dogs? This isn't a code golf, it's a popularity contest \$\endgroup\$
    – user56309
    Commented Sep 26, 2016 at 19:20
  • 2
    \$\begingroup\$ Popcons still require the use of programming languages. meta.codegolf.stackexchange.com/q/2028/34718. See both linked meta questions. What you are trying to do is off-topic for this site. \$\endgroup\$
    – mbomb007
    Commented Sep 26, 2016 at 19:42
  • \$\begingroup\$ @mbomb007 I'm not sure you linked the correct thing. I have found no reference of popularity contests in your recent link.. \$\endgroup\$
    – user56309
    Commented Sep 26, 2016 at 19:44
  • \$\begingroup\$ Rules and meta consensus apply to all challenges, not just code-golf. \$\endgroup\$
    – mbomb007
    Commented Sep 26, 2016 at 20:21
  • \$\begingroup\$ Popcons should be held to a higher standard than other questions, not a lower one as your comments imply. \$\endgroup\$ Commented Sep 27, 2016 at 7:33
-3
\$\begingroup\$

99 selttob fo reeb no eht llaw

I teb ev'uoy lla draeh tuoba eht doog 'lo 99 selttob fo reeb no eht llaw. Llew ti os sneppah taht I emoc morf na evitanretla esrevinu - eht esrevinu erehw ew etirw gnihtyreve ni esrever! Ew peek eht snoitisop fo lanigiro hguoht. Siht osla snaem reporp noitazilatipac fo tsrif (ekil rettel ni siht txet). Ruoy egnellahc si ot etirw a margorp taht stuptuo eht lausu 99 selttob fo reeb no eht llaw, tub ni esrever (ni ruo egaugnal uoy dluow llac ti 99 bottles of beer on the wall). Siht si a ytiralupop tsetnoc, os teg evitaerc dna yrt ot sserpmi eht dworc. Doog kcul!

I bet you've all heard about the good ol' 99 bottles of beer on the wall. Well it so happens that I come from an alternative universe - the universe where we write everything in reverse! We keep the positions of original though. This also means proper capitalization of first letter(like in this text). Your challenge is to write a program that outputs the usual 99 bottles of beer on the wall, but in reverse (in our language you would call it 99 selttob fo reeb no eht llaw). This is a popularity contest, so get creative and try to impress the crowd. Good luck!

Elpmas fo derised tuptuo:

Sample of desired output:


99 selttob fo reeb no eht llaw, 99 selttob fo reeb. Ekat eno nwod dna ssap ti dnuora, 89 selttob fo reeb no eht llaw.

89 selttob fo reeb no eht llaw, 89 selttob fo reeb. Ekat eno nwod dna ssap ti dnuora, 79 selttob fo reeb no eht llaw.

...

1 elttob fo reeb no eht llaw, 1 elttob fo reeb. Ekat eno nwod dna ssap ti dnuora, on erom selttob fo reeb no eht llaw.

On erom selttob fo reeb no eht llaw, on erom selttob fo reeb. Og ot eht erots dna yub emos erom, 99 selttob fo reeb no eht llaw.

\$\endgroup\$
8
  • 3
    \$\begingroup\$ There's no need for the reversed text in the description - it distracts the viewer from the challenge at hand. \$\endgroup\$
    – clismique
    Commented Oct 21, 2016 at 12:06
  • \$\begingroup\$ @Qwerp-Derp I wanted to make this a bit more "unique" and "immersing", so I thought about giving the reversed description(I like it). I also included original text(although in spoilers), but I was also wondering about distracting readers. Do you have some other idea on how to keep both versions without making it look obscure? \$\endgroup\$ Commented Oct 21, 2016 at 12:10
  • 2
    \$\begingroup\$ 1. This should not be a popularity-contest. 2. It's fundamentally a duplicate of codegolf.stackexchange.com/q/64198/194 . 3. If you're going to muck around with the question text, write a program that mucks it around correctly. "elpmaS" doesn't follow the specified transformation rule. \$\endgroup\$ Commented Oct 21, 2016 at 12:34
  • \$\begingroup\$ @PeterTaylor 1. why not? 2. It's not. You can't simply reverse, and counting is a bit different. \$\endgroup\$ Commented Oct 21, 2016 at 13:24
  • 2
    \$\begingroup\$ Do X creatively popularity contests have fallen out of scope. This will get closed if posted on main. \$\endgroup\$
    – Dennis
    Commented Oct 21, 2016 at 13:46
  • \$\begingroup\$ @Dennis Damn, too bad. I guess I won't be posting it then, it's boring "shortest code". \$\endgroup\$ Commented Oct 21, 2016 at 14:16
  • 2
    \$\begingroup\$ What does this add to the original '99 bottles of beer on the wall'? \$\endgroup\$
    – 0WJYxW9FMN
    Commented Oct 21, 2016 at 20:54
  • \$\begingroup\$ This sandbox post has had little activity in a while and little positive reception from the community. Please improve / edit it or delete it to help us clean up the sandbox. \$\endgroup\$
    – user58826
    Commented Jun 9, 2017 at 14:08
-3
\$\begingroup\$

Best n out of 2n - 1

Challenge:

This one should be relatively simple. Output this exact text:

Best [n] out of [2n - 1].

given n as an input.

Input:

Just the integer n, can be from stdin or as an argument. n will always be greater than 0.

Output:

The exact text above. Trailing spaces/newlines are allowed.

Rules:

This is , so shortest code in bytes wins. Standard loopholes are forbidden.

Meta:

Is this too simple? What other tags should be included, ?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Seems like a dupe of 2spooky4me, just with a different operator. \$\endgroup\$
    – Geobits
    Commented Nov 1, 2016 at 17:52
  • 1
    \$\begingroup\$ Your wording specifies "this exact text" while I think your intent is "Best 5 out of 9." or the like. \$\endgroup\$ Commented Nov 1, 2016 at 17:53
  • \$\begingroup\$ @Geobits Aha, I knew I remembered a similar challenge. Just forgot the exact name, so I thought maybe I was just imagining things after I tried to find it. My bad. \$\endgroup\$
    – Yodle
    Commented Nov 1, 2016 at 17:55
-3
\$\begingroup\$

Google Home / Amazon Echo - Turing complete?

Your challenge is to try to make a turing machine based on Google Home and Amazon Echo, see this video.

You must describe how to set up the machine, and how to give it input.

You must also describe a program for integer addition. It should compute 1+1 to be 2, 200+55 = 255, 200+56 = 0, and so on for all other combinations of 2 8-bit integers.

\$\endgroup\$
11
  • \$\begingroup\$ It's basically not possible... \$\endgroup\$ Commented Dec 2, 2016 at 19:52
  • \$\begingroup\$ VTC as unclear and too broad. What are you even expecting as an answer? \$\endgroup\$
    – Riker
    Commented Dec 2, 2016 at 19:52
  • \$\begingroup\$ @EasterlyIrk A set of commands that send the 2 computers into infinite loop, reading commands endlessly from a list of commands for the other to run, eventually processing a computer program and finally calculating the answer to the universe. \$\endgroup\$
    – SoniEx2
    Commented Dec 2, 2016 at 20:14
  • \$\begingroup\$ @TùxCräftîñg Why not? I mean other than that we have yet to prove their turing-completeness. \$\endgroup\$
    – SoniEx2
    Commented Dec 2, 2016 at 20:14
  • \$\begingroup\$ @SoniEx2 so only 1 of each computer? And what defines a command? \$\endgroup\$
    – Riker
    Commented Dec 2, 2016 at 20:16
  • \$\begingroup\$ @EasterlyIrk A command is anything that starts with "Hey google" or "Alexa" and triggers a successful response on either of the computers. \$\endgroup\$
    – SoniEx2
    Commented Dec 2, 2016 at 20:19
  • \$\begingroup\$ Are we allowed to program the Echo and Google device? If so this is trivial. If we're supposed to construct a sentence that winds up having the devices compute using existing services like the calendar in the video, there are plenty of web sites that can process a variety of languages and read back the solution. Echo has basic math built in. \$\endgroup\$ Commented Dec 2, 2016 at 21:09
  • \$\begingroup\$ I really hope this can be tweaked into a challenge because the youtubes would be awesome. \$\endgroup\$ Commented Dec 2, 2016 at 21:12
  • \$\begingroup\$ @wyldstallyns tbh I have no idea what I'm doing... But yes, you're allowed to program both of them. \$\endgroup\$
    – SoniEx2
    Commented Dec 2, 2016 at 22:51
  • \$\begingroup\$ A question should ideally be self-contained. In this case the APIs for Google Home (whatever that is) and Amazon Echo (whatever that is) probably won't fit in the question, but an overview and links to the APIs would. \$\endgroup\$ Commented Dec 2, 2016 at 23:03
  • \$\begingroup\$ @PeterTaylor This isn't a matter of APIs. This is a matter of voice commands. \$\endgroup\$
    – SoniEx2
    Commented Dec 3, 2016 at 0:19
-3
\$\begingroup\$

Make a Simple GUI application

I have made a simple glade layout. The chalenge is to remake it in as few bytes as possible.

The glade file:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
  <requires lib="gtk+" version="3.20"/>
  <object class="GtkApplicationWindow">
    <property name="can_focus">False</property>
    <property name="title" translatable="yes">Remake me!</property>
    <child>
      <object class="GtkBox">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="orientation">vertical</property>
        <child>
          <object class="GtkButton">
            <property name="label" translatable="yes">hello</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkLabel">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="label" translatable="yes">world</property>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">1</property>
          </packing>
        </child>
      </object>
    </child>
    <child>
      <placeholder/>
    </child>
  </object>
</interface>

\$\endgroup\$
1
  • \$\begingroup\$ This probably doesn't break any rules, but it also doesn't seem that fun. It would be preferable if it was a more substantial task than simply golfing the code you already wrote. \$\endgroup\$
    – Wheat Wizard Mod
    Commented Feb 18, 2017 at 2:09
-3
\$\begingroup\$

Rock Paper Scissors Lizard Spock

This game is from The Big Bang Theory, an extended version of the classic Rock Paper Scissors game.

Objective

To create a full program that I can run to play Rock Paper Scissors Lizard Spock against an "AI". The opponent ("AI") will pseudo-randomly choose their option after receiving user input.

The program must be run with user input of the following;

| Input     | Meaning   |
|-------    |---------- |
| R         | Rock      |
| P         | Paper     |
| S         | Scissors  |
| L         | Lizard    |
| SP        | Spock     |

The game is played with the following rules that Sheldon tells us;

Scissors cuts Paper

Paper covers Rock

Rock crushes Lizard

Lizard poisons Spock

Spock smashes Scissors

Scissors decapitates Lizard

Lizard eats Paper

Paper disproves Spock

Spock vaporises Rock

Rock crushes Scissors

enter image description here

Once you've taken user input, psuedo-randomly chosen the AIs option, you must output either "Player wins (<<user_input>> vs <<ai_input>>)" or "AI wins (<<user_input>> vs <<ai_input>>)". In the event of a tie (both the user and AI choose the same options), you must output "It's a tie"

Sample Runs

//Player chooses Scissors (S)
//AI chooses Paper (P)
$ php -f rpslsp.php S
Player wins (S vs P)

//Player chooses Spock (SP)
//AI chooses (R)
$ php -f rsplsp.php SP
Player wins (SP vs R)

//Player chooses Lizard (L)
//AI chooses Scissors (S)
$ php -f rsplsp.php L
AI wins (L vs S)

//Player chooses Lizard (L)
//AI chooses Lizard (L)
$ php -f rsplsp.php L
It's a tie

Rules

  • Standard loopholes apply.
  • The computer must choose an input at random (pseudo random) so that on each program run, the AI chooses (in a perfect world) a different input and that each input has the same percentage of being chosen.

This is code-golf so the shortest code in bytes wins.

\$\endgroup\$
5
  • \$\begingroup\$ "A full program" means that we're not allowed to return the result from a function? Must it be a full program?? \$\endgroup\$
    – Mr. Xcoder
    Commented Mar 13, 2017 at 12:55
  • \$\begingroup\$ @Mr.Xcoder What I mean is we are able to run it in environments like TIO or REPL.it \$\endgroup\$
    – ʰᵈˑ
    Commented Mar 13, 2017 at 13:01
  • \$\begingroup\$ 1. It's not true that the game is from BBT. BBT made a cultural reference to a preexisting game. 2. The output spec is incomplete because it doesn't say what to do in the case of ties. \$\endgroup\$ Commented Mar 13, 2017 at 14:32
  • \$\begingroup\$ @PeterTaylor Ah, I've only known the game exists because of TBBT, though the origin of the game doesn't really affect anything except maybe tread on the toes of some serious competitive RSPLSP players. Thanks for reminding me about it being a tie. \$\endgroup\$
    – ʰᵈˑ
    Commented Mar 13, 2017 at 14:36
  • \$\begingroup\$ Closely related. Less closely related. \$\endgroup\$
    – DLosc
    Commented Mar 17, 2017 at 19:42
-3
\$\begingroup\$

Fastest Compiling Fibonacci Sequence

Your task is to create a program which takes one numerical input and outputs all numbers in the Fibonacci sequence up to that point. However, you will not be scored on its bytecount or how many upvotes it gets. You will be scored on how quickly the compiler can compile it.


Rules

  • Of course, compiled languages are the only languages allowed.
  • All answers are tested on an Amazon EC2 instance with an Intel Xeon at 2.4GHz, about 1 GB of ram, and Amazon Linux installed. You can time your program on an equivalent machine, but I will compare results.
  • Your program is allowed to produce warnings when compiled, but it should work properly when run.
  • Compile time is tested with the time command, and "real" time is used for the final score.
  • If I need to comment the amount of time you took, you should add it to your answer.
  • Of course, standard loopholes are strictly disallowed.

This is , so may the cleverest optimization win and the best programmer prosper...

\$\endgroup\$
4
  • 1
    \$\begingroup\$ For a trivial challenge like this the compilation time is going to be dominated by noise: whether the compiler is in the disk cache is going to be more important than the code submitted. \$\endgroup\$ Commented Aug 14, 2017 at 8:05
  • \$\begingroup\$ To make compile times longer, you could require for the compiled program to work in O(1), or constant time. Then, the compiler will have to hardcode the entire sequence (up to a point specified by you, e.g. the largest 32- or 64-bit Fibonnaci number), which could make for interesting template-based programming optimization. \$\endgroup\$
    – Sanchises
    Commented Aug 14, 2017 at 10:41
  • \$\begingroup\$ @Sanchises, not true. Binet's formula will do the job in O(1). \$\endgroup\$ Commented Aug 14, 2017 at 11:08
  • \$\begingroup\$ @PeterTaylor of course. So, another sequence which is proven not to have a direct formula could make this challenge possibly salveagable. \$\endgroup\$
    – Sanchises
    Commented Aug 14, 2017 at 11:11
-3
\$\begingroup\$

Be typically flexible efficiently

Write a short function that returns outputs of different types in a non-boring way. If L is the length of your code and T is the number of different types returned, your score is (T−1)/L. The highest score wins.

  • The function must take exactly one argument and be deterministic, i.e., the output depends only on the input.

  • Obviously your programming language must have an official notion of type, by which each object has a unique, clearly identified type. Typically this would manifest in a type or typeof function returning an object’s type. Also, it must obviously allow functions to have differently typed returns.
    If there are many separate typing systems in your language, you have to pick one (conforming with the above) and stick to it.

  • The function must not employ any conditional constructs or other language features whose primary purpose is to handle logic, such as if statements, loops, or logical conjunctions. (Obviously, employed predefined functions need not adhere to this.)

  • All inputs needed to produce the outputs used for scoring as well as any elements of container structures must adhere to the following:

    • They are all of the same type.
    • If they are functions or otherwise callable (and actually called in your program), they must consistently return objects of the same type.
    • They must not be classes, type identifiers, or similar.
    • If they are strings, they are treated (with respect to these rules) as any obvious interpretation of them as code, class names, or similar.
    • If they are containers themselves, their elements must adhere to these rules when taken together.

    So, e.g., in Python the following are invalid:

    a = lambda i: [ 0, 0., [], {}, (0), {0} ][i]
    b = lambda i: [ int, float, list, dict, tuple, set ][i]()
    c = lambda i: [ [0], [0.], [[]], [{}], [(0)], [{0}] ][i][0]
    d = eval   # using "0", "0.", "[]", "{}", … as input
    e = lambda i: eval( ["0","0.","[]","{}","(0)","{0}"][i] )
    

    This also applies to containers generated during by the function during its execution. (Obviously, this does not apply to such objects if used internally by employed predefined functions.)


Valid (ungolfed) example

Python:

def f(i):
    return sum([2.][0:i])

For this we have:

f(0) == 0
type(f(0)) == int
f(1) == 2.0
type(f(1)) == float

This makes use of the fact that the sum of an empty iterable (like [2.][0:0]) is 0.


Sandbox questions

  • I am pondering whether I should replace a portion of the rules with a catch-all like:

    If whatever trick you use to acquire n types of output can be used to obtain n+1 types of output, it is invalid. (If n+1 just doesn’t work because n is the total number of types in your language, this doesn’t count either.)

    Obviously, this would lessen the chance of any boring loopholes, but it would also be more likely to be subject to interpretation. Do you think this is a good idea?

  • Did I miss any obvious loopholes that would make this challenge boring?

  • This challenge was mainly done with Python in mind, but I seen no reason why it should not extend to other programming languages (with a suitable typing system). Are there any obvious pitfalls with other languages that I should consider?

  • Are there any other appropriate tags for the question?

\$\endgroup\$
12
  • 3
    \$\begingroup\$ This seems like an interesting challenge at its core, but there are a lot of gotchas. Is indexing into a tuple considered a logical construct? For example, in PowerShell, you can put a Boolean into the index and it will automatically cast to 0 or 1 to get a pseudo-ternary operation. Are languages like Java allowed to use reflection? Etc. \$\endgroup\$ Commented Oct 13, 2017 at 20:34
  • 1
    \$\begingroup\$ Also in a language like R (my most familiar language), there are really only 7 types as given by typeof() but there are numerous classes which can be found by class(). That being said, every instance of an R class is really list when typeof() is called on it. see this, for example. Basically, you'll have to make a decision for every language submitted on "a suitable typing system" \$\endgroup\$
    – Giuseppe
    Commented Oct 13, 2017 at 20:44
  • \$\begingroup\$ @AdmBorkBork: Is indexing into a tuple considered a logical construct? – No, handling logic is not the primary purpose of this feature. I also do not see this as a problem since a tuple is an iterable and thus its elements would have to be of the same type. (Such pseudo-choosing operations are exactly the reason why I imposed that rule.) — Are languages like Java allowed to use reflection? – I only briefly looked into this, but I don’t see a how this could pose a loophole. \$\endgroup\$
    – Wrzlprmft
    Commented Oct 13, 2017 at 21:24
  • \$\begingroup\$ @Giuseppe: (T-1)/L rather than (T-1)/C – corrected, thanks. — Basically, you'll have to make a decision for every language submitted on "a suitable typing system" – I added a note that you can pick one and stick to it in that case. Would this pose any problems with your example (R)? \$\endgroup\$
    – Wrzlprmft
    Commented Oct 13, 2017 at 21:34
  • \$\begingroup\$ 1. A PowerShell tuple is not an iterable. 2. Plenty of languages have duck typing. That's a clear notion of type, but it has the potential to trivialise this question in the same way that reflection does. E.g. in JavaScript function f(s){var o={};o[s]=f;return o} 3. The Java method you should be looking at is Class.forName. \$\endgroup\$ Commented Oct 13, 2017 at 22:59
  • \$\begingroup\$ @PeterTaylor: 1. Okay, let me generalise this to containers. 2. I am familiar with duck typing from Python but I don’t see how this provides a loophole. Your JavaScript example always returns something of type object IIUC. 3. From what I just learnt, that seems to be a special case of interpreting strings as code. \$\endgroup\$
    – Wrzlprmft
    Commented Oct 13, 2017 at 23:28
  • \$\begingroup\$ 2. "If there are many separate typing systems in your language, you have to pick one and stick to it." I'm using duck typing: your objection is using prototype-based typing. 3. No, it takes a string which is the name of a type and instantiates an object of that type using its public 0-ary constructor. \$\endgroup\$ Commented Oct 14, 2017 at 6:27
  • \$\begingroup\$ Given that so many approaches are disallowed, can you add a simple example or two of a valid approach? \$\endgroup\$ Commented Oct 14, 2017 at 8:14
  • \$\begingroup\$ @PeterTaylor: 2. I get what you are going at now, but I would not consider duck typing a clear typing system in the sense that every object has a unique type (I edited to clarify) – if you so wish, it is the absence of such a system. 3. I gathered that, but how is that not interpreting a string as code? Anyway, I edited that criterion to be more inclusive. \$\endgroup\$
    – Wrzlprmft
    Commented Oct 14, 2017 at 9:47
  • \$\begingroup\$ @user2390246: I added an example. \$\endgroup\$
    – Wrzlprmft
    Commented Oct 14, 2017 at 9:48
  • 1
    \$\begingroup\$ I don't think the edits unambiguously resolve the issues. 2. I can write a typeof function in JavaScript which produces an array of the properties of an object. 3. It's more like a defaultdict lookup than eval. And I don't see how "these strings are subject to all rules" unambiguously prohibits reflection.The contents of the string are characters: the string is not a valid statement or expression, and its contents can't really be said to have a type. \$\endgroup\$ Commented Oct 14, 2017 at 10:53
  • \$\begingroup\$ @PeterTaylor: 2. I can write a typeof function in JavaScript which produces an array of the properties of an object. – Words fail me. Let’s stick to official type systems (I edited). — 3. unambiguously prohibits reflection – My goal isn’t to prohibit reflection (which is probably fuzzy anyway), but only exploits thereof that make this challenge boring. I restructured the rules and extended them in a way that I hope will clearly cover Class.forName and any other boring exploits. \$\endgroup\$
    – Wrzlprmft
    Commented Oct 15, 2017 at 9:48
-3
\$\begingroup\$

Puzzle:

  • Make a program that draws the following figure line by line.

  • Your program should wait for one-second(it can be longer, just has to be a noticable difference) after drawing each line.

  • Your program can only draw line by line (you cannot jump to another point or re-draw over a line)

  • Given a positive integer n, produce an art image of the below drawing

  • The angle measures should always be the same (regardless of n's value)

  • However, each line's length should be 150*n pixels

  • You only need to account for when n = 1, n = 2, n = 3

example

Specifications:

if n=1:

  • length = 150 pixels

if n=2:

  • length = 300 pixels

if n=3

  • length = 450 pixels

.

.

Answering - Name the language you used followed by its bytes

Example:

Java (swing), 500 bytes

.

Scoring

Good luck!

\$\endgroup\$
2
  • 4
    \$\begingroup\$ You haven't solved the obvious issue "You can't have an equilateral triangle with angles of 45-45-90." (comment from deleted challenge) The sandbox is only helpful if you listen to people who suggest changes, really. \$\endgroup\$
    – DELETE_ME
    Commented Oct 22, 2017 at 8:00
  • \$\begingroup\$ I'm not sure what we're being asked to draw. Just the black figure? The black figure and the annotations? \$\endgroup\$ Commented Oct 23, 2017 at 7:07
-3
\$\begingroup\$

I have seen many a trivial answer in jelly, so i wish to propose:

Challenge: A non-trivial answer

  • Input two strings
  • If the two strings are integers and are equal, output a truthy value.
  • Otherwise, output a falsy value.

Clarifications

  • You may receive non-integer inputs.
  • You will never receive an integer that is outside the bounds [-2³¹, 2³¹). Rules

  • Standard loopholes are disallowed.

Scoring:

  • This is not your standard code-golf
  • the winner person who posts the longest program.
  • an entry is invalidated if someone posts a shorter program in the same language.
\$\endgroup\$
4
  • \$\begingroup\$ Note: i don't believe that this is code-bowling, as only the shortest program in any language is eligible; this is more about finding an obscure language in which the task is actually hard to do, rather than obscure languages where the task is too easy. \$\endgroup\$ Commented Nov 2, 2017 at 22:19
  • \$\begingroup\$ Easy win for Unary. \$\endgroup\$
    – Dennis
    Commented Nov 2, 2017 at 22:26
  • \$\begingroup\$ what a horrible way of representing a program, yeah... any type of 'longest sensible program' task is not so helpful. \$\endgroup\$ Commented Nov 3, 2017 at 3:20
  • \$\begingroup\$ @Dennis do you think that restricting to languages that have won a standard code-golf challenge in 2017 would help? It does seem that if we have to start putting in language or other implementation restrictions, then this isn't worth posting. Oh well. guess this stays on the proposal board. \$\endgroup\$ Commented Nov 3, 2017 at 3:22
-3
\$\begingroup\$

Golf This Question

Your program should output to STDOUT the full text of this question as it appears on your screen, so no HTML. This includes the title and the body. Please do not edit this question whatsoever so-as to keep it the same for all programs.

No reading the text from a file or the internet

This is , so the shortest code wins!

Sandbox Is this a good question? Is there anything I should clarify?

\$\endgroup\$
6
  • \$\begingroup\$ similar but obviously different since it requires the markdown. \$\endgroup\$
    – Giuseppe
    Commented Nov 8, 2017 at 16:17
  • 1
    \$\begingroup\$ You should add some rules and winning criteria (which would increase the length of the question, but oh well) \$\endgroup\$
    – hyper-neutrino Mod
    Commented Nov 8, 2017 at 17:28
  • 1
    \$\begingroup\$ I'm not sure what much this adds beyond the typical KC challenges, and thus it's likely to be closed as a dupe. \$\endgroup\$ Commented Nov 8, 2017 at 17:36
  • 1
    \$\begingroup\$ @AdmBorkBork I guess OP means to allow access to the internet, in which case it's very different, but I'm not sure... If so, it's basically a challenge about parsing html, or get the result directly from the API (if that's possible). \$\endgroup\$ Commented Nov 8, 2017 at 18:40
  • \$\begingroup\$ Include tag about Kolmogorov complexity. \$\endgroup\$
    – Heimdall
    Commented Nov 11, 2017 at 8:43
  • \$\begingroup\$ Why the downvotes? \$\endgroup\$
    – qqq
    Commented Nov 21, 2017 at 23:24
-3
\$\begingroup\$

Find the min swaps for order one powerset for a List

The question it is write one powerset function and one sort function tha minimize the swaps for doing one order with this compare function on powerset of the List A

cmp(a,b) -- a and b are subset of the list A
    if sizeof a > sizeof b then (swap a and b; return)
    if sizeof a < sizeof b than return
    for i in 1..(sizeof a) repeat
         for j in 1..(sizeof A) repeat
               if a[i]==A[j] then return
               if b[i]==A[j] then (swap a and b; return)

the result of this compare function on the sets wuold be the follow:

(15) -> powSet([1,2,3])
   (15)  [[],[1],[2],[3],[1,2],[1,3],[2,3],[1,2,3]]
                                                      Type: List List Any
(16) -> powSet([3,2,1])
   (16)  [[],[3],[2],[1],[3,2],[3,1],[2,1],[3,2,1]]
                                                      Type: List List Any

note that order depend not from the number element, but on the position on the start List A=[1,2,3]

(17) -> powSet([1,2,3,4,5,6])
   (17)
   [[], [1], [2], [3], [4], [5], [6], [1,2], [1,3], [1,4], [1,5], [1,6], [2,3],
    [2,4], [2,5], [2,6], [3,4], [3,5], [3,6], [4,5], [4,6], [5,6], [1,2,3],
    [1,2,4], [1,2,5], [1,2,6], [1,3,4], [1,3,5], [1,3,6], [1,4,5], [1,4,6],
    [1,5,6], [2,3,4], [2,3,5], [2,3,6], [2,4,5], [2,4,6], [2,5,6], [3,4,5],
    [3,4,6], [3,5,6], [4,5,6], [1,2,3,4], [1,2,3,5], [1,2,3,6], [1,2,4,5],
    [1,2,4,6], [1,2,5,6], [1,3,4,5], [1,3,4,6], [1,3,5,6], [1,4,5,6],
    [2,3,4,5], [2,3,4,6], [2,3,5,6], [2,4,5,6], [3,4,5,6], [1,2,3,4,5],
    [1,2,3,4,6], [1,2,3,5,6], [1,2,4,5,6], [1,3,4,5,6], [2,3,4,5,6],
    [1,2,3,4,5,6]]
                                                      Type: List List Any

Win the one that minimize the swaps for order the powerset of the follow list

[1],[1,2],[1,2,3],[1,2,3,4],[1,2,3,4,5],[1,2,3,4,5,6]

Patterns match for composed expression

If we have one math expression B(x) [that mean in B appear x] [math expression is one expression where appear only symbols for function and operator of mathematics that are ok for type and compose ] Find the max lengt subexpression g(x) of B contain x such that

B(x)=f(g(x))

And f(y) and g(x) are both math expression.

Find Max for a function in one interval

R is the set of real numbers. Is given a function f:A->R from set A (⊆ R) to the R, continue and derivable in one close interval

 [a, b]⊆A

Write the shortest program for find

 max{f(x): x in [a,b]}

knowing the function f(x) derivable in the interval [a,b]. The solution has to be correct at last until the V digit after the float point, and for all functions f that has 10 value max in which f'(x)= 0 in [a, b]. codegolf tag

On Riemann Zeta function domain

If Zeta:C->C is the Riemann Zeta function, we give the set:

 W={b: 0<b<100 and Re(Zeta(0.5+i*b))=-Im(Zeta(0.5+i*b))}

Where Re() return the real part of its argument, and Im() return the imaginary part of its argument.

It is requested to calculate one approximation of each element of W; this means here all b in float numbers with b in 0..100 such way

  abs(Re(Zeta(0.5+i*b))+Im(Zeta(0.5+i*b)))<0.0001 

at last, to put all together in a array or list or set of float.

One can note that the below set of zeros for the Riemann function is a subset of above W set.

 {b: 0<b<100 and Zeta(0.5+i*b)=0}

Some test

Some numbers b approssimation to solution of equation

Re(Zeta(0.5+i*x))+Im(Zeta(0.5+i*x))=0 

the ones that are approssimation to solution of equation Zeta(0.5+i*x)=0 too

[14.134725, 21.022039, 30.424876, 32.935061, 37.58617815, 40.918719, 43.327073, 48.00515, 49.773832]

the ones not approssimation to solution of equation Zeta(0.5+i*x)=0 too

[12.458493623791109003, 24.351346882420215577, 28.716611773969890307]

The code more short in bytes that find all these approssimations of element of the set W wins...

Code golf tag

\$\endgroup\$
9
  • 2
    \$\begingroup\$ You're going to need to phrase this better and be more precise about what you're asking for. Currently, this sounds a little bit like a homework question. \$\endgroup\$ Commented Apr 22, 2017 at 13:25
  • \$\begingroup\$ This is also formatted improperly. \$\endgroup\$ Commented Apr 22, 2017 at 13:27
  • \$\begingroup\$ This appears to permit hard-coding the output, which is generally a sign of a bad question. Why not parameterise it? \$\endgroup\$ Commented Apr 22, 2017 at 15:09
  • \$\begingroup\$ I think now I ' m clear... What is not clear or ambiguous? \$\endgroup\$
    – user58988
    Commented Apr 22, 2017 at 15:40
  • \$\begingroup\$ possibly a little too much difficult... there are numbers that seems solutions but if i increase digits they are just wrong.... \$\endgroup\$
    – user58988
    Commented Apr 23, 2017 at 17:55
  • 1
    \$\begingroup\$ Also, it's "approximation". \$\endgroup\$ Commented May 22, 2017 at 6:40
  • 2
    \$\begingroup\$ Being (continuous and) differentiable is quite a weak constraint. There are e.g. nasty functions which are differentiable but whose derivative is not integrable. \$\endgroup\$ Commented May 22, 2017 at 11:47
  • \$\begingroup\$ One continue function in one close interval [a, b] has max and min \$\endgroup\$
    – user58988
    Commented May 22, 2017 at 13:48
  • \$\begingroup\$ So for the order a PowerSet of one list is all clear... \$\endgroup\$
    – user58988
    Commented Nov 16, 2017 at 13:30
-3
\$\begingroup\$

Shortest code to draw a png from stdin

Rules :

  • You’re free to use any image library you want as long as the image library is designed in the same language as your answer.
  • The image should be displayed in an Xorg or wayland window or a console framebuffer.
    If you’re displaying to a window, you don’t need to create any windows control (in that case the programs ends with CTRL+C).
  • The stdin stream doesn’t eof. so the only way to get the image size is to parse png data. Once the image had been displayed, /dev/stdin should be closed.
  • Your answer shouldn’t crash on random data.

The answer using the fewest bytes wins !

\$\endgroup\$
6
  • \$\begingroup\$ Way too easy for some languages and way too hard for others. And how would I do it if my language can't produce graphical output? What if I have neither STDIN nor STDOUT? \$\endgroup\$
    – Nissa
    Commented Nov 29, 2017 at 16:21
  • \$\begingroup\$ @StephenLeppik : the point of my question is to suggest that language choice is restricted to languages that can run on Unix systems supportting screening. I don’t know too easy answers, but libpng16 along Xorg libraries should make it possible in a few line of code. \$\endgroup\$ Commented Nov 29, 2017 at 16:45
  • 2
    \$\begingroup\$ Restricting it to such a small list of languages is a good way of alienating half the site. \$\endgroup\$
    – Nissa
    Commented Nov 29, 2017 at 16:52
  • \$\begingroup\$ @StephenLeppik : It just basically, restrict to all languages which can write a hello word. Writing to a framebuffer is just as easy as to write a raw image in device file which opens like a normal file so this doesn’t matter. I’d rather say the list of language that can print a Hello world on Linux or ʙꜱᴅ is huge but not small. \$\endgroup\$ Commented Nov 30, 2017 at 17:34
  • \$\begingroup\$ Believe it or not, displaying an image is not a capability that directly follows from being able to print text… \$\endgroup\$ Commented Mar 22, 2019 at 2:40
  • \$\begingroup\$ @UnrelatedString that’s because it’s not possible to do it from text I’m asking this. But this is defintely like writing to a file. \$\endgroup\$ Commented Mar 22, 2019 at 19:31
-3
\$\begingroup\$

Hack Stack!

Your challenge is to create a code snippet in javascript that will upvote your answer when run. This should not be possible, but maybe it is. We'll see!

Rules

Standard Loopholes are not allowed.

You should not auto-downvote other answers.

Do not manually upvote any ansewer, please!

The first one to write code that also accepts the answer when it is run by me will remain accepted.

For discussion:

Is this even a valid challenge?

\$\endgroup\$
4
  • 1
    \$\begingroup\$ I'm a newbie here but I think this is exactly the most dangerous place to ask for code to run on your PC. Too many clever obfuscators, golfers and underhanded practitioners to trust. \$\endgroup\$ Commented Dec 10, 2017 at 21:27
  • 1
    \$\begingroup\$ Maybe, instead of requesting submissions do something that is (1) possibly impossible, (2) illegal, and (3) unsafe to run on your browser, have the submission try to upvote the answer (even though this might not work) \$\endgroup\$ Commented Dec 10, 2017 at 21:43
  • 2
    \$\begingroup\$ I think this counts as asking for malicious code, which is against the site rules. \$\endgroup\$
    – Laikoni
    Commented Dec 10, 2017 at 22:31
  • \$\begingroup\$ Thanks for telling me this is illegal and against the rules. I wasn't thinking of it that way. Not a good challenge, then. Should I delete it, or keep it there so that other people with similar ideas can see it? \$\endgroup\$ Commented Dec 10, 2017 at 22:40
-3
\$\begingroup\$

Feliz navidad, prospero año y felicidad

So christmas is comming and carols are on the radio all day. Jose Feliciano's Feliz Navidad song is a good example of this. Your task is to print the entire (and repetitive) song.

Lyrics:

Feliz navidad
Feliz navidad
Feliz navidad, prospero año y felicidad

Feliz navidad
Feliz navidad
Feliz navidad, prospero año y felicidad

I want to wish you a merry Christmas
I want to wish you a merry Christmas
I want to wish you a merry Christmas from the bottom of my heart

I want to wish you a merry Christmas
I want to wish you a merry Christmas
I want to wish you a merry Christmas from the bottom of my heart

Feliz navidad
Feliz navidad
Feliz navidad, prospero año y felicidad
A-ha!

Feliz navidad
Feliz navidad
Feliz navidad, prospero año y felicidad

I want to wish you a merry Christmas
I want to wish you a merry Christmas
I want to wish you a merry Christmas from the bottom of my heart

I want to wish you a merry Christmas
I want to wish you a merry Christmas
I want to wish you a merry Christmas from the bottom of my heart

Feliz navidad
Feliz navidad
Feliz navidad, prospero año y felicidad

Feliz navidad
Feliz navidad
Feliz navidad, prospero año y felicidad

I want to wish you a merry Christmas
I want to wish you a merry Christmas
I want to wish you a merry Christmas from the bottom of my heart

I want to wish you a merry Christmas
I want to wish you a merry Christmas
I want to wish you a merry Christmas from the bottom of my heart

Feliz navidad
Feliz navidad
Feliz navidad, prospero año y felicidad 

RULES:

  • Default loopholes are forbidden.
  • Default I/O.
  • Programs or functions are acceptable.
  • You MUST include the ñ character in the año word.
  • You can print it in lowercase, uppercase or sentence case.
  • Shortest code in bytes wins!
\$\endgroup\$
4
  • \$\begingroup\$ Hi there! I'm the downvoter. I'm not sure this adds much to the site beyond other recent KC challenges, and it is very likely to be closed as a dupe of either "RickRoll" or "Writing Lines in Detention" as it's currently written. What can you describe about this challenge that adds to the site? \$\endgroup\$ Commented Dec 19, 2017 at 22:09
  • 1
    \$\begingroup\$ For reference -- RickRoll challenge -- Write lines in detention \$\endgroup\$ Commented Dec 19, 2017 at 22:10
  • \$\begingroup\$ Well, it may be a mix of those two challenges but what I found mainly interesting to see is how the users manage to put the ñ character and the "A-ha!" line that is the unique part of the song. \$\endgroup\$
    – WORNG ALL
    Commented Dec 19, 2017 at 22:14
  • \$\begingroup\$ That ñ is just one byte in Win1252, which most answers will probably output in. I don't think this adds anything, personally, and cannot recommend posting it. \$\endgroup\$
    – ATaco
    Commented Dec 19, 2017 at 22:16
-3
\$\begingroup\$

Ultimate crackpot

In minimum number of ASCII bytes, write a plain text "physics research article" in English that scores each item in The Crackpot Index at least once.

I'm not sure if such thing is on-topic here or on the Puzzling.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ I don't think this is on topic on either of those sites. I'm not sure there is a StackExchange site that this would be on-topic. it would have to be some sort of parody writing site similar in style to uncyclopedia or something \$\endgroup\$ Commented Feb 13, 2018 at 22:19
  • 1
    \$\begingroup\$ I think it's a funny idea to achieve as many of these as possible but it's not really on topic here and it would not be possible in plain text to, for example, mail the paper to someone (#12) \$\endgroup\$
    – dylnan
    Commented Feb 14, 2018 at 5:01
  • \$\begingroup\$ A lot of these aren’t very objective either. \$\endgroup\$
    – Jo King Mod
    Commented Feb 14, 2018 at 6:46
-3
\$\begingroup\$

Same code, different work

Write a code in a language that do these few things:

  1. Input a positive integer n, check whether it's a prime. (2 -> true, 5 -> true, 8 -> false)
  2. Input an integer n>1, output an array with fewest positive prime as element, where the sum of the array is n. (2 -> [2], 5 -> [5], 6 -> [3, 3], 8 -> [3, 5] or [5, 3])
  3. Input an integer n, output sum(n mod i, for i=1 to n). (2 -> 0, 5 -> 4, 8 -> 8)

Your code should theoretically solve all legal n, but in practive up to 1000 is enough

Shortest code in bytes win.

\$\endgroup\$
2
  • \$\begingroup\$ The third task: shouldn't it be 2 -> 0 (2 % 1 = 0; 2 % 2 = 0). And you should probably decompress the specs a bit. And isn't there a polyglot tag? \$\endgroup\$
    – wastl
    Commented Mar 16, 2018 at 23:11
  • \$\begingroup\$ There IS a polyglot tag. Although same languages are OK, that can probably only work with different versions (e.g. Python 2 vs Python 3), which seems to be considered a polyglot too. \$\endgroup\$
    – wastl
    Commented Mar 17, 2018 at 10:18
-3
\$\begingroup\$

Write a program who return the current month.

The Rules

  • The result needs to be correct even if the program is run in the future.
  • It's so the shortest code wins!

Optional

Add an interpreter so the submission can be tested. It is allowed to write this interpreter yourself for a previously unimplemented language.


It's my first code-golf idea I'm fully open to improving it with more experienced users.

\$\endgroup\$
9
  • \$\begingroup\$ That's usually a problem with trivial challenges. If this isn't a duplicate of an existing challenge, I predict it will get a lot of answers very quickly, many of which will be very short golfing language solutions. \$\endgroup\$
    – Adám
    Commented Apr 11, 2018 at 14:54
  • 5
    \$\begingroup\$ Possible duplicate? codegolf.stackexchange.com/questions/114787/… \$\endgroup\$
    – Didix
    Commented Apr 11, 2018 at 14:54
  • \$\begingroup\$ Nope, still not all that good. \$\endgroup\$
    – Nissa
    Commented Apr 13, 2018 at 12:41
  • \$\begingroup\$ @StephenLeppik Hm, what can I improve so? \$\endgroup\$
    – Didix
    Commented Apr 13, 2018 at 12:42
  • \$\begingroup\$ IMO you're wasting your time trying to improve this. Delete it and try to come up with something which is inherently interesting. \$\endgroup\$ Commented Apr 13, 2018 at 12:50
  • \$\begingroup\$ Write a program who return the current month should probably change that to Write a program which return the current month. what do you think. Also JSYK : This is a one line task for languages like JS and Ruby. So you should probably ban those \$\endgroup\$ Commented Apr 13, 2018 at 12:51
  • \$\begingroup\$ good point. I guess leave it as is. \$\endgroup\$ Commented Apr 13, 2018 at 13:06
  • \$\begingroup\$ @MuhammadSalman Easier challenges get shorter solutions. If you don't want to see short solutions (no idea why), write hard challenges. \$\endgroup\$
    – DELETE_ME
    Commented Apr 13, 2018 at 13:12
  • \$\begingroup\$ @user202729 : I never said I don't want short solutions. But these aren't much of a challenge. For example even a ten year old kid would be able to solve this in JavaScript using built in's. in all a total of 10 chars spent and 2 seconds. Not fun. Challenges that make you stop and think and actually work for them are best. Of course feel free to disagree. \$\endgroup\$ Commented Apr 13, 2018 at 13:16
-3
\$\begingroup\$

Output Infinity (updated v2)

Challenge

Output the following infinity symbol:

         ∞∞infinity                         ∞infinity                   
     infinity∞∞infinity                 infinity∞∞infinity              
   infinity∞∞∞∞∞∞∞infinity           infinity∞∞∞∞∞∞∞infinity            
  infinity        ∞∞infinity      ∞∞∞∞∞infinity        ∞∞∞∞∞∞∞          
 ∞∞∞∞∞                 ∞∞∞∞∞∞∞  ∞∞∞infinity               ∞∞∞∞∞         
 ∞∞∞                      ∞∞∞∞∞∞∞infinity                   ∞∞∞         
∞∞∞                         ∞∞infinity                       ∞∞∞        
∞∞∞                       ∞∞infinity                         ∞∞∞        
 ∞∞∞                    ∞∞∞∞∞∞infinity                      ∞∞∞         
 ∞∞∞∞∞               ∞∞∞infinity  ∞∞∞∞∞∞∞                 ∞∞∞∞∞         
  infinity       ∞∞∞∞∞infinity     ∞∞∞infinity        infinity          
    infinity∞∞∞∞∞∞∞infinity           infinity∞∞∞∞∞∞∞infinity           
      infinity∞∞infinity                infinity∞∞∞infinity             
           ∞infinity                        ∞∞∞infinity                 

Rules

  • No input.
  • Output can be given in any convenient format.
  • Any number of trailing spaces at the end of each line is allowed.
  • Any number of trailing new lines at the end of the shape is permitted.
  • Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
  • If possible, please include a link to an on-line testing environment so other people can try out your code!
  • Standard loopholes are forbidden.
  • This is so all usual golfing rules apply, and the shortest code (in bytes) wins.
\$\endgroup\$
12
  • \$\begingroup\$ need some comments for down-vote... \$\endgroup\$
    – mdahmoune
    Commented Apr 20, 2018 at 19:01
  • 1
    \$\begingroup\$ If the challenge's goal is -- as I understand it -- to output one of the five objects, in most languages that would result in an optimal submission of something along the lines of print("∞"). A rather boring but valid submission to a challenge that effectively asks to print a single unicode character. \$\endgroup\$ Commented Apr 20, 2018 at 19:34
  • 1
    \$\begingroup\$ The downvotes are probably because you're allowing multiple outputs, some of which are interesting (4-5), some of which are trivial (1-3). As @JonathanFrech suggests, for a code-golf challenge, everyone is going to chose a trivial output for shortness. Alternate ideas: Input an integer 1-5, output the corresponding form of infinity. Or perhaps narrow to just output option #4 (or an even larger, fancier ASCII infinity), and make it a kolmogorov-complexity question. \$\endgroup\$
    – BradC
    Commented Apr 20, 2018 at 20:59
  • 1
    \$\begingroup\$ I would even say that this challenge in its current form should be tagged kolmogorov-complexity. If you decide to go in the direction @BradC suggested, you could maybe also consider to incorporate the challenge's theme into your challenge rather than posting yet another Kolmogorov complexity challenge. Something along the lines of infinitely outputting the ASCII art or taking two numbers as input, dividing them and producing the infinity symbol when the second one is zero. \$\endgroup\$ Commented Apr 20, 2018 at 22:01
  • \$\begingroup\$ I don't think this is anyhow related to math. Only "inspired by math", maybe. \$\endgroup\$
    – DELETE_ME
    Commented Apr 21, 2018 at 10:54
  • \$\begingroup\$ Now -- is there any exploitable pattern in the output such that it should not be closed as a dupe of "We're no stranger to code golf, you know the rules, and so do I"? \$\endgroup\$
    – DELETE_ME
    Commented Apr 21, 2018 at 10:55
  • \$\begingroup\$ @user202729 No, there is no predefined specific pattern, I prepared this MANUALLY. How could I specify that in the challenge? \$\endgroup\$
    – mdahmoune
    Commented Apr 21, 2018 at 11:00
  • \$\begingroup\$ I believe it's customary to specify if trailing spaces / new lines are permitted and if so, how many \$\endgroup\$ Commented Apr 21, 2018 at 19:30
  • \$\begingroup\$ @AsoneTuhid for spaces I think it is ok because it does not deform the shape, but I do not think so for new lines, what do you think? \$\endgroup\$
    – mdahmoune
    Commented Apr 21, 2018 at 19:54
  • \$\begingroup\$ Not between the lines, of course. I mean new lines after the whole drawing. Some people put restrictions (none, one, whatever). Nice art btw \$\endgroup\$ Commented Apr 21, 2018 at 19:57
  • \$\begingroup\$ @AsoneTuhid yes of-course, thanks a lot for this remarks. \$\endgroup\$
    – mdahmoune
    Commented Apr 21, 2018 at 20:06
  • \$\begingroup\$ Can you write a reference implementation which beats bzip2 and gzip, preferably by a few percent? \$\endgroup\$ Commented Apr 25, 2018 at 12:05
-3
\$\begingroup\$

Reverse Code Golf- Print out two by using variables a and b that both equal one and adding them without any extraneous lines.

Your task is very simple, display that 1+1=2, except you need as many commands and non extraneous lines as possible.

What counts as non-extraneous? If one cannot remove any kind of sequence or segment of commands, then the program is counted as non-extraneous. The variable names need to be only one byte each, without any kind of trailing zeroes or insignificant digits.

Input: nothing

Output: "2" or 2 or whatever, as long as the program runs 1+1.

Sample: Java- System.out.println( Integer.parseInt( "1" ) + Integer.parseInt( "1"));

\$\endgroup\$
4
  • \$\begingroup\$ xkcd.com/1960 obviously inspired by this \$\endgroup\$
    – bleh
    Commented May 9, 2018 at 3:48
  • 4
    \$\begingroup\$ See codegolf.meta.stackexchange.com/a/9584/194 \$\endgroup\$ Commented May 9, 2018 at 8:13
  • \$\begingroup\$ What is a "sequence"? What is a "segment"? \$\endgroup\$
    – DELETE_ME
    Commented May 9, 2018 at 11:33
  • \$\begingroup\$ The only way we've found to express your "non-extraneous" criteria is pristine-programming, which is very strict but much less ambiguous. \$\endgroup\$ Commented May 9, 2018 at 15:51
-3
\$\begingroup\$

Send the pairs

Write two program A and B. A takes 1024 pairs of integers (a,b), where 0≤a<232, 0≤b<1024, and all as are different. Output a positive integer. B take the output of A and one a from the input pairs of A, and output its b.

Smallest output of A under a same random test data win.

\$\endgroup\$
8
  • \$\begingroup\$ To be a truly objective challenge, the test data should be included in the question; but then B could hard-code it and A could output 1 as a flag to invoke the hard-coded data. \$\endgroup\$ Commented Jul 24, 2018 at 20:03
  • 1
    \$\begingroup\$ @PeterTaylor I don't think hiding the test case make the challenge less objective. \$\endgroup\$
    – DELETE_ME
    Commented Jul 25, 2018 at 7:45
  • 2
    \$\begingroup\$ @user202729, codegolf.meta.stackexchange.com/a/1369/194 . If I can't tell whether a change to my answer makes it better or worse, it's not an objective challenge. If the only person who can tell is the OP, then the judging is a black box which from the outside is indistinguishable from a purely subjective judgement. \$\endgroup\$ Commented Jul 25, 2018 at 7:50
  • \$\begingroup\$ @PeterTaylor codegolf.meta.stackexchange.com/a/308 (+15 vote) \$\endgroup\$
    – l4m2
    Commented Jul 25, 2018 at 10:44
  • 1
    \$\begingroup\$ @l4m2, that agrees perfectly with the last sentence of my previous comment. \$\endgroup\$ Commented Jul 25, 2018 at 11:18
  • \$\begingroup\$ @PeterTaylor No if the test is public some days after \$\endgroup\$
    – l4m2
    Commented Jul 25, 2018 at 11:33
  • \$\begingroup\$ @l4m2, then you would lack a winning criterion until you post those tests publicly. \$\endgroup\$ Commented Jul 29, 2018 at 14:41
  • \$\begingroup\$ @JungHwanMin A recent meta post explicitly allowed that. \$\endgroup\$
    – DELETE_ME
    Commented Aug 1, 2018 at 2:52
-3
\$\begingroup\$

Write a program that takes a list of strings as input and creates trees of prefixes as such:

Hi_there_how_are_you?
Hi_there_would_you_mind?
Hi_the_weather_is_nice
Hills_are_green
Many_of_us
May_has_11_days
May_has_11_days_left
IWillLearnTheTrombone
IWillLearnTheSaxophone
IWillLearnThePiano

Which would output:

Hi Hi_there Hi_there_how_are_you?
            Hi_there_would_you_mind?
   Hi_the_weather_is_nice
   Hills_are_green
Ma Many_of_us
   May_has_11_days May_has_11_days
                   May_has_11_days_left
IWillLearnThe IWillLearnTheTrombone
              IWillLearnTheSaxophone
              IWillLearnThePiano

The input strings shall contain no spaces and the output shall be separated by at least one space, any number of extra line breaks or spaces are allowed. The output above is formatted to explain the challenge, the following formatting is also valid:

Hi Hi_there Hi_there_how_are_you? Hi_there_would_you_mind? Hi_the_weather_is_nice Hills_are_green Ma Many_of_us May_has_11_days May_has_11_days May_has_11_days_left IWillLearnThe IWillLearnTheTrombone IWillLearnTheSaxophone IWillLearnThePiano

This question is a kind of reverse of this Prefix Tree Traversal. This is code golf, shortest code in bytes win.

Note: I'm struggling with the output? What would be the most 'fun'/ have high potential for cleverness? The one I have now just looks like a mess. Can i have output as a list of lists(of lists)? Or do that hinder people?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Related (make an alphabeTrie). Very close, though I think it might depend on your output format on whether it is a dupe \$\endgroup\$
    – Jo King Mod
    Commented Sep 23, 2018 at 8:48
  • \$\begingroup\$ I would mark it as a duplicate to the one that Jo King linked. \$\endgroup\$ Commented Sep 27, 2018 at 19:54
-3
\$\begingroup\$

I'm glad the sandbox exists because I have a few issues coming up with the right wording for this.

Background

Theoretically, any numeric pattern should exist somewhere in the decimal places of pi.

Challenge

Given any numeric input, find the index (location?) of the first occurrence of that input in the decimal place of pi

Example cases:

  • 1 = 1
  • 14 = 1
  • 41 = 2
  • 897 = 11

Rules:

any numeric input, can't see why it should be limited by any number of characters. I am not sure about limitations, but this could get computationally intense if it's a large sequence of numbers that occur very deep into pi. Do I need to add any restrictions to cater for computational complexity?

\$\endgroup\$
2
  • 5
    \$\begingroup\$ We'be had this challenge before. That one only requires the first few digits, but I think we've had enough challenges about pi that this won't add anything \$\endgroup\$
    – H.PWiz
    Commented Sep 25, 2018 at 7:36
  • 2
    \$\begingroup\$ "Theoretically, any numeric pattern should exist somewhere in the decimal places of pi." - how do you know that? \$\endgroup\$
    – ngn
    Commented Sep 25, 2018 at 10:00
-3
\$\begingroup\$

Tags:

Code-Bowling

Name: Two is an error, One runs fine!

The challenge is simple.

When one character is removed from the given program, it should not error, but when two are removed, it should error.

PENALTIES:

If you repeat one Unicode character in the program, then your score will be the number of bytes subtracted by the Unicode value of the character (0 for NUL, 10 for newline, 64 for A, etcetera).

Else, your score is the number of bytes.

As always, since this is code bowling, most bytes win!

\$\endgroup\$
8
  • 2
    \$\begingroup\$ What if I repeat two characters in the program? \$\endgroup\$
    – DELETE_ME
    Commented Dec 1, 2018 at 3:29
  • 4
    \$\begingroup\$ What if I just have a really large amount of NUL bytes? \$\endgroup\$
    – Jo King Mod
    Commented Dec 1, 2018 at 3:33
  • \$\begingroup\$ Is it ok if the program itself error/not error? \$\endgroup\$
    – DELETE_ME
    Commented Dec 1, 2018 at 3:35
  • \$\begingroup\$ What about infinite loop? \$\endgroup\$
    – DELETE_ME
    Commented Dec 1, 2018 at 3:35
  • 1
    \$\begingroup\$ This question needs major work: in its current state I would definitely vote to close it, and the only question would be whether to close as Too Broad or to close as Unclear. It's too broad because there's no specification for what the program must do. It's unclear because it's not specific enough on the quantifiers around the character removal: if it should be robust against the removal of any character, be explicit. See radiation-hardening for existing questions in this area, both for examples of how to word them and to ensure that it's different enough to be new and interesting. \$\endgroup\$ Commented Dec 1, 2018 at 10:42
  • \$\begingroup\$ @PeterTaylor Although the program can do anything, it should not be too broad if the challenge is sufficiently hard. \$\endgroup\$
    – DELETE_ME
    Commented Dec 4, 2018 at 10:30
  • \$\begingroup\$ About the removal of any character: I guess that the score is \$len-\sum_{c}{c\times \max(0,n(c)-1)}\$ for \$len\$ = program length in bytes and \$n(c)\$ = number of occurences of character c in program, but I'm not sure. \$\endgroup\$
    – DELETE_ME
    Commented Dec 4, 2018 at 10:32
  • \$\begingroup\$ LENGUAGE win!!! \$\endgroup\$
    – l4m2
    Commented Dec 4, 2018 at 11:32
-3
\$\begingroup\$

Output a number \$n\$ such that:

  1. \$n\text{mod}10=5\$
  2. \$n^2\text{mod}10^{10000}=n\$

Shortest code win. You should be able to try it rather than purely know it work.

Sandbox mainly to check duplication

\$\endgroup\$
8
  • 1
    \$\begingroup\$ Wouldn't this be easy to just hardcode the number? \$\endgroup\$
    – Jo King Mod
    Commented Dec 13, 2018 at 13:22
  • \$\begingroup\$ @JoKing We must have \$n^2\ge 10^{10000}\$, so \$n\ge 10^{5000}\$ which if naively hardcoded takes \$5000 \log_2{10}\$ bits. \$\endgroup\$
    – DELETE_ME
    Commented Dec 13, 2018 at 14:24
  • \$\begingroup\$ However, we already have modular multiplicative inverse challenge, I expect most answers to be very similar. \$\endgroup\$
    – DELETE_ME
    Commented Dec 13, 2018 at 14:42
  • \$\begingroup\$ @user202729 It's likely that you'll get 1 in that way or be too slow so I need time requirement \$\endgroup\$
    – l4m2
    Commented Dec 13, 2018 at 15:00
  • \$\begingroup\$ @l4m2 Most solutions there use extended Euclid algorithm so they will not be too slow... \$\endgroup\$
    – DELETE_ME
    Commented Dec 13, 2018 at 15:06
  • \$\begingroup\$ @user202729 So they'll get 1 \$\endgroup\$
    – l4m2
    Commented Dec 13, 2018 at 15:22
  • \$\begingroup\$ Get 1 what? The correct answer is 810...90625. \$\endgroup\$
    – DELETE_ME
    Commented Dec 13, 2018 at 15:31
  • \$\begingroup\$ Will how many languages use this? \$\endgroup\$
    – l4m2
    Commented Dec 13, 2018 at 15:57
-3
\$\begingroup\$

Integer or decimal to array and array to decimal or integer

Task

Write two functions

1) Convert an integer or decimal to array of integers that potentially includes a single decimal

2) Convert array including integers and potentially a single decimal to integer or decimal

Input

Integer or decimal to array

  • An integer or decimal

Array to integer or decimal

  • An array

Output

Integer or decimal to array

  • An array containing each digit of the input at an individual index with the first decimal portion of input containing the decimal character.

Array to integer or decimal

  • An integer or decimal equal to input

Specification

When the first digit of a decimal is a 0 , and a digit follows, that value includes all 0's up to and including the last digit of that decimal, else the decimal portion is spread or expanded to the remainder of the decimal portion for the remainder of indexes of the array, that is: -0.01 <-> [-0.01], 100.01 <-> [1,0,0,0.01], 100.0001 <-> [1,0,0,0.0001]

Test cases

Input <----------> Output

-123               [-1,-2,-3]
4.4                [4,0.4]
44.44              [4,4,0.4,4]
-0.01              [-0.01]
123                [1,2,3]
200                [2,0,0]
2.718281828459     [2,0.7,1,8,2,8,1,8,2,8,4,5,8,9]
321.7000000001     [3,2,1,0.7,0,0,0,0,0,0,0,0,1]
809.56             [8,0,9,0.5,6]
1.61803398874989   [1,0.6,1,8,0,3,3,9,8,8,7,4,9,8,9]
1.999              [1,0.9,9,9]
100.01             [1,0,0,0.01]
545454.45          [5,4,5,4,5,4,0.4,5]
-7                 [-7]
-83.782            [-8,-3,-0.7,-8,-2]
1.5                [1,0.5]
100.0001           [1,0,0,0.0001]

Winning criteria

Least amount of total (each of function or programs 1 and 2) bytes used.

code-golf

\$\endgroup\$
39
  • \$\begingroup\$ 1) What should output be for test cases 0, 200, and 1.0015? 2) I would suggest a more descriptive title. 3) Bonuses are generally discouraged in code golf, so make sure they add something to this challenge. \$\endgroup\$
    – lirtosiast
    Commented Dec 18, 2018 at 23:43
  • 1
    \$\begingroup\$ The string method thing is very iffy. Won't a print function in any language be converting a number/list of numbers to a string? \$\endgroup\$
    – Jo King Mod
    Commented Dec 19, 2018 at 0:16
  • \$\begingroup\$ @lirtosiast [0], [200], [1,0.001,5]. What title do you suggest? Not using string methods does add something to the challenge. \$\endgroup\$ Commented Dec 19, 2018 at 0:47
  • \$\begingroup\$ @JoKing Not sure what you mean by a print function converting a number or list to a string? If JavaScript is used it means not using ``, '', String, template literal, RegExp.prototype.match(), etc. to create or convert the input to output or add, subtract, divide, multiply, manipulate arrays are what is meant, not print(output) or console.log(output). A user is not obligated to try for the bonus in their answer. \$\endgroup\$ Commented Dec 19, 2018 at 0:49
  • 1
    \$\begingroup\$ @guest271314 The challenge is not clear to me: why is 200 [200] but 100.01 [1,0,0,.01]? Maybe a worked-through example in the question as well as a reference implementation would help. For a title "Modified decimal expansion of a number" is a start. \$\endgroup\$
    – lirtosiast
    Commented Dec 19, 2018 at 0:57
  • \$\begingroup\$ @guest271314 Some languages have builtins for the digits of an integer or float e.g. Mathematica RealDigits[3.14159] = [{3,1,4,1,5,9},1] . Do those count as string methods? \$\endgroup\$
    – lirtosiast
    Commented Dec 19, 2018 at 0:59
  • \$\begingroup\$ @lirtosiast 200 does not contain a decimal, 100.01 contains a decimal. The reference implementation is at the question. Created the requirement from scratch while attempting to solve another inquiry. Does Mathematica have a method to check if a value is a string, integer or decimal? \$\endgroup\$ Commented Dec 19, 2018 at 1:03
  • \$\begingroup\$ I don't see any reference implementation. It might be better if you explicitly listed the rules behind the transformation \$\endgroup\$
    – Jo King Mod
    Commented Dec 19, 2018 at 1:05
  • \$\begingroup\$ @JoKing See "Test cases". That goes back to whether to post the question here or at Software Engineering. The question does not ask users to write an entire specification (frequently edited; maintained; an entire process in and of itself). Observing the test cases: when the first digit of a decimal is a 0 , and a digit follows, that value includes all 0's up to and including the last digit of that decimal, else the decimal portion is spread or expanded to the remainder of the decimal portion for the remainder of indexes of the array, that is: [-0.01], [1,0,0,0.01], [1,0,0,0.0001]. \$\endgroup\$ Commented Dec 19, 2018 at 1:09
  • 1
    \$\begingroup\$ Right, you should include those rules in the question, along with what happens when the input is an integer and/or ends in zero. I'm not sure what you'd achieve by posting on Software Engineering because I doubt any form of this question would be on-topic. \$\endgroup\$
    – Jo King Mod
    Commented Dec 19, 2018 at 1:22
  • 1
    \$\begingroup\$ Also, the specification should be given as a specification, not as a set of test cases to reverse-engineer. \$\endgroup\$ Commented Dec 19, 2018 at 9:42
  • 1
    \$\begingroup\$ "The specification ... is WIP." That's fine: that's what the sandbox is for. I'm trying to identify things which need addressing before the question leaves the sandbox. "A users' answer could redefine the specification, in a good way" This is completely against the ethos of this site. All users should implement the same specification, because otherwise it's not a fair contest. \$\endgroup\$ Commented Dec 19, 2018 at 14:56
  • 1
    \$\begingroup\$ I'm guessing he means move the specification from below the test cases to the task section and remove the Observing the test cases part. And perhaps make it a bit clearer, for example giving us the inputs that led to [-0.01], [1,0,0,0.01], [1,0,0,0.0001] rather than having them in isolation. \$\endgroup\$
    – Jo King Mod
    Commented Dec 20, 2018 at 5:36
  • 2
    \$\begingroup\$ Specifically? Nothing is clear to me. Try reading through the spec yourself without the test cases and forgetting that you already know in your head how everything should work - is it clear to you? As for a solution to making it clearer: start by having a look through the specs of recent, well-received challenges and note the detail they go into about what is expected of solutions and what is & isn't allowed. Then rewrite your own spec in a similar manner so there's no (or very little) room for doubt or confusion. (1/2) \$\endgroup\$
    – Shaggy
    Commented Dec 20, 2018 at 19:11
  • 1
    \$\begingroup\$ Ah, I didn't realise you'd deleted the bounty post. I think you misunderstood what I meant when I commented. I was just clarifying that if an answer were to be posted, the 500 rep would come from me, though you could add some rep if you wanted. There was no censorship of your post and I'm not sure why you deleted it. Typically on PPCG, we post the bounties after a valid answer has been posted, in order to make sure the rep doesn't go to waste, especially if the task is very hard or possibly impossible \$\endgroup\$
    – Jo King Mod
    Commented Feb 19, 2019 at 10:37
-3
\$\begingroup\$

Introduction

The original creator of this meme has gone blind, lost his internet and accidentally deleted all his memes. Except this one. He has this one last meme on his desktop, and since he can't see, he wants to know what this meme is.

By hearing it.

Challenge

Your challenge is to write the shortest program that will produce a playable audio file that the meme creator will play to hear the text in this meme.

  • The input is the meme below
  • The output will be a audio file that reads the output text in English and has a slight pause after a colon or a new line. But don't read out 'colon'

Answer the following questions for your readers.

  • You can use any programming language
  • You can use any existing library
  • Output audio must be playable by vlc
  • Networking is not allowed, you cannot connect to any internet services
  • Shortest answer wins

Input and Output

Input:

surprised pikachu eyesight

Output:

Me: spends 8 hours per day on the internet

Eyesight: gets worse

me:

\$\endgroup\$
2
  • 7
    \$\begingroup\$ The output would always be hardcoded, so there's no point in the input \$\endgroup\$
    – Jo King Mod
    Commented Mar 8, 2019 at 9:43
  • 1
    \$\begingroup\$ This challenge would be nice with different memes as test cases. Otherwise it would be hardcoded as said previously. \$\endgroup\$
    – Belhenix
    Commented Mar 20, 2019 at 19:35
-3
\$\begingroup\$

Compress briefly

Compress and decompress the first chapter of Worm, beginning with the opening words "Class ended" and ending with the closing words "my best friend." (including the period). You do not need to include any of the formatting (copy and paste as plain text).

Rules

  • You may not use any built-in or imported compression functions or procedures. You must implement the compression yourself.

  • You may either write one program to compress and another to decompress, or one program that does both. If you wish, the second option can be a polyglot, where compiling as one language compresses and compiling as the other decompresses.

  • Your program must be no more than 2000 bytes long. You may, at your option, compress your program with bzip2 or gzip before measuring its size for the purpose of meeting this limit.

  • Your program does not need to work for any other text.

  • Standard loopholes apply.

  • Standard I/O rules apply.

Scoring

  • The score is the sum of the total number of bytes of your program(s) and the total number of bytes in the compressed text.

  • If you use a single program to compress and decompress, then you may have to pay a penalty. Specifically, you must pay a number of bytes equal to the Levenshtein distance between the shell command needed to (compile and) run your compression program and the one needed to run your decompression program. You can calculate this online. A special exception: if you choose to write a polyglot, then you can leave out the paths to the compilers/interpreters when you calculate the penalty.

Tags: code-challenge, compression

\$\endgroup\$
9
  • \$\begingroup\$ Related \$\endgroup\$
    – Beefster
    Commented Mar 19, 2019 at 22:31
  • \$\begingroup\$ @Beefster, a bit, but I think there are enough differences to make competitive answers largely incompatible. \$\endgroup\$
    – dfeuer
    Commented Mar 19, 2019 at 22:36
  • 2
    \$\begingroup\$ I don't think any answers are going to outperform gzip/bzip/whatever. There's no obvious patterns to exploit in the text. \$\endgroup\$
    – Beefster
    Commented Mar 19, 2019 at 22:37
  • 2
    \$\begingroup\$ Also: how is this different from kolmogorov-complexity? \$\endgroup\$
    – Beefster
    Commented Mar 19, 2019 at 22:38
  • \$\begingroup\$ @Beefster, it's different because I don't allow the code to be big enough to have much chance of encoding the text in it. It doesn't have to outperform industrial-strength algorithms. That mention had to do with the source code size limit, intended to give extremely verbose languages the opportunity to participate. \$\endgroup\$
    – dfeuer
    Commented Mar 20, 2019 at 0:28
  • \$\begingroup\$ Every answer will be some variant of import gzip; gzip.compress(story) \$\endgroup\$
    – Beefster
    Commented Mar 20, 2019 at 16:21
  • \$\begingroup\$ @Beefster, is my explicit prohibition of that insufficient? My first rule is that you can't use a built-in or imported compression function. \$\endgroup\$
    – dfeuer
    Commented Mar 20, 2019 at 16:42
  • \$\begingroup\$ That sounds a lot more interesting than it actually is. There's a reason "do X without Y" questions have fallen out of favor. Compression challenges are hard to write. At the very least, you need some exploitable pattern common to a class of strings. This simply isn't the case in the linked text. \$\endgroup\$
    – Beefster
    Commented Mar 20, 2019 at 19:29
  • \$\begingroup\$ Even without using built-ins the best answer will use some variant of Huffman coding that fits in 2000 bytes. LZ77 is also pretty easy to implement and works well on text. \$\endgroup\$
    – Beefster
    Commented Mar 20, 2019 at 19:44
-3
\$\begingroup\$

Output an alphabet suite

A successor to the ŋarâþ crîþ alphabet challenge.

Outputting the alphabet song with as few letters as possible was too easy, but what about outputting many of them?

Your challenge is to write as many programs as you can, with no two programs sharing any Unicode codepoints, and each program outputting the names of the letters of the alphabet (or the glyphs of some other kind of phonetic script) used by a different language. For instance, one program can output

a bee cee dee e eff gee aitch i jay kay el em en o pee cue ar ess tee u vee double-u ex wye zed

and another program can output

a be ce de e efe ge hache i jota ka ele eme ene eñe o pe cu erre ese te u uve uve doble equis ye zeta

Notes:

  • For a given language, there will probably be some leeway in what you can output.
  • Unlike in the previous challenge, you don't need to worry about any particular punctuation. You should at least separate each letter name with whitespace.
  • You must output the names of the letters, not the letters themselves (so A B C... is invalid), unless the letters are literally pronounced so in the language in question.
  • If a language uses both capital and lowercase letters, then you may output the letter names in either case. If it uses only one of them, then you must output the alphabet in that case.
  • You must use a different language's alphabet for each program, but you are allowed to use the same script in the context of different languages.
  • Constructed languages are allowed, as long as they predate the challenge.
  • You may use different programming languages for each program. Or the same.
  • Standard loopholes are forbidden.

TODO:

  • is the requirement against sharing any codepoints too strict?
\$\endgroup\$
1
  • 2
    \$\begingroup\$ I haven't downvoted you, but suspect that the major reason that you're getting downvoted is that it's totally unclear what outputs are valid or not, and skimming the edges of that is where most of the byte savings are going to come from in a code-golf. That said, I don't think this is code golf, despite having the tag. You'll probably find that, when any golfing aspect is removed, the strings to print are more or less irrelevant, so you might as well use a fixed, objective set of strings instead of the ones you have. \$\endgroup\$ Commented May 13, 2019 at 16:24

You must log in to answer this question.

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