571
\$\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

4706 Answers 4706

-3
\$\begingroup\$

Do you trust this site?

title is a work in progress

This challenge is simple. Your program must take a URL (which will always exist) as input, download the file, and execute its contents as a program in the language your answer is in. The file will always be a valid program in your language.

Example

Language: Python
Input: https://gist.githubusercontent.com/GingerIndustries/d6f25007b45071e901b2b9057388d8f8/raw/25f838879fdc93f07394afc080eeef0993f55cbe/helloworld.py
Result: Program should print "Hello World!"
\$\endgroup\$
3
  • \$\begingroup\$ It'd probably benefit from more test cases; and how is it guaranteed that the webpage is a file? \$\endgroup\$ Commented Oct 12, 2022 at 12:17
  • 1
    \$\begingroup\$ @py3programmer All webpages are files. \$\endgroup\$
    – Ginger
    Commented Oct 12, 2022 at 15:25
  • \$\begingroup\$ As in, the URLs will have an extension in the end? \$\endgroup\$ Commented Oct 12, 2022 at 16:33
-3
\$\begingroup\$

This is a famous mathematical problem, Named as Bridges of Königsberg

Task

The bridges of Königsberg is a problem in mathematics which states that the path required for crossing each bridge exactly once without using a boat

Bridges of https://cdn.britannica.com/77/74877-050-F5DD4C34/Leonhard-Euler-route-each-question-bridges-Swiss.jpg

You have to find out if there is any path which uses each bridges exactly once without using a boat, if the time exceeds 36000 seconds or 10 hours the program should print no path found yet

Rules

Standard rules of fastest-code

Expected Output: Paths possible: [7, 2, 3, 1, 5, 6, 4], [2, 1, 7, 3, 4, 6, 5], etc.

This is fastest-code so the answer with shortest time is accepted, Even if the code will take a many days without a Quantum Computer

\$\endgroup\$
7
  • 1
    \$\begingroup\$ I'm really confused by the "programing languages starting from b" rule. What does it even mean? And what a extremely arbitrary restriction \$\endgroup\$
    – mousetail
    Commented Nov 29, 2022 at 14:55
  • \$\begingroup\$ Thanks, @mousetail I mean unofficial languages which is not included in the Wikipedia Article \$\endgroup\$
    – user115781
    Commented Nov 29, 2022 at 14:59
  • 1
    \$\begingroup\$ What does it mean for a language to be unofficial? See codegolf.meta.stackexchange.com/a/8058/91213 our guidelines for arbitrary restricting languages. \$\endgroup\$
    – mousetail
    Commented Nov 29, 2022 at 15:02
  • \$\begingroup\$ Thanks @mousetail, For the guidelines link \$\endgroup\$
    – user115781
    Commented Nov 29, 2022 at 15:26
  • \$\begingroup\$ This question isn't very specific. What exactly are we supposed to do? \$\endgroup\$
    – Ginger
    Commented Nov 29, 2022 at 18:09
  • \$\begingroup\$ Thanks, @Ginger, You have to find out if there is any path which uses each bridges exactly once without using a boat, if the time exceeds 36000 seconds or 10 hours the program should print no path found yet \$\endgroup\$
    – user115781
    Commented Nov 30, 2022 at 6:44
  • \$\begingroup\$ What is input and what is output? Without input, how can you prevent someone write a program which simply print "[7, 2, 3, 1, 5, 6, 4]"? \$\endgroup\$
    – tsh
    Commented Dec 15, 2022 at 7:21
-3
\$\begingroup\$

Take one of two distinct, consistent values of your choice. For one input, check if the input is prime. For another input, check if the input is a square.

Standard loophole apply except input complete or partial functions, which is replaced with

No input results in an infinite loop.

\$\endgroup\$
3
  • \$\begingroup\$ This challenge is pretty easy to solve in most languages, many have builtins for both parts \$\endgroup\$ Commented Jan 19, 2023 at 23:52
  • \$\begingroup\$ Why it get -3 vote and don't turn grey? \$\endgroup\$
    – l4m2
    Commented Jan 20, 2023 at 7:16
  • \$\begingroup\$ ok b/c grey is loaded earlier, and it later get vote \$\endgroup\$
    – l4m2
    Commented Jan 20, 2023 at 7:18
-3
\$\begingroup\$

Munge my Text

Inspired by this example in the Python documentation.

Write a program that takes as input a string of arbitrary length and returns a version of that string with every letter, except the first and last, of every word randomly shuffled. "Word" is defined here as a contiguous set of alphabetical characters separated by one or more spaces or punctuation marks (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~).

Examples

Input: Professor Abdolmalek, please report your absences promptly.
Possible output: Poefsrosr Aealmlobdk, pslaee reorpt your abnseces plmrptoy.

META TODO: Add more examples

This is , so shortest answer wins!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ dupe \$\endgroup\$
    – emanresu A
    Commented Feb 16, 2023 at 22:58
-3
\$\begingroup\$

Fibonacci before the zero - Dublicate of Negative Fibonacci Numbers

\$\endgroup\$
2
  • 3
    \$\begingroup\$ very closely related \$\endgroup\$
    – math scat
    Commented Feb 18, 2023 at 15:25
  • 1
    \$\begingroup\$ I would consider this a duplicate of the challenge @mathcat linked to. Although your version just says to output 50, this is basically just overwriting the default sequence rules \$\endgroup\$ Commented Feb 18, 2023 at 15:48
-3
\$\begingroup\$

See Those Sorts

Using shapes or Unicode, show how some array of numbers is sorted with a particular sorting method. You should include selection sort, merge sort, bubble sort, quick sort, bogo sort, and at least one other sort you find interesting (maybe try one of these).

Make sure that the speed of the sort corresponds to the actual performance on your computer. You can try adding a constant multiplier to the speed if you want.

Someone watched sort videos :)

\$\endgroup\$
1
  • \$\begingroup\$ Please note that popularity-contest challenges are not so well received any more. Read more here \$\endgroup\$
    – The Thonnu
    Commented Mar 3, 2023 at 18:21
-3
\$\begingroup\$

\$n\$ bottles of beer!

You want to recreate the song "99 Bottles of Beer", but you don't have 99 bottles!


Given an input non-negative integer \$n\$, output the lyrics to the song "99 Bottles of Beer" but starting from \$n\$ instead. For a few examples:

Input: 10

Output: 

10 bottles of beer on the wall,
10 bottles of beer.
Take one down, pass it around,
9 bottles of beer on the wall.

9 bottles of beer on the wall,
9 bottles of beer.
Take one down, pass it around,
8 bottles of beer on the wall.

8 bottles of beer on the wall,
8 bottles of beer.
Take one down, pass it around,
7 bottles of beer on the wall.

7 bottles of beer on the wall,
7 bottles of beer.
Take one down, pass it around,
6 bottles of beer on the wall.

6 bottles of beer on the wall,
6 bottles of beer.
Take one down, pass it around,
5 bottles of beer on the wall.

5 bottles of beer on the wall,
5 bottles of beer.
Take one down, pass it around,
4 bottles of beer on the wall.

4 bottles of beer on the wall,
4 bottles of beer.
Take one down, pass it around,
3 bottles of beer on the wall.

3 bottles of beer on the wall,
3 bottles of beer.
Take one down, pass it around,
2 bottles of beer on the wall.

2 bottles of beer on the wall,
2 bottles of beer.
Take one down, pass it around,
1 bottle of beer on the wall.

1 bottle of beer on the wall,
1 bottle of beer.
Take one down, pass it around,
0 bottles of beer on the wall.
Input: 1

Output:

1 bottle of beer on the wall,
1 bottle of beer.
Take one down, pass it around,
0 bottles of beer on the wall.

This is , so shortest answer wins!



Meta:

  • Any more tags?
  • Is this a duplicate?
  • Is the song formatted correctly in the example?
  • Any more test cases?
\$\endgroup\$
3
  • \$\begingroup\$ I think the “{n} bottles of beer on the wall. {n} bottles of beer.” should be “{n} bottles of beer on the wall, {n} bottles of beer.” with a comma. At the end of the song, it’s supposed to go “1 bottle of beer on the wall, one bottle of beer. Go to the store and buy some more, {n} bottles of beer on the wall.” Also, what is the expected output for n=1 ? \$\endgroup\$ Commented Jul 13, 2023 at 12:49
  • \$\begingroup\$ @noodleman fixed. In the original version, I don't think you go to the store for more. \$\endgroup\$ Commented Jul 13, 2023 at 15:03
  • \$\begingroup\$ Wikipedia cites several variations of the final lyric, but that’s how I’ve always sung it. Consider choosing one of those variations. (p.s. this challenge pretty trivial and is likely to be marked as a dupe of the regular 99 bottles of beer question, though I’m not one of the downvoters) \$\endgroup\$ Commented Jul 13, 2023 at 17:15
-3
\$\begingroup\$

Square decomposition

Inspired by silly ideas for answers to this CMC.


Given a perfect square, take the square root of it. NO NO NO NOT THAT CHALLENGE


Explanation

Given a square in Unicode art, output the characters that compose the square.

Rows are separated by newlines, so they cannot appear in the square. Therefore, contrary to I/O defaults, you cannot output leading or trailing whitespace unless it is in the square. You may also output in any order. Remember, this is , so shortest code wins!

Test cases

Input Unordered Output
aaa
aaa
aaa
a
1234
4567
7890
0123
1234567890
"
"
🟥🟨🟩
🟩🟥🟨
🟨🟩🟥
🟥🟨🟩




Meta

  • Is this a duplicate?
  • Is this clear enough?
  • Should I add more test cases?
  • Should I add or remove any tags?
  • Anything else?
\$\endgroup\$
9
  • \$\begingroup\$ So it's just printing the unique characters in a string? \$\endgroup\$
    – mousetail
    Commented Aug 26, 2023 at 18:46
  • \$\begingroup\$ @mousetail No, you must not print newlines. It is printing the unique elements that make up the square. \$\endgroup\$ Commented Aug 26, 2023 at 18:49
  • 1
    \$\begingroup\$ Yea so extremely trivial and not related to the title at all. Try to title your challenges what they actually are \$\endgroup\$
    – mousetail
    Commented Aug 26, 2023 at 18:54
  • \$\begingroup\$ @mousetail Square decomposition is not finding what makes a square!?! \$\endgroup\$ Commented Aug 27, 2023 at 7:59
  • \$\begingroup\$ Not at all, it's just removing duplicate items from a string \$\endgroup\$
    – mousetail
    Commented Aug 27, 2023 at 8:16
  • \$\begingroup\$ @mousetail which happen to be part of the square. Also, newlines may be part of the string, but you may not print them. \$\endgroup\$ Commented Aug 27, 2023 at 8:27
  • \$\begingroup\$ That doesn't make any difference for the challenge \$\endgroup\$
    – mousetail
    Commented Aug 27, 2023 at 8:31
  • \$\begingroup\$ while it is a funny idea and i do appreciate the title, it is a bit too trivial to have as a challenge, as currently posed. I think this could be improved if you actually had to find the exact string that was made to wrap to a square, like for example, abcb made into a 5x5 square becomes abcba\nbcbab\ncbabc\nbabcb\nabcba, and you have to somehow reverse that, maybe find the minimal string which could be turned into a square like that. Still might be seen as trivial to some but idk thats my suggestion :o \$\endgroup\$ Commented Aug 28, 2023 at 1:59
  • \$\begingroup\$ @thejonymyster that would be a separate challenge. \$\endgroup\$ Commented Aug 28, 2023 at 8:13
-3
\$\begingroup\$

Generic pop-con

This is a pop-con. The objective validity criterion is that all answers are valid. Answer with most upvotes after a week will win!

\$\endgroup\$
-4
\$\begingroup\$

Output the number of lines of your code

Your task is to write a program that counts the number of its lines of code and outputs them.

Specs:

  • The number mustn't be hardcoded into the program, nor in any other external resource;

  • Internet access is forbidden;

  • Your program's output must be the number of lines only;

  • Your program should not use any tool, macro, function, or similar device designed with the specific purpose of counting lines.

\$\endgroup\$
9
  • 2
    \$\begingroup\$ I don't see much of a challenge here. wc -l $0? \$\endgroup\$
    – ugoren
    Commented Feb 23, 2014 at 17:15
  • 1
    \$\begingroup\$ It can be a nice question, but needs some work. Just add something like "it should not use any tool, macro, function, or similar device designed with the specific purpose of counting lines". \$\endgroup\$ Commented Feb 24, 2014 at 2:10
  • \$\begingroup\$ @Victor Nice point, added. Thank you :) \$\endgroup\$
    – Vereos
    Commented Feb 24, 2014 at 10:10
  • 4
    \$\begingroup\$ As long as you can read the program file, it's no challenge. E.g. print len(l for l in sys.argv[0]). But if you forbid reading the source, and forbid hard-coding the length, what's left? \$\endgroup\$
    – ugoren
    Commented Feb 24, 2014 at 14:00
  • \$\begingroup\$ @ugoren I don't see where it says it can't read its source. \$\endgroup\$
    – user10766
    Commented Feb 27, 2014 at 22:13
  • 1
    \$\begingroup\$ @user2509848, It doesn't. This is why the question is easy and uninteresting. \$\endgroup\$
    – ugoren
    Commented Feb 28, 2014 at 5:56
  • \$\begingroup\$ @ugoren If you can't though, how will you tell, hardcode it? \$\endgroup\$
    – user10766
    Commented Feb 28, 2014 at 5:57
  • 1
    \$\begingroup\$ @user2509848, Either way, not a good question. \$\endgroup\$
    – ugoren
    Commented Feb 28, 2014 at 6:25
  • 2
    \$\begingroup\$ This is one byte in any golfing language with implicit output: 1 \$\endgroup\$
    – Nic
    Commented May 9, 2016 at 20:11
-4
\$\begingroup\$

Here is my first attempt at a cops and robbers post (which is why I'm using the sandbox).


Cops - Golfed recursion

You must select a language that satisfies the following criteria:

  • Functions - It must be possible to create a function with any number of integer input values and a single integer output (or return) value. The function may also be a complete program in itself. (Your language may not call it a function, but that is ok)
  • Arithmetic operations - The integer operations +-*/% should all be possible, either in a simple or a complicated manner.
  • Data - You should be able to store one-byte or two-byte long integers (either signed or unsigned will do). You may do this also in an indirect manner.
  • Iteration - You must be able to create a loop that will keep running until a condition is satisfied. Therefore < > = <= >= ! & | should also be supported, either directly or indirectly.
  • Recursion - You should be able to call a function from within the function itself with a set of input values calculated by the main function.
  • Declaration - You should be able to declare new integer variables as needed from within the function.

Task

You need to create a recursive function. Code will be scored by the number of characters in it, the shorter the better. A solved code cannot win the challenge. A post with less than 5 up-votes cannot win the challenge. There will be no overall winner, but a separate winner for each language.

Robbers - Golfed recursion

Your objective is to pick up a cop's post, and write a function in the same language but it should not use any recursion (can use iteration). The function may create any number of variables, loops, etc. but should be able to achieve the exact same end result (atleast, in theory) as the cop's one.

Your score will be the same as the cop's post's score at the time it was solved. His/her post is now invalid, and you get his/her score

\$\endgroup\$
2
  • 2
    \$\begingroup\$ I don't understand how a cop can write an answer that isn't going to be cracked, unless the language of choice can only loop via recursion (which I think you're trying to rule out by requiring that "iteration" must be possible). Also, requiring 5 votes to be a winner is only encouraging tactical voting. Answers that are actually invalid will likely get downvoted and deleted anyway. \$\endgroup\$ Commented Feb 10, 2016 at 12:36
  • \$\begingroup\$ @MartinBüttner Maybe in some languages it is possible by exploiting both closure and recursion, but I mainly agree with your point: recursion and iteration are two ways to do the same thing. \$\endgroup\$
    – Katenkyo
    Commented Feb 10, 2016 at 12:41
-4
\$\begingroup\$

Your task is to create a program that outputs a random pizza recipe following this one rule:

No random number choosers, you may have random text choosers. All standard code-golf rules apply. A sample output:

A simple PEPPARONI pizza sprinkled with fish and sausages. Your program must have the following items:

  • Anchovies
  • Fish
  • An adjective for the pizza

The program written with the shortest code wins.

Winner

The winner shall be picked on April 3rd, 12AM on the time zone GMT+3.

\$\endgroup\$
3
  • \$\begingroup\$ I already had an answer to the question, albeit non-competing: Python3 print("Have a plain MARGHERITA without any",["fish.","anchovies."][len(input("What's your favourite pizza? "))%2]) \$\endgroup\$
    – mIllIbyte
    Commented Mar 31, 2016 at 12:41
  • 5
    \$\begingroup\$ Uh, this has a lot of problems with clarity. First, all "random text choosers" are implemented with "random number choosers" which makes this restriction feel a bit bizarre. Second, what counts as an adjective for pizza? And since this is code golf, people will always pick the shortest available. And third, what should an output look like? It's not clear from the spec. Also, sort of unrelated, but usually putting a time limit is unnecessary, even extremely popular challenges stop getting responses with any frequency after a month or so. \$\endgroup\$ Commented Mar 31, 2016 at 12:59
  • \$\begingroup\$ Did you misspell it on purpose? \$\endgroup\$ Commented Mar 31, 2016 at 13:55
-4
\$\begingroup\$

What about one question on numeric solve?

Write one function that gets as one argument one function f(x), and one interval a..b and return the list of all element v such f(v)=0 in the interval a..b. In the interval a..b the f must be definite and can not be f(r) = +oo for r in a..b.

Win the one write the function with biggest set of right results. If two have the same set, win the one has less characters. You can not use solve() or nsolve() or fsolve() or one already written function that your sys offer that finds numerical x in f(x)=0

\$\endgroup\$
4
  • 2
    \$\begingroup\$ Finding all zeros of an arbitrary function is impossible unless the domain is restricted. \$\endgroup\$
    – user45941
    Commented Nov 29, 2016 at 8:59
  • \$\begingroup\$ Ok you are right \$\endgroup\$
    – user58988
    Commented Nov 30, 2016 at 10:04
  • 3
    \$\begingroup\$ The edit doesn't do anything to fix the problem. \$\endgroup\$ Commented Nov 30, 2016 at 14:48
  • 3
    \$\begingroup\$ The bigger problem is that this post is incomprehensible. \$\endgroup\$
    – user45941
    Commented Dec 2, 2016 at 8:54
-4
\$\begingroup\$

Beep. Boop. Maggot?

  1. Read input from STDIN until enter is pressed.
  2. If the input is "Beep", continue.
  3. Otherwise, print "Wrong!" and exit.
  4. Repeat steps one to three with "Boop" instead.
  5. Execute step one.
  6. If the input is "Maggot", output "Done".
    • Otherwise, output "Wrong.".

Remove punctuation (?.!'"), ignore capitalization (a-zA-Z only), and strip whitespace (\t and )

Notes: You must print the text word-for-word, character-for-character. Step 3 is Wrong!, while Step 6 is Wrong.

Hints

  • Notice how boop is just beep with the o's turned into e's.
  • There is lots of repetition here, but with many caveats.
\$\endgroup\$
1
  • \$\begingroup\$ Technically speaking, step 4 should repeat steps 1-3, shouldn't it? Anyway, apart from that, I don't see anything technically wrong with the challenge, but I'm not sure it's a very good challenge. \$\endgroup\$
    – user62131
    Commented Jan 1, 2017 at 0:07
-4
\$\begingroup\$

Score Your Language

I believe that each language has a score. The way you find the score of a language is shown in the ungolfed Python program below

def scorer(lang):

    num = 0

    for i in str(lang):
        num += ord(i)

    return num

Basically the score is the total of the unicode values of the language name.

Now this seemed like a fairly trivial challange, so I thought I'd make it a bit more difficult. You aren't allowed to use your language name (case-sensitive) in the code. So this code in C++ would be invalid as I've used C++ in the code.

#include <iostream>

int main() {

    int total = 0;
    std::string s("C++");

    for (char & c : s) {
        total = total + (int)c;
        c = '*';
    }

    std::cout << total;

}

Although this does output the required number (153) it is still invalid.

Rules

  • You aren't allowed to use the language name but are allowed to use it in a different case. E.g. Java isn't allowed but java is.
  • This is a code-golf so shortest answer in bytes wins
  • You are allowed to use hex/octal codes in strings e.g \150 can be used instead of h
  • Your program must take no input or function arguments
  • You cannot simply output the score. Theoretically the program should work for any language name when changed.
  • Languages where the only valid syntax is the name, such as Chicken are allowed to use said name.
  • Version shouldn't be included so Python is always Python not Python 2 or 3
  • The score is the value of the case-sensitive name

Correct Scores

Language              Score

ArnoldC                675
brainfuck              949
C                       67
C++                    153
Java                   386
Lua                    290
Mornington Crescent   1922
Python                 642
TrumpScript           1165
Vim                    300

Sandbox Questions

1) Why has this been downvoted?

2) I am thinking about putting a reputation limitation so that bosses like Dennis and Martin Büttner can't take answers from people who aren't as accomplished. Is this unfair? Should I not?

3) Is this a duplicate? I couldn't believe it wasn't already taken.

\$\endgroup\$
4
  • 4
    \$\begingroup\$ Terms like "you cannot use your language name" and "it must be calculated by the program" are not only unclear but will likely not be able to be made rigorous. \$\endgroup\$
    – Wheat Wizard Mod
    Commented Feb 5, 2017 at 14:58
  • \$\begingroup\$ Are you suggesting that I remove those rules? \$\endgroup\$
    – user63571
    Commented Feb 5, 2017 at 15:00
  • \$\begingroup\$ I don't think that the challenge is very interesting without the rules, but I don't think it is clear with them. I would suggest reworking the rules in some manner but exactly how I do not know. \$\endgroup\$
    – Wheat Wizard Mod
    Commented Feb 5, 2017 at 15:01
  • \$\begingroup\$ 1. I would guess that it's mainly because it fails some of the tests in Things to avoid when writing challenges (X without Y, asking for different things in different languages, unnecessary fluff, explicitly disadvantaging certain languages, arguably one or two more), although it might also in part be because some people oppose trivial "challenges", and in part because the problems WW mentioned can't be fixed. 2. Very bad idea. 3. It's a multi-dupe: it combines two trivial tasks, each of which independently would clearly be a duplicate. \$\endgroup\$ Commented Feb 6, 2017 at 9:15
-4
\$\begingroup\$

Popularly print the input

Goal

Write a program or function in a language of your choice that takes input and outputs that exact input.

Specifications

  • Your program/function should output the exact input in any reasonable way.
  • Your program does not have to end after printing the input. It may end up in an infinite loop if you wish, as long as that loop doesn't output any extraneous characters.

Winner

The winning answer will be the one that has the highest score. Voters should look for answers that use an unique way to print the input, have a special source code or use neat language features.

\$\endgroup\$
6
  • \$\begingroup\$ Plain "do X in a creative way" popularity contests have fallen out of favour and will likely immediately get closed as being too broad or not having an objective winning criterion. \$\endgroup\$ Commented Apr 4, 2017 at 18:33
  • \$\begingroup\$ @MartinEnder: Yeah, I noticed. How do you think I should change the challenge so that it won't be closed? \$\endgroup\$
    – Luke
    Commented Apr 4, 2017 at 18:35
  • 1
    \$\begingroup\$ Can't really help you there. If I knew of a good way to make popularity contests work, I'd write some myself. ;) \$\endgroup\$ Commented Apr 4, 2017 at 18:39
  • \$\begingroup\$ Probably a duplicate of codegolf.stackexchange.com/q/62230/34718 \$\endgroup\$
    – mbomb007
    Commented Apr 4, 2017 at 18:43
  • \$\begingroup\$ @mbomb007: No, this is not a code-golf challenge. \$\endgroup\$
    – Luke
    Commented Apr 4, 2017 at 18:54
  • \$\begingroup\$ But there's nothing separating the answers this might receive. Please read this: codegolf.stackexchange.com/tags/popularity-contest/info \$\endgroup\$
    – mbomb007
    Commented Apr 4, 2017 at 18:57
-4
\$\begingroup\$

Make a Login Screen

Challenge: make code that asks the user to enter a username and password. The username and password should be hard coded, but they must not be visible: you cannot have the entire username or the entire password in plain text in the code. Both the username and the password must be 8 characters long. Upon the incorrect username or password, some error should be displayed. It would be good if there are multiple "accounts" that would display different text on login. The password field should not be visible (Only asterisks or something).

This is Code-Golf, Shortest answer wins.

Standard loopholes are forbidden.

\$\endgroup\$
4
  • \$\begingroup\$ you can't say that answer doing something "would be good" if the shortest answer wins \$\endgroup\$ Commented Apr 18, 2017 at 7:05
  • \$\begingroup\$ underhanded challenges are off-topic. \$\endgroup\$ Commented Apr 18, 2017 at 8:36
  • \$\begingroup\$ It's not underhanded. \$\endgroup\$ Commented Apr 18, 2017 at 14:15
  • \$\begingroup\$ I'm sure this might be a dupe of an obfuscation challenge \$\endgroup\$
    – Beta Decay
    Commented Apr 18, 2017 at 23:36
-4
\$\begingroup\$

Of numbers of letters

there is something special the number 4. When spelled in English the word 'four' uses exactly 4 letters. I wonder whether there are further such numbers Your task is to identify whether there exist further such numbers and output them in any human readable format. To make this more of a challenge you can do the task in any regional Language of your choice (Say Russian or Portuguese or Spanish or Mandarin or Hindi etc.).

The Best entry will be selected by the most number of such numbers regardless of language used

Best of Luck

\$\endgroup\$
2
-4
\$\begingroup\$

No strings code bowling

I created this challenege idea with @redwolfprograms. In the challenge, you would create the longest program possible (code-bowling) it can do anything, but it cannot:

  • Contain any strings, or quotation marks/apostrophes/backticks
  • Contain the same alphanumeric byte more than twice
  • Conatin the same non alphanumeric byte more than three times
\$\endgroup\$
9
  • 2
    \$\begingroup\$ What is the task we have to solve? Is it really alphanumeric character but non alphanumeric byte? \$\endgroup\$
    – Dennis
    Commented Apr 17, 2018 at 13:50
  • \$\begingroup\$ Why do you mix characters and bytes? \$\endgroup\$
    – DELETE_ME
    Commented Apr 17, 2018 at 14:01
  • \$\begingroup\$ I feel like there are a lot of languages that would score the maximum (768) by not (strictly speaking) having alphanumeric characters, and then just wrapping everything in a string: "[3x each other byte value]"". \$\endgroup\$ Commented Apr 17, 2018 at 14:08
  • \$\begingroup\$ I think you got bytes and characters mixed up. Both should be bytes, and make sure you specify the program can do anything. \$\endgroup\$ Commented Apr 17, 2018 at 14:26
  • \$\begingroup\$ People, the point of the sandbox is to add suggestions. This question has been downvoted several times. Why? \$\endgroup\$ Commented Apr 17, 2018 at 22:39
  • 4
    \$\begingroup\$ @RedwolfPrograms downvotes are a way for people to say that this challenge in the current state shouldn't be posted to main. If the challenge gets changed enough to make it viable and interesting the downvotes will be reverted (or upvotes from other people will outweigh them). \$\endgroup\$
    – Leo
    Commented Apr 18, 2018 at 1:32
  • \$\begingroup\$ Maybe this challenge should have a "No strings" rule? \$\endgroup\$ Commented Apr 18, 2018 at 1:59
  • \$\begingroup\$ Not being able to use e is not really that much of a big deal. Even in C you can get around it easily. (It would prevent you from returning values from functions, but you could just use pass by reference instead.) So that restriction wouldn't really add much to the challenge. \$\endgroup\$
    – N. Virgo
    Commented Apr 18, 2018 at 8:35
  • \$\begingroup\$ Now that strings are forbidden, one could just create a huge variable whose name is all the alphanumeric characters twice. This is the bane of any longes code that... challenge. Consider adding some more interesting restrictions. \$\endgroup\$ Commented Apr 18, 2018 at 14:35
-4
\$\begingroup\$

[Posted, but reference kept]

Given a function with boolean inputs a1, ..., an and a boolean output, output an array of numbers 0 to n satisfying:

For each item in the truth value, if (from the array you output, we repeatedly remove two adjacent numbers x and y satisfying that, for each integer n between x+0.5 and y+0.5, an=1), we can get an empty result array iff the given function's output is 1. You can assume the result exist.

Sample input:

a[1] a[2] result
0    0    0
0    1    0
1    0    0
1    1    1

Sample output: 0 2

Sample input:

a[1] a[2] result
0    0    0
0    1    1
1    0    1
1    1    1

Sample output: 0 1 2 0 1 2

Sample input:

a[1] a[2] result
0    0    1
0    1    1
1    0    1
1    1    1

Sample output: (empty)

shortest code win, but optimizing running time and result length is encouraged(I won't accept but I may upvote)

You may check your answer here

\$\endgroup\$
2
  • 2
    \$\begingroup\$ The spec makes absolutely no sense to me. What does it mean to remove a number from a truth table? \$\endgroup\$ Commented Apr 25, 2018 at 12:13
  • 3
    \$\begingroup\$ Still makes no sense. Maybe if you give a detailed worked example I would be able to reverse engineer the spec and propose some changes to the wording. \$\endgroup\$ Commented Apr 25, 2018 at 14:59
-4
\$\begingroup\$

Write a function that takes compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.

Static visualization of bubble sort and a gif explanation.

Bubble sort explanation Bubble sort gif

The steps go from left to right. At each stage, an exchange is made. The darkest color has the most value and finds its final place (bottom) first.


The rules

  • The function must take a list of integers that shall be sorted (less than 20 elements)

  • The function must print each step of the sort.

  • Yes, built-in Bubble sort algorithms are permitted.

  • No, you can not assume only positive integers or unique integers.

  • It's so the shortest code wins!


Test cases

input list
5 4 3 1 2
1 2 3 5 4
11 4 2 1 5

Optional

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


Note

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

This is not a duplicate of Bubble sorting in progress.

Thanks to @Erik the Outgolfer for encouraging me to post my idea in the sandbox.

\$\endgroup\$
5
  • 3
    \$\begingroup\$ Can you add one walked-through example? I.e. show each pass. \$\endgroup\$
    – Adám
    Commented Jun 20, 2018 at 13:04
  • \$\begingroup\$ You note it isn't a duplicate of the in-progress bubble sort, but what distinguishes it from Golf me a bubble sort, which was closed as a dupe of that? \$\endgroup\$
    – Geobits
    Commented Jun 20, 2018 at 13:10
  • \$\begingroup\$ @Geobits This was not a dup but unclear. \$\endgroup\$
    – Didix
    Commented Jun 20, 2018 at 13:12
  • \$\begingroup\$ Here's my c# non-golfed solution : dotnetfiddle.net/ZFkl5y \$\endgroup\$
    – Didix
    Commented Jun 20, 2018 at 14:01
  • 7
    \$\begingroup\$ You claim it's not a duplicate of codegolf.stackexchange.com/q/92753 but you don't adduce any argument to support that claim, and I can't see any significant difference. (The upper limit is a trivial difference IMO). \$\endgroup\$ Commented Jun 21, 2018 at 6:14
-4
\$\begingroup\$

Once, I thought of this. Rules:

1: You must make a fractal that looks like the specified thing.

2: One thing per round.

3: Algorithms are rated by two scores: Resemblance and Compactness. The one that gets the highest scores wins!

4: Only I can tell what thing must be made.

5: Only one entry per user. Do not plagiarize.

6: One may code in anything they wish.

7: Have fun!

Round 1: Squidward's head!

\$\endgroup\$
10
  • \$\begingroup\$ Erchh! OK OK Remove the PM stufs. didnt know \$\endgroup\$
    – Ikura
    Commented Jul 31, 2018 at 0:12
  • 2
    \$\begingroup\$ On this site, winning criteria has to be objectively defined. (by tradition, I have to admit... there is popularity-contest (read the tag info page for more details), but if you really want to make a pop-con, be careful) "Resemblance" is quite... subjective, unless you can define an objective formula. Also, what is a fractal exactly? \$\endgroup\$
    – DELETE_ME
    Commented Jul 31, 2018 at 4:05
  • \$\begingroup\$ For example, how many points would I score if I just made the initial fractal look like the image and have it spiral inwards? What is the objective formula of Compactness/Resemblance \$\endgroup\$
    – Jo King Mod
    Commented Jul 31, 2018 at 6:04
  • \$\begingroup\$ A fractal is a shape that recurses. It has copies of itself in it. Analyze the Mandelbrot set, you'll see mandelbrots in mandelbrots. What is a pop-con? Sounds like a soda convention. I'd love to go there! JK \$\endgroup\$
    – Ikura
    Commented Jul 31, 2018 at 14:32
  • 1
    \$\begingroup\$ @user202729, experts are unable to agree on the definition of a fractal. That aside, this looks more like a forum game than a good fit for this site. \$\endgroup\$ Commented Jul 31, 2018 at 14:46
  • \$\begingroup\$ Oh, popularity? No. No voting. I will work on my formula, with a new parameter: Mandelbrottiness, which is more or less Goldilocks. \$\endgroup\$
    – Ikura
    Commented Jul 31, 2018 at 14:54
  • \$\begingroup\$ I attempted doing this on Encyclopedia Spongebobia, then went here. \$\endgroup\$
    – Ikura
    Commented Jul 31, 2018 at 14:55
  • \$\begingroup\$ Then maybe a Stack Exchange for off-topic? \$\endgroup\$
    – Ikura
    Commented Jul 31, 2018 at 14:57
  • \$\begingroup\$ @Ikura There are no such SE site, because it would generate low-quality content. Try Quora or Reddit... \$\endgroup\$
    – DELETE_ME
    Commented Jul 31, 2018 at 15:15
  • \$\begingroup\$ Ergo! Goin' to the Kongregate Off-topic forum! \$\endgroup\$
    – Ikura
    Commented Jul 31, 2018 at 18:48
-4
\$\begingroup\$

This question is a simplified description of the requirement described at Permutations to the nines


Given input integer (minimum) where the first digit is always 1 and the adjacent digits are increasing in value, e.g.,

12

123

1234

12345

with the ability to handle up to the integer

123456789

where the maximum integer is always the input integer in reverse order, e.g.,

21

321

4321

54321

987654321

Task

Return a list (array) of each number between the input minimum and maximum integer which satisfies three conditions

  1. the resulting integer list item includes only the individual numbers comprising the input number
  2. the resulting integer list item does not contain any duplicate individual digits
  3. the resulting integer list item is greater than the preceding integer list item and not greater than a following integer in the list

Test cases

Valid list items

12 -> [21] // done

123 -> [132,213,231,213,312,321] // done

Invalid list items

12345 -> 12344 // contains duplicate digits in whole number

123456789 -> 13256789 // not the next integer by increasing numeric value order

123456789 -> 987654322 // greater than maximum integer and duplicate digits

Winning criteria

The algorithm which uses the least amount of operations to compute the complete resulting list of items.

Examples

123 -> 123+5+4=132 // two mathematical computations

123 -> 123+9=132 // one mathematical computation (winning criteria)

(@JoKing suggested fastest-algorithm tag; math and code-challenge tags are also applicable)

\$\endgroup\$
28
  • \$\begingroup\$ @PeterTaylor Pared down version of the original question. \$\endgroup\$ Commented Oct 8, 2018 at 18:30
  • \$\begingroup\$ Am not as yet well-versed in Big-O notation. If the phrase "the least amount of operations to compute the complete resulting list of items" can be translated into Big-O notation, kindly suggest and edit the language used in the question. We are not interested in code length (this is not a code-golf question), but rather, that the code produces the expected result in the fewest, or least amount of total computational operations. \$\endgroup\$ Commented Oct 8, 2018 at 18:35
  • \$\begingroup\$ Ok, so if I understand the challenge, you give me a number N. I need to generate a list of numbers between N and M, where M = reverse(N). Each number in the list cannot have duplicate digits, can only consist of digits in N, and must be in strictly increasing order. Is this correct? \$\endgroup\$ Commented Oct 8, 2018 at 18:52
  • \$\begingroup\$ Assuming my above comment is correct: 1. Why is 123456789 -> 13256789 invalid, as the maximum is 987654321, which is bigger than 13256789? 2. You need a list of all possible operations. 3. Use the word digit when referring to the individual parts of a number. \$\endgroup\$ Commented Oct 8, 2018 at 18:57
  • \$\begingroup\$ @NathanMerrill Yes. Originally included using only the number 9 within the prerequisite criteria, though that inclusion appears to be challenging in itself to explain how the single number 9 can be employed to derive all list items. You are correct about 123456789 -> 13256789 being invalid. Was attempting to include invalid examples and to indicate that 13256789 should not be the next integer in the list following 123456789; the list should be in order from least to greatest integers. Ok, will use the term digit. \$\endgroup\$ Commented Oct 8, 2018 at 18:57
  • \$\begingroup\$ Thinking about this more, there's a really simplified way to describe this: You want the all permutations of the digits of N in strictly increasing order. Permutation \$\endgroup\$ Commented Oct 8, 2018 at 19:09
  • \$\begingroup\$ @NathanMerrill Yes, that is one way to put it. From perspective here, we are trying to use a number - the indexes of the initial input as a whole number - to generate all lexicographic permutations by using only math and the initial number (the current number) to do so. No loops, swaps, recursion, etc. Which am able to achieve using the code at the linked question, though the approach used there adds 9 to the initial (current) number. The challenge is to reduce the mathematical operations necessary to achieve the result - is at all possible. \$\endgroup\$ Commented Oct 8, 2018 at 19:12
  • \$\begingroup\$ I think describing it that way will make this challenge much clearer. Also, to be a fastest-algorithm, you really need to list all possible operations. \$\endgroup\$ Commented Oct 8, 2018 at 19:13
  • \$\begingroup\$ @NathanMerrill "I think describing it that way will make this challenge much clearer." Well, did that exhaustively in the linked question - with links to OEIS and previous inquiries which lead to here PPCG for context - which was closed due to "unclear what you are asking" votes codegolf.stackexchange.com/q/173145/31257, codegolf.meta.stackexchange.com/questions/16959. Posted this version of the question as users appear to not gather the original, more detailed question. Is this question codegolf.meta.stackexchange.com/a/16961/31257 clear to you? \$\endgroup\$ Commented Oct 8, 2018 at 19:15
  • \$\begingroup\$ No. That question is much too long. I don't think it is the word "Permutation" killing you there, it's everything else. \$\endgroup\$ Commented Oct 8, 2018 at 19:21
  • \$\begingroup\$ @NathanMerrill Well, here we are back to square 1. "too long" is a subjective measurement, though have been advised that users actually do have some means to time the "read" of a question, which will more than likely never do, here. This question is the bare minimum, and yet you suggest including more details. Cannot glean every individual users' idea about what is "too long" or does not include enough details. Perhaps somewhere in the middle that am as yet unable to reach. If a user takes the time to read the original question without protesting the length thereof - the details are there. \$\endgroup\$ Commented Oct 8, 2018 at 19:25
  • \$\begingroup\$ @NathanMerrill What edits to the original question or this question do you suggest? \$\endgroup\$ Commented Oct 8, 2018 at 19:26
  • \$\begingroup\$ All of the close reasons are subjective: "Unclear" is subjective, "Off-topic" is subjective, etc. I can give a full analysis of the other post, but I'd rather focus on this one. My first suggestion is to get rid of most of the requirements in favor of all permutations of the digits of N in strictly increasing order. The second thing you need to do is define what "operation" means. \$\endgroup\$ Commented Oct 8, 2018 at 19:28
  • 1
    \$\begingroup\$ "The requirement is to add, subtract, divide, multiply, or use other mathematical procedure, the number 9 to the current number to generate the next number" is (a) not anywhere that I can see in the text of the requirements; and (b) an non-observable requirement, as described in the link I posted of things to avoid when asking questions. \$\endgroup\$ Commented Oct 11, 2018 at 7:16
  • 1
    \$\begingroup\$ A requirement is only observable if you can verify it given a black box implementation, so I don't see how any code snippet can demonstrate that it is observable unless it's a test framework which verifies it by black-box testing. \$\endgroup\$ Commented Oct 11, 2018 at 7:30
-4
\$\begingroup\$

All numeric substrings

I like numbers. Really, really, like numbers. If you give me a string with numerals in it, I want to get all the numbers out of it that I can.

Input:

A string.

Output:

Every numeric substring, in any order, but only one of each. Numeric here means anything with Unicode General Category Nd (because I'm no xenophobe).

I/O

Any reasonable format. But languages that don't allow for multibyte-character I/O should use some numeric or other representation.

Test cases

(input → one ordering of the correct output)

  • 1212 → [1212, 121, 212, 12, 21, 1, 2]
  • 123٤٥6 ‪→ [1, 2, 3, ٤,‪ ٥, 6, 12, 23, 3٤,‪ ٤٥,‪ ٥6,‪ 123, 23٤,‪ 3٤٥,‪ ٤٥6,‪ 123٤,‪ 23٤٥,‪ 3٤٥6,‪ 123٤٥,‪ 23٤٥6,‪ 123٤٥6]‪
  • 12t45 → [1, 2, 4, 5, 12, 45]
  • abc → []
\$\endgroup\$
2
  • \$\begingroup\$ @JoKing, thanks, done. \$\endgroup\$
    – msh210
    Commented Feb 27, 2019 at 5:35
  • \$\begingroup\$ I am not convinced by this challenge. To me, it essentially boils down to filtering a unicode string on a character-by-character level, followed by generating all substrings of non-split substrings of the original string. Is ‪٥6 supposed to have any semantic meaning or are those simply two unicode characters? \$\endgroup\$ Commented Mar 2, 2019 at 4:36
-4
\$\begingroup\$

Fastest prime printer up to 500,000,000 with gapes


Write a program that takes no input and prints the first 26,355,867 prime numbers, from 2 to 499,999,993 inclusively. Or in other words, print all the prime numbers smaller the 500,000,000.

The fastest code wins!

Since it will take a long time to print all the numbers, print only every 26355 primes starting with 2 separated by a new line. So the output should look like this:

2
304417
648391
1007681
1376449
1752323
2133689
2520983
2910797
3304633
3702269

The output should not be hardcoded, or there is no fun in it.

The results will be tested on my machine, so please also output in the last line how long it took to run the program and give me some instructions about how to run it locally. I will then share the last line output with you that should contain the time it took to run.

Here is my machine system specs, note that it's Windows.

enter image description here

\$\endgroup\$
14
  • 4
    \$\begingroup\$ Can be trivially hard coded. \$\endgroup\$
    – DELETE_ME
    Commented Aug 4, 2020 at 2:06
  • 1
    \$\begingroup\$ Also it's going to be nearly instantaneous, and might be duplicate of some existing (not sure about this part) \$\endgroup\$
    – DELETE_ME
    Commented Aug 4, 2020 at 2:07
  • \$\begingroup\$ tnx @user202729, I edited the question \$\endgroup\$ Commented Aug 4, 2020 at 2:17
  • 1
    \$\begingroup\$ A [kolmogorov-complexity] challenge won't work as [fastest-code]. The fastest solution will be a huge puts in C or C++. "The output should not be hardcoded" is not objective (for example, what stops me from storing 2p for each prime in the output?). \$\endgroup\$ Commented Aug 4, 2020 at 2:46
  • \$\begingroup\$ @mypronounismonicareinstate how about asking for the code size to be smaller than the output size? So such methods would not be possible? \$\endgroup\$ Commented Aug 4, 2020 at 2:54
  • 1
    \$\begingroup\$ @IlyaGazman okay, then I can do something like that but with the numbers stored in binary, or computed at compilation time. \$\endgroup\$ Commented Aug 4, 2020 at 2:58
  • \$\begingroup\$ Ok, how about that I ask your program or a library your program is using to have a code that checks for prime numbers? Something like: "You program can only print numbers that it tested to be primes" \$\endgroup\$ Commented Aug 4, 2020 at 3:15
  • 1
    \$\begingroup\$ Okay, then my program can also run a primality test on them before printing. I also wonder if the sieve of Eratosthenes counts. This requirement is unobservable. \$\endgroup\$ Commented Aug 4, 2020 at 5:11
  • \$\begingroup\$ Is the idea of doing every k'th prime that programs would otherwise be limited on time printing for all the primes rather than computing them? \$\endgroup\$
    – xnor
    Commented Aug 4, 2020 at 8:02
  • \$\begingroup\$ @xnor printing 26 million primes take a ridiculously long time \$\endgroup\$ Commented Aug 4, 2020 at 10:36
  • \$\begingroup\$ Another issue is that the run time is so fast (the C++ sieve answer (I think) takes only less than a second to run) that it's going to be hard to accurately measure the runtime. \$\endgroup\$
    – DELETE_ME
    Commented Aug 4, 2020 at 13:37
  • \$\begingroup\$ @user202729 that I would like to see! I bet you can't get it run below 2 seconds \$\endgroup\$ Commented Aug 4, 2020 at 17:50
  • \$\begingroup\$ This is essentially a duplicate of your earlier challenge, with the rather trivial modification of introducing gaps. As for your sense of how long it takes to print 26 million primes, you are mistaken. My submission on your earlier challenge printed all 26 million of them in under a minute on my laptop. The (now-deleted) C++ answer was even faster. \$\endgroup\$
    – Dingus
    Commented Aug 5, 2020 at 1:28
  • \$\begingroup\$ This is heavily downvoted and will require a great deal of work and specification to get to a point where it'd be considered on-topic on main. Furthermore, as other users have pointed out, this appears to be a duplicate of an existing challenge. If you don't intend to post this, would you mind editing this post down and deleting it in order to save space? \$\endgroup\$ Commented Sep 25, 2020 at 0:47
-4
\$\begingroup\$

Mystery Numbers Challenge

Here are some sample inputs and outputs:

IO

Test 1

Input: 102
Output: 10404 1061208 14002414191924244276669361796022272

Test 2

Input: 10
Output: 100 100000

Test 3

Input: 50
Output: 2500 312500000 312500000

BONUS

If there are two inputs, here are the corresponding inputs and outputs:

Test B1

Input:

50
12

Output: 144 248832 248832

Test B1

Input:

2310
9

Output: 81 729 59049 4782969 31381059609

Notes

If you pass all bonuses too, feel free to third your score. Also add a * to the end.

\$\endgroup\$
6
  • \$\begingroup\$ Maybe you should add kolmogorov-complexity, as if you don't explain how those outputs are generated you need to find the shortest way to generate these. Also how does the program need to preform on stuff not defined? \$\endgroup\$ Commented Dec 31, 2020 at 17:10
  • \$\begingroup\$ This seems not to be a serious submission but if it is, 'I'm not outlining what the program should do' is problematic. How does one write any program without an outline of what it should do? \$\endgroup\$
    – Dingus
    Commented Dec 31, 2020 at 22:35
  • \$\begingroup\$ @Dingus There are sample inputs and outputs. \$\endgroup\$
    – Someone
    Commented Jan 1, 2021 at 20:09
  • 1
    \$\begingroup\$ Questions involving hidden patterns and bonuses are discouraged here. If there's no hidden pattern and these are just random outputs, then the challenge is just compressing those output numbers and using the input as an index, which isn't very interesting. \$\endgroup\$ Commented Jan 1, 2021 at 20:49
  • \$\begingroup\$ @Someone Yes, I can see that. What should the code do for inputs of 1, -123456.789, or abcdefg? \$\endgroup\$
    – Dingus
    Commented Jan 1, 2021 at 22:32
  • \$\begingroup\$ Some kind of non-array-like output that indicates an error. I haven't thought of that. (Also, this is my first ever question, so it's likely garbage.) \$\endgroup\$
    – Someone
    Commented Jan 2, 2021 at 18:44
-4
\$\begingroup\$

Is it a Homestuck handle?

In the interactive webcomic Homestuck, the in-universe chat clients require users to have chat handles. These handles always consist of two words in camelCase. The heroes in the story almost all have handles where both words start with a DNA base (A, C, T, or G), with one exception.

A chart of homestuck hero chat handles (Taken from https://mspaintadventures.fandom.com/wiki/Handle)

Your challenge is, given a string (or list of characters), determine if it's one of the heroes' handles -- in other words, if it's in the set {gardenGnostic, gallowsCalibrator, grimAuxiliatrix, ghostyTrickster, ectoBiologist, gutsyGumshoe, golgothasTerror, carcinoGeneticist, cuttlefishCuller, caligulasAquarium, centaursTesticle, arachnidsGrip, arsenicCatnip, apocalypseArisen, adiosToreador, turntechGodhead, terminallyCapricious, twinArmageddons, tentacleTherapist, tipsyGnostalgic, timaeusTestified}. You can output any two distinct values for "yes" and "no".

Standard loopholes are forbidden. The shortest code wins.

Questions

I actually don't know anything about Homestuck, so I probably messed something up in the question.

\$\endgroup\$
-4
\$\begingroup\$

Write a proper quine.

Community decided that you're not allowed to claim you're not reading source code but data, and read a stored string.

To be consistent, reading a stored infinite precision number is also not allowed. (should this, or only apply to highbase?)

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Almost certain this is a duplicate of codegolf.stackexchange.com/questions/69/… \$\endgroup\$ Commented Jan 7, 2023 at 16:37
  • \$\begingroup\$ @Jacob They're all improper quine under this definition \$\endgroup\$
    – l4m2
    Commented Jan 9, 2023 at 22:12
  • \$\begingroup\$ Are this and this improper quines? (It doesn't push the visible constant as a number. Each digit multiples the current number by 10 and adds itself.) Or this? (The first i changes the mode to "insert mode", and each character inserts itself to the buffer in insert mode.) Or this? (Same argument as V quine applies, and every character is run as code as well) \$\endgroup\$
    – Bubbler
    Commented Jan 19, 2023 at 6:40
  • \$\begingroup\$ Also there are already quines in languages like 1+ where string is not a thing and the only number literal is 1. \$\endgroup\$
    – Bubbler
    Commented Jan 19, 2023 at 6:44
-4
\$\begingroup\$

You're a programming language, right?

According to CGCC, for something to be considered a programming language, it must be capable of addition and primality testing. This challenge combines them into one.

Challenge

You must write a programme that takes 2 natural numbers (including 0) as input, checks if the sum of the numbers is prime, and prints the result. Input and output may be in any reasonable format.

Testcases:

2,3 -> True
3,6 -> False
0,1 -> False (1 is not prime by definition)
7,6 -> True
37,81 -> False
37,82 -> False
1,1 -> True
5,8 -> True

Note that True and False can be substituted with another reasonable representation, like 1 and 0, or T and F. Remember, this is , so standard rules apply.

\$\endgroup\$
5
-5
\$\begingroup\$

Your challenge is to write a small compiler/interpreter to a small language. This language can be of any level. Example: brainf*ck or Turing.

Example submission:

languageName : “name” 
GitHub : “https/GitHub.com/Lang”

a language is valid if it contains the folowing systems:

1: varibles of any type
2: a method of declaring and using functions
3: definable parameters
4: a update loop
5: loops
6: classes(optinal)

a compiler/interperater is valid if it can:

1: run/compile code
2: is fast (less than a minute to compile/initialize)
3: give error messages(optional)
4: written in java

The smallest compiler/interpreter wins

please tell me how i can fix this post if you intend on downvoting it in the comments

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Literally none of the requirements you've listed are observable or are formally specified. I would recommend reading through this thread. \$\endgroup\$
    – hyper-neutrino Mod
    Commented Jul 15, 2021 at 2:50
  • \$\begingroup\$ @2 - I would recommend you to specify the language in the challenge. Here, in code golf, we always have a criteria (like code-golf (shortest code)). If you don't specify the language, some small languages like HQ9+ will take less bytes to make, but other small languages like chicken will take more bytes to make. Take your time reading the existing challenges and good luck on your second idea! \$\endgroup\$
    – math scat
    Commented Jul 15, 2021 at 8:05
  • 1
    \$\begingroup\$ Welcome to Code Golf, and thanks for using the Sandbox! I'm going to be honest: I don't think you can fix this challenge idea. That's not a bad thing, some ideas just don't work well with our format. I'd be happy to elaborate more on the issues I see with this if you'd like me to, but overall, this is just far too broad to work. Many languages don't have any of the listed points (for example, brainfuck only has 5, and maybe 4), and the listed points seem very arbitrary \$\endgroup\$ Commented Jul 15, 2021 at 19:41

You must log in to answer this question.

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