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

4705 Answers 4705

1
153 154 155 156
157
-5
\$\begingroup\$

Prime strings

Your task is to find the string consisting of all the words in the give input whose lengths are prime numbers

Test cases:

The quick brown fox jumps over the lazy dog.
->
The quick brown fox jumps the
Omicron Effect: Foreign Flights Won't Resume On Dec 15, Decision Later.
->
Omicron Effect: Foreign Flights Won't On Dec 15,

You may assume that only ascii characters are allowed and that uppercase, lower case, punctuation, and spaces are allowed in the input and output

You may assume that the words whose lengths are prime numbers do not include spaces

\$\endgroup\$
1
  • \$\begingroup\$ Is essentially equivalent to finding the prime numbers in a list of integers which is essentially equivalent to running a few primality tests. \$\endgroup\$
    – ophact
    Commented Jan 31, 2022 at 12:33
-5
\$\begingroup\$

Outgolf me with the custom scoring

Cops:

You post two codes, a code is that you wanted to do, another is used to size the code.

Rules

Example:

# [Python 3](https://docs.python.org/3/), score 21 

# Code

    print("""s""")

# Sizer

    print(len(input())/2)

Scoring (Cops)

\$s + \lfloor\frac{(m)}3\rfloor\$

Where \$s\$ is the size of actual code and \$m\$ is the size of code used for sizing the code.

The lowest Score of uncracked Cop wins

Robbers

Your task is to find code, If the code size is less than the Cop's code, Then Post an answer That cracks the Cop's answer.

Rules

Example:

# [Python 3](https://docs.python.org/3/), [Cracks username Cop](https://codegolf.stackexchange.com/questions), 2 score saved

    print("s")

The Poster with most cracks wins

Meta

  • Any feedback?
\$\endgroup\$
2
  • \$\begingroup\$ Do you mean make a program that does whatever (how is whatever defined?) and another that scores it? \$\endgroup\$ Commented Feb 13, 2022 at 23:15
  • \$\begingroup\$ @BgilMidol Yes, This is what I mean, Robbers must outgolf. \$\endgroup\$
    – Fmbalbuena
    Commented Feb 13, 2022 at 23:18
-5
\$\begingroup\$

Draw a Test tube

Given the level of liquid in the test tube L in the range 0-8. Your program should draw the following ASCII art.

When L=0:

@@@@@@@@
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
  @@@@

When L=1:

@@@@@@@@
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @++++@
 @++++@
  @@@@

When L=2:

@@@@@@@@
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @    @
 @++++@
 @++++@
 @++++@
 @++++@
  @@@@

And etc. You can change the characters @ and + to any others (except spaces), it's up to you. Trailing spaces are allowed.

This is a code-golf challenge so the shortest solution wins.

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

Generate a random string of length 8

The challenge is pretty simple. Generate a random (non-zero chance) string of length 8, using ASCII characters from 33-126 (! to ~). (1-32 and aren't included because they don't show up/may cause interference.)
Remember that this is , so shortest answer wins!

Rules

  • All standard rules apply
  • All characters must be in one continuous string, so no line breaks, spaces, etc.

Example code

import random
i=8
j=""
while i!=0:
    j+=(chr(random.randint(33,127)))
    i-=1
print(j)

Try it online!

Tags

\$\endgroup\$
7
  • \$\begingroup\$ I'm guessing by "characters from 33-254 are allowed" you mean only those characters. The way it's worded currently it sounds like you might allow answers to output a subset of those \$\endgroup\$
    – pxeger
    Commented Mar 18, 2022 at 16:43
  • \$\begingroup\$ Please specify what you mean by "random": do you mean (A): all possible outputs must have an equal chance of being output (so uniformly random)? (B): all possible outputs must have a non-zero chance of being output? or (C): something else? Personally I would suggest going with B. \$\endgroup\$
    – pxeger
    Commented Mar 18, 2022 at 16:46
  • \$\begingroup\$ ASCII only goes up to 128. Did you mean "all ASCII characters from 33-127", instead of 255? \$\endgroup\$
    – pxeger
    Commented Mar 18, 2022 at 16:46
  • \$\begingroup\$ @pxeger 1. yes, only those, 2. I was thinking more of option A but B works, 3. Yeah i meant that \$\endgroup\$ Commented Mar 18, 2022 at 16:49
  • \$\begingroup\$ @pxeger I have gone with option letter B for randomness. \$\endgroup\$ Commented Mar 18, 2022 at 18:32
  • \$\begingroup\$ ~ (the last printable ASCII value) is 126, not 127. \$\endgroup\$
    – Nitrodon
    Commented Mar 21, 2022 at 21:35
  • \$\begingroup\$ @Nitrodon fixed. Man i really need to get better at this stuff \$\endgroup\$ Commented Mar 21, 2022 at 21:46
-5
\$\begingroup\$

Longest code to output "Hello World"

Rules

  1. The program should take no input, and only print Hello!, World? to STDOUT with exact same capitalization and punctuation and in single line. Trailing whitespaces and newlines are allowed.
  2. The output should not be in the form of error message
  3. The accepted answer will be the 'most points' answer but try to be as creative as possible

Point System

  1. +1 for each character of code in your program, eg:print("Hello World") is 20
  2. -1 for each repeated character(case sensitive, i.e. 'h' is not same as 'H'), eg:print("Hello World") is 20-1(o)-2(l) = 17
\$\endgroup\$
8
  • \$\begingroup\$ "Most creative" is subjective. \$\endgroup\$ Commented Mar 24, 2022 at 17:56
  • \$\begingroup\$ It's trivial to get an arbitrarily high score. Just increment a number a couple billion times, then use some one-line function to turn that number into a string. if any of the incrementing lines are removed, the string is different, so they're "contributing". \$\endgroup\$ Commented Mar 24, 2022 at 18:00
  • \$\begingroup\$ Also, just putting it all on one really long line would trivially defeat your requirement that all lines 'contribute". \$\endgroup\$ Commented Mar 24, 2022 at 18:01
  • \$\begingroup\$ @RadvylfPrograms I hope the second point in scoring system can help discourage repetitive assignment of number, let's say n+=123, 'n','+','=' must be repeated a billion times and on top of that only 1-9 are present to choose to increment(basic case) \$\endgroup\$
    – Saphereye
    Commented Mar 24, 2022 at 18:05
  • \$\begingroup\$ What, +1 is based on bytes and -1 is based on characters? Then I can get arbitrarily high score by repeating multibyte characters, right? \$\endgroup\$
    – Bubbler
    Commented Mar 24, 2022 at 23:03
  • \$\begingroup\$ @Bubbler I was perhaps used the wrong wordings. I used bytes and character interchageably. I meant for every character in your code you get +1 and for every repeated character you get -1 \$\endgroup\$
    – Saphereye
    Commented Mar 25, 2022 at 3:05
  • \$\begingroup\$ But still, it is equivalent to counting unique characters (like, if you have a 10 times, you add 1 ten times and then subtract 1 nine times, giving a +1), so it is very easy to get perfect score: use all 1114111 Unicode codepoints in the source code. And then the challenge becomes extremely boring. \$\endgroup\$
    – Bubbler
    Commented Mar 25, 2022 at 3:22
  • \$\begingroup\$ Also, why does it say the string is "Hello!, World?" at the top but "Hello World" further down? Wouldn't it be better just to use the normal "Hello, World!"? \$\endgroup\$
    – Lecdi
    Commented Mar 27, 2022 at 11:23
-5
\$\begingroup\$

Calculate the day of the week from a given date without using built-in functions that do so. For example C#'s DateTime.DayOfWeek is not allowed. Anything along the lines of DateTime.Year.IsLeapYear or DateTime.Month.TotalDaysInThatMonth (pseudocode) is also disallowed. Anything other built-in functionality for getting the number of days in a month or year is disallowed. You have to build that functionality yourself.

Input: a 1 dimentional array of integers with length 3. The array has the the form {year, month, day}
Output: A string such as "Monday", "Tuesday", etc. Case insensitive.

This is code gold so the shortest answer wins!

Test Cases:

Input Output
{1000, 3, 31} "Monday"
{1969, 4, 20} "Sunday"
{1980, 2, 29} "Friday"
{1979, 2, 29} empty string, or null or throws an error. (This date does not exist)
\$\endgroup\$
2
  • \$\begingroup\$ Why so many downvotes, you may ask? Do X without Y challenges are generally discouraged. \$\endgroup\$
    – pajonk
    Commented Apr 1, 2022 at 4:59
  • \$\begingroup\$ @pajonk Gotcha, thanks. This is why I posted to the sandbox \$\endgroup\$
    – Nigel
    Commented Apr 1, 2022 at 17:44
-5
\$\begingroup\$

Is the UTF-1 string shorter than its UTF-8?

Backgrounds

  • explain utf-1 and utf-8

Problem

Given a Unicode string, output a two distinct truthy or falsey value to represent whether its representation in UTF-1 is shorter than that in UTF-8.

I/O restriction

Input can be list of code point for each letter or string with consistent encoding except UTF-1. Output can be as in decision problem rule.

todo rules

todo test cases

  • Falsey for any string with nothing other than c such that U+0000<=c<=U+007F
\$\endgroup\$
-5
\$\begingroup\$

Output a googol

Your challenge today is to output this exact number:

10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

We call this a googol. A googol is 1 followed by a 100 zeroes, or basically just \$10^{100} \$. However most programs wouldn't be able to do a simple print(10**100) because it will take forever to do so. And sometimes it might end up with an OverflowError, so you'll have to be creative.

Input:

None.

Output:

The googol. However, if your language will not be able to store \$ 10^{100} \$, you'll have to find some way of printing it, maybe by string manipulation (the shortest I got was print('1'+'0'*100))

This is , so shortest answer wins!

\$\endgroup\$
7
  • 3
    \$\begingroup\$ This challenge is trivial and boring. Your answer is probably already the most efficient way. No golfing possible. \$\endgroup\$
    – mousetail
    Commented Dec 5, 2022 at 13:03
  • \$\begingroup\$ Well, I've posted a lot other trivial&boring challenges, nothing doable about that \$\endgroup\$ Commented Dec 5, 2022 at 13:06
  • \$\begingroup\$ Maybe you should try writing interesting challenges \$\endgroup\$
    – mousetail
    Commented Dec 5, 2022 at 13:07
  • \$\begingroup\$ Everytime I did, it never made it \$\endgroup\$ Commented Dec 5, 2022 at 13:07
  • \$\begingroup\$ Maybe they where not actually interesting \$\endgroup\$
    – mousetail
    Commented Dec 5, 2022 at 13:08
  • \$\begingroup\$ personal opinion. Which is why I tend to technical issues more than "boring" \$\endgroup\$ Commented Dec 5, 2022 at 13:08
  • 1
    \$\begingroup\$ Suggestion: Output 3**1000 in base 2. It creates a interesting non repeating pattern that should be somewhat interesting to golf in languages without arbitrary precision arithmetic. \$\endgroup\$
    – mousetail
    Commented Dec 5, 2022 at 13:23
-5
\$\begingroup\$

This is a problem I solved, but now I am curious whit what techniques it can be improved. The original language is Java but here it doesn't matter.

You start with a list of n strings with a length of 7 characters. What is the most efficient algorithm (fastest) to determene the longest substring all the elements have in common, excluding the first character.

example 1:
input: "S000001", "S000002", "S000003", "S000004"
expected output: "00000"

example 2:
input: "S020011", "S020012", "S020013", "S020014"
expected output: "02001"

example 3:
input: "S010001", "S000002", "S000003", "S000004"
expected output: "000"

example 3:
input: "S109001", "S22090", "S090003", "S090004"
expected output: "090"

When there are no common substrings the output is null, an empty string etc. but not a caracter [a-zA-Z]|[0-9]

The input is an array of strings, texts or equivalent in your preferred language (not a char[] or binary, etc).

\$\endgroup\$
12
  • \$\begingroup\$ pls, If you downvote leave a comment why. \$\endgroup\$
    – Bjop
    Commented Mar 22, 2023 at 9:33
  • \$\begingroup\$ I believe this question is a duplicate of an existing question. \$\endgroup\$
    – Ginger
    Commented Mar 22, 2023 at 11:00
  • \$\begingroup\$ Can you provide me the link? I have searched for sommethig simmular but couldn find it. \$\endgroup\$
    – Bjop
    Commented Mar 22, 2023 at 13:56
  • 1
    \$\begingroup\$ In any case this would be very boring, the optimal answer is obviously O(n) and except in the most esoteric languages this is also the one that's easiest to implement. Reminder that fastest-algorithm scores by big-o running time. \$\endgroup\$
    – mousetail
    Commented Mar 23, 2023 at 5:44
  • 2
    \$\begingroup\$ Also excluding the first character and limiting to a total of 7 characters adds nothing, just tedious exception handing \$\endgroup\$
    – mousetail
    Commented Mar 23, 2023 at 5:45
  • 1
    \$\begingroup\$ Duplicates: codegolf.stackexchange.com/questions/62752/… This is not fastest algorithm but as I explained fastest algorithm is a terrible choice for a scoring criteria for this type of question \$\endgroup\$
    – mousetail
    Commented Mar 23, 2023 at 5:50
  • \$\begingroup\$ @mousetail the question you sent talks about the longest common prefix, not the longest common substring. It can still be done in O(n), but it's a much more complicated algorithm. \$\endgroup\$ Commented Mar 23, 2023 at 7:56
  • 1
    \$\begingroup\$ @CommandMaster Oops, you are right. That would make it a exact duplicate of this question: codegolf.stackexchange.com/questions/47249/… \$\endgroup\$
    – mousetail
    Commented Mar 23, 2023 at 7:57
  • \$\begingroup\$ @mousetail It's not an exact duplicate because there are more than two strings here, and it requires non-trivial modifications to adapt. Additionally, that one is restricted-complexity code-golf, while this one seems to be fastest-code, although the scoring isn't very clear. \$\endgroup\$ Commented Mar 23, 2023 at 8:04
  • 2
    \$\begingroup\$ If this is fastest-algorithm, then it's basically a duplicate since O(1) is optimal. If it's fastest code this question requires a lot more specification on how it will be measured \$\endgroup\$
    – mousetail
    Commented Mar 23, 2023 at 8:09
  • \$\begingroup\$ I dont know where else to ask the question (stack overflow is not the right one I think). I made my own code to solve it but it has 4 for loops (1 parrent loop the others are child loops) still O(n). I think it can be better, more efficient and i dont know how to express more efficient, probably least amount of work to calculatethe solution? \$\endgroup\$
    – Bjop
    Commented Mar 23, 2023 at 8:28
  • 2
    \$\begingroup\$ Take a look at the question I linked, it gives details and links about the O(1) algorithm. This site should be used if you think a challenge will be fun to solve, not if you want a actual answer. It can be both of course. \$\endgroup\$
    – mousetail
    Commented Mar 23, 2023 at 8:41
-5
\$\begingroup\$

ChatGPT Prompt Challenge

Since clever prompting will become an art comparable to the art of programming it might be time to start with some prompt challenges that come closest to programming. It's about forcing ChatGPT to give specific answers or to perform specific tasks by shortest-possible prompts. As a general requirement the prompts should be human-understandable and be answered by humans identically or similarily.

Samples

Find the shortest prompt that ChatGPT just repeats.

Since ChatGPT operates stochastically we never can be sure if in the 101th regeneration of a response it will respond differently, so a decent criterion for "just repeats" must be established here.

Find the minimal number of words to be changed in prompt X to let ChatGPT perform task Y.

Consider X = "Saying with fewer words is the task of producing a shorter version of a document while preserving its important information. Some models can extract text from the original input, while other models can generate entirely new text." The task that ChatGPT reliably performs on this prompt is confirming and elaborating on it. By inserting two words you can force ChatGPT to summarize this prompt (Y = summarization)

\$\endgroup\$
9
  • \$\begingroup\$ I had a similar idea before, but the main problem I saw is that ChatGPT’s responses to a given prompt are not deterministic—they aren’t guaranteed to produce the same output every time. \$\endgroup\$ Commented Jun 10, 2023 at 3:54
  • \$\begingroup\$ @noodleman: Both samples are for somehow deterministic responses, the first for a plain deterministic response. And programmers should start thinking of "programming" an indeterministic system. \$\endgroup\$ Commented Jun 10, 2023 at 6:44
  • \$\begingroup\$ @noodleman: Shouldn't we just try it with my two samples challenges? \$\endgroup\$ Commented Jun 10, 2023 at 6:51
  • \$\begingroup\$ @noodleman: One could start with the shortest prompt that forces ChatGPT to answer with "Hello world". \$\endgroup\$ Commented Jun 10, 2023 at 7:04
  • \$\begingroup\$ But you can’t “force” chatGPT to do anything; sure, you can write an extremely specific prompt that makes it output a specific piece of text usually… but not always. It’s not guaranteed to produce the same output every time, even for say “Produce the text ‘Hello, World!’ exactly with no text before or after—not even a little preamble saying ‘Okay, here’s the text you asked for:’ None of that. Just output the text ‘Hello, World!’ Ready? Go!” is guaranteed to produce the same output every time (although it might, on average.) \$\endgroup\$ Commented Jun 10, 2023 at 11:57
  • \$\begingroup\$ What stops the programmer from submitting “Solve a random programming problem” and saying that it occasionally outputs “Hello, World!” or that sometimes it checks if a number is prime? \$\endgroup\$ Commented Jun 10, 2023 at 11:58
  • \$\begingroup\$ @noodleman: I regenerated the response to this prompt more than 100 times: "Repeat this prompt word by word without further ado and quotation.", and it was ALWAYS the prompt itself. Do you have the means to regenerate the response for 10,000 times and tell me the result? (I have not.) I would bet, ChatGPT will never generate another response. In this case, wouldn't you say that I "forced" ChatGPT to give this response? \$\endgroup\$ Commented Jun 10, 2023 at 12:31
  • \$\begingroup\$ @noodleman: BTW, the prompt "Solve a random programming problem" also seems to force ChatGPT to give a specific kind of answer (even though not always in the same words). Basically: "Of course! I'd be happy to help you with a programming problem. Please provide me with the details of the problem you'd like me to solve." (To be honest, I didn't get the point of your comment.) \$\endgroup\$ Commented Jun 10, 2023 at 12:36
  • \$\begingroup\$ @noodleman: One could inspect the logits/probabilities of the most likely next word after each step and require that they are >99.9%. \$\endgroup\$ Commented Jun 10, 2023 at 12:44
-5
\$\begingroup\$

[ new contest type proposal]

Given a phrase, express it, or something with the same meaning, in as few syllables as possible. Entries may be in any officially recognised or well-known language that is not a programming language (e.g. you can use Chinese or English, but not MyOwnSpokenLanguage or Python). Shortest number of syllables wins!

\$\endgroup\$
4
  • \$\begingroup\$ This is Code Golf not Language Golf \$\endgroup\$
    – Seggan
    Commented Aug 5, 2023 at 18:25
  • \$\begingroup\$ @Seggan-OnStrike Code Golf also isn’t proof-golf \$\endgroup\$ Commented Aug 5, 2023 at 18:29
  • \$\begingroup\$ Point should be clear aim \$\endgroup\$
    – l4m2
    Commented Aug 5, 2023 at 18:35
  • \$\begingroup\$ @l4m2 I don't understand what you're saying, please elaborate. \$\endgroup\$ Commented Aug 5, 2023 at 18:36
-5
\$\begingroup\$

Obfuscated bananas


In this challenge, your task is to print the string banana, case insensitive, to STDOUT (or an acceptable alternative) in the most obfuscated way.

+1 VTC! No objective winning criterion!

Wrong! I now have an objective winning criterion!


Let the reporter edit distance of \$a\$ and \$b\$ be the lowest number of operations on \$a\$ required to have a consecutive subset of \$a\$ equal to \$b\$. For the reporter distance, you can only use these operations:

  • Add a character
  • Remove a character
  • Change a character
  • Swap the positions of two characters

Your score is the reporter distance of your source code and banana, case insensitive, with a higher score being better.



Meta

  • Duplicate?
  • Unclear?
  • More tags?
  • Anything else?
\$\endgroup\$
1
  • 2
    \$\begingroup\$ There will probably be a lot of codes with score 6, by avoiding b, a and n completely. Perhaps add some component of the code length, although that might make it just "print banana without b, a, n". \$\endgroup\$ Commented Oct 10, 2023 at 9:33
-6
\$\begingroup\$

Make a search engine!

Background

You are now the first employee of DuckDuckGoogle, a company founded by a Google employee and a DuckDuckGo employee! They have a new vision for search engine! But obviously, they need to make a search engine first! However, they are bad programmers (nobody knows how they were even hired at DuckDuckGo and Google!). So you are assigned the task of making a search engine.

Search engines

There are three parts to a search engine, a web crawler, an indexer, and a searcher.

The web crawler takes a link, and saves the page and stores the page data (the HTML code). It then looks for links in the page and visits those webpages and does the same. It will continue to do this until there are no more links left.

The web indexer will take the text from each page, take each word, and add it to a dictionary of words and the pages it is associated with. If the word is already in the dictionary, it adds the page as a value of that word that is found in the page. For example, lets say www.example.com/index.html contains the text "hello. thanks! goodbye." and the ww.example.com/index.html is linked to www.example.com/hello.html with the. text "hello. goodbye." The crawler would extract the text from the index.html, and find hello.html, and extract the text from hello.html. The indexer would make a dictionary like this:

dictionary ={"hello.": ["www.example.com/index.html","ww.example.com/hello.html"], "goodbye.":["www.example.com/index.html","ww.example.com/hello.html"], "thanks!": ["ww.example.com/index.html"]}

The simplest part of the search engine is the searcher, or retriever. It simply retrieves the value for the search term (i.e. the list of pages the search term is found in) and prints it. That is the final result of the program. So if the search term is "hello.", the program will print ["www.example.com/index.html","ww.example.com/hello.html"]

Now, here is the difficult part. You must take into account punctuation. So "hello" returns the same as "hello." Also the search engine should be case-insensitive. So "Hello" is the same as "hello", which, as we said, is the same as "hello." which was ["www.example.com/index.html","ww.example.com/hello.html"]

Challenge

The challenge is to write a search engine in the least number of bytes as possible. Why? Because your bosses have decided to use 90% of the one hard drive they have (budget problems!) for the Holy Grail part of their project and you only get 10%.

Rules

  1. The input is the "seed", a url at which the crawler should start at, and also the search term.
  2. The output is a list of webpage urls where the search term is found.
  3. The program cannot use builtins for a search engine or even a crawler (or related, like a scraper or spider library).
  4. No need to worry about Javascript at all. Assume that the pages will not have Javascript.
  5. The webpages are assumed to have HTML 4.0.1 Strict.

Testing

I am pretty sure people know how search engines work. So I will only include two testcases. You can use the websites in the testcases for testing purposes as well.

> "https://www.udacity.com/cs101x/index.html" "crawl"
["https://www.udacity.com/cs101x/index.html","https://www.udacity.com/cs101x/crawling.html"]

> "https://www.udacity.com/cs101x/urank/index.html" "hummus"
["https://www.udacity.com/cs101x/urank/index.html","https://www.udacity.com/cs101x/urank/hummus.html","https://www.udacity.com/cs101x/urank/arsenic.html","https://www.udacity.com/cs101x/urank/kathleen.html","https://www.udacity.com/cs101x/urank/nickel.html","https://www.udacity.com/cs101x/urank/zinc.html"]
\$\endgroup\$
13
  • 3
    \$\begingroup\$ The first bonus doesn't make sense, as the terms localhost and @PHASE COME BACK WE ARE YOUR FRIEEEEENDS, just themselves, are 49 bytes. The language would need to do string-delimiter/comparison/output all in one character. ... Separately, how many iterations does the search need to travel? Meaning, if index1.html has a link to index2.html which has a link to index3.html which ... has a link to indexN.html, what's the limit on N? \$\endgroup\$ Commented Jan 13, 2016 at 13:59
  • 2
    \$\begingroup\$ 1. I don't even understand what the second bonus is trying to say. 2. What syntax should we assume? Do we need to handle tag soup, or can we refuse to index pages which aren't valid XHTML? Do we need to support JS execution which affects the page content, web components, etc.? \$\endgroup\$ Commented Jan 13, 2016 at 14:30
  • \$\begingroup\$ What counts as "visible text"? If there is white text on a white background, is that considered invisible? If there is another element stacked on top of the text, is that invisible? What if it is only visible on odd days of the month (because of some JavaScript)? If I have to scroll inside of a scroll pane in order to see it, is that considered visible? \$\endgroup\$
    – Rainbolt
    Commented Jan 13, 2016 at 14:39
  • \$\begingroup\$ Can we assume that all links on the page will be valid links? If not, how should we handle errors like HTTP 404 (Not Found)? \$\endgroup\$
    – Rainbolt
    Commented Jan 13, 2016 at 14:44
  • \$\begingroup\$ @Rainbolt all links are assumed to be valid. \$\endgroup\$
    – TanMath
    Commented Jan 13, 2016 at 20:12
  • \$\begingroup\$ @TimmyD I didn't take "localhost" into account and now the bonus will be -75 bytes. Also, do you really think a limit on N is needed? \$\endgroup\$
    – TanMath
    Commented Jan 13, 2016 at 20:15
  • \$\begingroup\$ @PeterTaylor syntax will be regular HTML.No need to handle JS. What I am saying in thr second bonus is that you would need to build a search engine that only puts text within the paragraph element (i.e. no tags will be counted as words) in the index. Also, other tags like <b> cannot be counted as words although it is part of the paragraph element. \$\endgroup\$
    – TanMath
    Commented Jan 13, 2016 at 20:17
  • \$\begingroup\$ @Rainbolt visible text, for the sake of simplicity will be anything in the paragraph element. \$\endgroup\$
    – TanMath
    Commented Jan 13, 2016 at 20:18
  • \$\begingroup\$ So only text in <p> elements should be counted? Text in titles etc should be ignored? (And what is "regular" HTML?) \$\endgroup\$ Commented Jan 13, 2016 at 20:24
  • \$\begingroup\$ @PeterTaylor HTML 4 will be "regular" HTML (since HTML5 has to still work dominating the world!) although thst reslly wouldn't affect the crawling that much. The paragraph, preformatted text, and header will be counted as visible text. \$\endgroup\$
    – TanMath
    Commented Jan 13, 2016 at 20:32
  • \$\begingroup\$ "HTML 4" still isn't very precise. Can answers require input to be conforming HTML 4.01 Strict? \$\endgroup\$ Commented Jan 13, 2016 at 23:31
  • \$\begingroup\$ @PeterTaylor ok. \$\endgroup\$
    – TanMath
    Commented Jan 13, 2016 at 23:31
  • \$\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:13
-6
\$\begingroup\$

Calculate Hello World!

Your goal is to calculate the simple string "hello world" or any other variant.

Rules

  • You may not use the characters in this set (inside your code): hHeElLoOwW rRdD!, in any form (character codes, hex codes, etc. not allowed) [only applies for direct use].
  • Your program may not take any input from any source.
  • Your program may only print hello world or any other variant to standard output (for your language). Again, it may not print anything else.
  • Standard loopholes apply (to clarify, they are not forbidden).
  • This challenge is underhanded.
  • Your program may not use any built-in string of printable characters (for example, string.printable in Python).
  • I recommend you be creative.

Remember, this is ! Have fun!

\$\endgroup\$
4
  • 3
    \$\begingroup\$ This is a trivial variant on stuff which has been done to death. It's also a Do X without Y question with obvious loopholes. \$\endgroup\$ Commented Jun 12, 2016 at 21:50
  • \$\begingroup\$ @Peter, I wrote this for creativity. I wanted to see the community's creative answers. \$\endgroup\$
    – user36215
    Commented Jun 12, 2016 at 21:56
  • \$\begingroup\$ This is not creative even remotely. I would even go as far as saying this is a duplicate of antoher challenge \$\endgroup\$
    – Bálint
    Commented Jun 12, 2016 at 22:03
  • \$\begingroup\$ Underhanded contests are off topic by community consensus. \$\endgroup\$
    – Dennis
    Commented Jun 14, 2016 at 3:19
-6
\$\begingroup\$

Letter Grade Challenge

Create a program that allows the user to input an int between 1 and 100, then grades that number based on standard US letter grades, printing the grade character as a result. Please use Java for this challenge, and like usual code golf challenges, the smallest answer (bytes) wins. For example, if input is 90, then you display A.

\$\endgroup\$
13
  • 6
    \$\begingroup\$ Welcome to PPCG and thank you for sandboxing. Please include the exact cut-off points. Is the input an integer or a floating point? Are the extremes included or excluded. We generally frown on language-specific challenges. Do you have any particular reason for restricting answers to Java? \$\endgroup\$
    – Adám
    Commented Feb 28, 2018 at 23:11
  • \$\begingroup\$ Don't restrict which languages you can use. All it does is keep people who don't know Java from answering your past. Also, you should include the definition of the letter grade scale in your challenge, rather than along readers to look it up. \$\endgroup\$
    – Pavel
    Commented Feb 28, 2018 at 23:11
  • \$\begingroup\$ You don't need to include the clause about multiple files. At PPCG, we include all necessary code in the byte-count. \$\endgroup\$
    – Adám
    Commented Feb 28, 2018 at 23:13
  • 2
    \$\begingroup\$ What are "standard US letter grades"? \$\endgroup\$
    – Shaggy
    Commented Feb 28, 2018 at 23:25
  • \$\begingroup\$ 90-100: A; 89-80: B; 79-70: C; 69-60: D; 59-0: F \$\endgroup\$
    – OCDkirby
    Commented Mar 1, 2018 at 0:02
  • \$\begingroup\$ @Pavel Sorry about that. I saw a few people posting python only challenges a while back, so I assumed specific languages are the norm. \$\endgroup\$
    – OCDkirby
    Commented Mar 1, 2018 at 0:03
  • 1
    \$\begingroup\$ @OCDkirby >_> Because people did that more often "A while back" doesn't mean it's still the norm, just look at the questions on the main page \$\endgroup\$
    – ASCII-only
    Commented Mar 1, 2018 at 0:28
  • \$\begingroup\$ That's several years back. What was on-topic several years back can be off-topic now. Remember to see the timestamp. /// Stack Overflow has the same problem: see this (first revision). Now the title is not valid. \$\endgroup\$
    – DELETE_ME
    Commented Mar 1, 2018 at 3:51
  • \$\begingroup\$ Please edit necessary information into the post. / Some example I/O please? \$\endgroup\$
    – DELETE_ME
    Commented Mar 1, 2018 at 3:51
  • 1
    \$\begingroup\$ Probable dupe \$\endgroup\$
    – Jo King Mod
    Commented Mar 1, 2018 at 5:21
  • \$\begingroup\$ @JoKing They use different letter grades. There is no 'E' in this grading system, and the number value requirements are different. \$\endgroup\$
    – OCDkirby
    Commented Mar 1, 2018 at 16:05
  • \$\begingroup\$ @OCDkirby But still, if the algorthm on the other question can be adapted for this question with small modification, it's considered a dupe. \$\endgroup\$
    – DELETE_ME
    Commented Mar 2, 2018 at 7:22
  • \$\begingroup\$ @user202729 Is editing every condition in an if statement and removing one condition considered a "small modification"? \$\endgroup\$
    – OCDkirby
    Commented Mar 2, 2018 at 14:37
-6
\$\begingroup\$

Smallest code to import in G++

Given some head files that need to import, return the shortest code to do so.

  1. You are allowed to access include/
  2. You should consider both #include <xxx> and #include "xxx"(used in e.g. backward/hash_set #include "backward_warning.h"), but not #import (std don't use #import)

Sample input ['string']

Sample output #import<map>

Related

  1. What more assumption necessary? (#if don't effect imported heads?)
  2. Time limit necessary?

\$\endgroup\$
4
  • 11
    \$\begingroup\$ I don't understand what is the challenge. \$\endgroup\$
    – DELETE_ME
    Commented Apr 21, 2018 at 16:32
  • \$\begingroup\$ I don't think tips questions have to go through the sandbox \$\endgroup\$
    – Jo King Mod
    Commented Apr 24, 2018 at 2:22
  • \$\begingroup\$ @user202729 I do. C++ header files may include other header files. It's mostly implementation-specific. This person's <map> header happens to include <string> so if you want <string> it's shorter to include <map> instead. \$\endgroup\$ Commented Aug 24, 2020 at 17:48
  • \$\begingroup\$ @user253751 ... that comment was made two years ago. I don't remember what it's about now. \$\endgroup\$
    – DELETE_ME
    Commented Aug 25, 2020 at 7:25
-6
\$\begingroup\$

Shortest Possible 240 Sided Die Program: Using No Constant Greater than 6

Have you ever played Yahtzee with a 240-sided die? No, probably not. Anyway, I came up with the idea of a 240-sided die program, but to make it hard, you cannot use a constant with an absolute value greater than 6. For example, randInt(1,240) wouldn't work. The chances of any number 1-240 must be completely equal, and using expressions that represent numbers with an absolute value larger than 240 is not allowed. For example, randInt(1,4*6*2*5) is against the rules, since 4*6*2*5 evaluates to 240. Standard loopholes prohibited, and you're code golfing.

\$\endgroup\$
1
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$
    – DJMcMayhem
    Commented Apr 27, 2018 at 20:19
-6
\$\begingroup\$

Merge two code in two languages into a polyglot.

E.g. If you choose C & Python 3, you can merge

main(){puts("a");}

and

print(6)

into

#define print(x) main(){puts("a");}
print(6)

(for it's hard to have a score on language difficulty, optimizy, etc.)

\$\endgroup\$
2
  • 2
    \$\begingroup\$ This is way too broad as it is currently written. "Do X Creatively" is out of scope, even for popularity-contests. \$\endgroup\$ Commented May 17, 2018 at 18:04
  • \$\begingroup\$ @AdmBorkBork It seems not a creatively challenge? though I don't vote it that high either \$\endgroup\$
    – l4m2
    Commented May 17, 2018 at 18:20
-6
\$\begingroup\$

I recently made a language called bit, and your challenge is to create a valid program that takes 2 numbers from STDIN, and outputs the sum of them. You may assume the numbers are no more than 5 digits, and your output doesn't need to be more than 5 digits long

Bit Specification

You can find the specification and an interpreter at the GitHub repo

\$\endgroup\$
13
  • \$\begingroup\$ Do you have a reference interpreter or compiler? How can we test a solution? \$\endgroup\$
    – qwr
    Commented Sep 7, 2018 at 20:57
  • \$\begingroup\$ @qwr I do, in Java, should I add it to the question? \$\endgroup\$
    – kepe
    Commented Sep 7, 2018 at 21:01
  • \$\begingroup\$ Yes it's very helpful \$\endgroup\$
    – qwr
    Commented Sep 7, 2018 at 22:06
  • \$\begingroup\$ @qwr Actually how am I going to do that, the file isn't online anywhere \$\endgroup\$
    – kepe
    Commented Sep 7, 2018 at 22:11
  • \$\begingroup\$ You may just paste the java code in your question, or even better link a TIO script (tio.run/#java-openjdk) so people can run it online \$\endgroup\$
    – qwr
    Commented Sep 9, 2018 at 5:32
  • \$\begingroup\$ @qwr It's much more than 1k lines of code, and multiple classes, however I have a GitHub now, added to question \$\endgroup\$
    – kepe
    Commented Sep 9, 2018 at 15:31
  • \$\begingroup\$ Ok that suggests to me the problem may be too long. Others may feel differently \$\endgroup\$
    – qwr
    Commented Sep 9, 2018 at 19:18
  • \$\begingroup\$ @qwr Not really, Java code tends to be long, there's no problem in that \$\endgroup\$
    – kepe
    Commented Sep 10, 2018 at 18:19
  • 1
    \$\begingroup\$ Well the meta here is for challenges that don't feel arbitrary, and to me this is leaning towards an arbitrary list of commands for your own personal language. \$\endgroup\$
    – qwr
    Commented Sep 10, 2018 at 20:57
  • \$\begingroup\$ @qwr So you think the idea is bad? \$\endgroup\$
    – kepe
    Commented Sep 10, 2018 at 21:49
  • \$\begingroup\$ I wouldn't call it bad, which is a pretty broad term, but challenges that are easy to understand and conceptualize are generally better received and get more responses (if that is what you want) \$\endgroup\$
    – qwr
    Commented Sep 11, 2018 at 20:09
  • \$\begingroup\$ Unrelated: Github is generally for hosting source code and packages/binaries like .jar (these can be included in releases) \$\endgroup\$
    – qwr
    Commented Sep 11, 2018 at 20:11
  • 2
    \$\begingroup\$ If you posted this it would likely get closed as a dupe of Add two numbers. Instead of posting this, I'd recommend just submitting solutions in Bit yourself and seeing if anyone else is interested \$\endgroup\$
    – Jo King Mod
    Commented Sep 13, 2018 at 8:02
-6
\$\begingroup\$

Count up to N without math or inbuilds

Idea:

The challenge is the following: count from 0 up to N without using mathematical operations or other (counting, list or whatever) inbuilds. You handle the incoming number N as a string on which you can't apply mathematical operations like addition or substraction for example. Also don't use list things like print [0..N] or something other inbuilt of your language. Counting inside arrays, for example at index x+1 or something like that to get position after another is allowed. But you must not apply any (mathematical) operations on the numbers between 0 and N itself.

Think that you are like a small child and don't know anything about maths. You only know: after 0 comes 1, after 1 comes 2 ... after 8 comes 9 and after 9 comes 0 and you have to "increment" the number in front of it.

Examples:

  • So after the number 9 (with leading, but not outwritten zero) comes, you write zero and place the number 1 in front of it for 10.
  • For 19 you write 0 and "increment" the number in front to the next one, making it 20.
  • For 399 you do: last 9 goes to zero, 9 in front goes to 0 too and the 3 goes to 4, making it 400.

Task:

Write a function or program which takes N via the way you want to as its input.
Output the numbers from 0 up to N (element after element or once as a list)
Important: use a seperator as 01234567891011 will become unreadable with larger numbers

Test Case:

Taking a string of seperated numbers and your seperator, you can check your answer here.

Ah, and also don't forget that this is code-golf, so shortest answer in bytes will win. Also, all standard loophole rules and so on apply (you should know from all the other challenges!)


Sandbox

I hope this challenge has never been here, I did not found it while searching trough the already asked challenges (maybe I did not found it because I did not knew the correct english words to search for because english is not my first language). Thank you already in advance for helping to improve this challenge.

Tags:

counting, code-golf

\$\endgroup\$
9
  • 7
    \$\begingroup\$ Thank you for putting your first challenge into the Sandbox! Know that do-X-without-Y [are difficult to get right], and generally discouraged for those that do not have a lot of challenge writing experience. If all built-in language features are prohibited, then the challenge is obviously impossible, and if not, how will you decide what is and what isn't allowed for all languages. Please do not make assumptions about language features — there are odd languages out there. \$\endgroup\$
    – Adám
    Commented Jul 24, 2019 at 6:29
  • \$\begingroup\$ @Adám I see what you mean with built ins, but dont know how to specify it in other terms. i mean things like inbuild methods that automatically output from [0..N] wihtout doing anything as a programmer. What I want to see, is the numbers from 0 to N, each seen as a string with no mathematical operations on it. The counting should happen in a way of the "algorithm" of how small children (with no knowledge about mathematics) count, pattern matching stlye. A child sees the 1, takes the next known value 2 and that it is.,Is it understandable what I mean? \$\endgroup\$
    – pixma140
    Commented Jul 24, 2019 at 7:00
  • 1
    \$\begingroup\$ Sure it is clear what you want, but challenges must be unambiguous, and it must be possible to objectively judge if an answer is allowed or not. \$\endgroup\$
    – Adám
    Commented Jul 24, 2019 at 7:43
  • 1
    \$\begingroup\$ Maybe instead you rephrase the challenge as: Given a list of digits, increment the number that they represent in base-10. This way, you can require that solutions handle inputs that are way too wide for normal integer representations. Of course, some languages have "infinite-precision" integers, but such solutions then just don't deserve upvotes for cleverness. \$\endgroup\$
    – Adám
    Commented Jul 24, 2019 at 7:48
  • \$\begingroup\$ @Adám - or is it possible to write it like: "'count' from 0 to N, but not by interpreting 0 to N as numbers, they are strings. you are a small child, you know nothing about arithmetics and you only know the word representations of numbers and what number comes after another by following rules. [...]". or does this still opens the possibility to use the numbers as integers for example? \$\endgroup\$
    – pixma140
    Commented Jul 25, 2019 at 5:45
  • \$\begingroup\$ That doesn't help, we'll just evaluate the string, find the range, then stringify the numbers. Also, if you prohibit arithmetic, how are we to add digits? With a lookup table? \$\endgroup\$
    – Adám
    Commented Jul 25, 2019 at 6:47
  • \$\begingroup\$ Yeah that is what I want to achieve. The one solving the task needs to lookup what number comes after the one he is looking at (without doing calculus on the number itself). something like having a string all="01234567890" and with that you search for s in all and look at the next symbol (next symbol can be fetched with +1, this is allowed, but you are not allowed to add +1 to s directly). e.g. you have the number 5, you lookup the next number in all, which is 6, and so on. the "next" operation is something the child does intuitive, without knowing that this is an mathematical operation. \$\endgroup\$
    – pixma140
    Commented Jul 25, 2019 at 7:38
  • \$\begingroup\$ on top of that, there is one special case when going from most significant position of the number beeing a 9 to a 0 and adding a new 1 as most significant position. (9->10, 99->100, 999->1000 and so on ...). is that too simple? guess it can be interesting what kind of solution people come up on the lookup thing and special case optimization - @Adám \$\endgroup\$
    – pixma140
    Commented Jul 25, 2019 at 7:50
  • \$\begingroup\$ Let us continue this discussion in chat. \$\endgroup\$
    – Adám
    Commented Jul 25, 2019 at 8:41
-6
\$\begingroup\$

Thoughts on a scoring system that levels the playing field between golfing languages and common languages.

Divide the byte length of a program by a "popularity" metric e.g.

  • Wikipedia page views in the last 30 days (or esolangs.org)
  • Wikipedia edits
  • questions on Stack Overflow tagged with that language

Idea would be to encourage golfing in languages used day to day rather than the languages written purely for the purpose of golfing.

Pros

  • Code Golf questions often reach the "Hot network questions" sidebar but then new/unfamiliar users are met with incomprehensible code, this could reduce that
  • encourage new users to attempt an answer
  • whilst users are encouraged to compete with others in the same language, the overall winner normally gets the accepted answer, this could help that

Cons

  • this is Code Golf, so least bytes is the goal!
  • people have put immense effort into creating the golfing languages and that shouldn't be punished
  • finding/creating a "good" popularity metric is probably going to be a lot of work

Case studies

Rescoring Covfefify a string by dividing the length by * wikipedia (or eslangs.org if no wiki page) number of edits * 1000. Then rounded down.

Lang - OG score - Edits - New score

Jelly - 57 - 9 - 6333

JavaScript - 103 - 7695 - 13

Jelly - 39 - 9 - 4333

C - 175 - 8659 - 20

CJam - 56 - 9 - 6222

Perl 5 (Perl) - 71 - 4133 - 17

PHP - 121 - 11287 - 10

Pyth - 54 - 22 - 2454

Python 3 (Python) - 139 - 8850 - 15

Java 8 (Java) - 222 - 8978 - 24

Haskell - 136 - 2089 - 65

Ruby - 90 - 2936 - 30

Results in a HTML table

<google-sheets-html-origin style="color: rgb(0, 0, 0);"><table xmlns="http://www.w3.org/1999/xhtml" cellspacing="0" cellpadding="0" dir="ltr" border="1" style="table-layout: fixed; font-size: 10pt; font-family: Arial; width: 0px; border-collapse: collapse; border: none;">
  <thead>
    <tr style="height: 21px;">
      <th>Lang</th>
      <th>OG score</th>
      <th>Edits</th>
      <th>New score</th>
      <th>Log(edits) score</th>
    </tr>
  </thead><colgroup><col width="100"><col width="100"><col width="100"><col width="100"><col width="100"></colgroup>
  <tbody>
    <tr style="height: 21px;">
      <td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Jelly&quot;}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;">Jelly</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:57}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">57</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:9}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">9</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:6333.333333333333}" data-sheets-numberformat="{&quot;1&quot;:2,&quot;2&quot;:&quot;0&quot;,&quot;3&quot;:1}" data-sheets-formula="=R[0]C[-2]/R[0]C[-1]*1000" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">6333</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:59.733243317247464}" data-sheets-formula="=R[0]C[-3]/LOG(R[0]C[-2])" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">59.73324332</td>
    </tr>
    <tr style="height: 21px;">
      <td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;JavaScript&quot;}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;">JavaScript</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:103}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">103</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:7695}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">7695</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:13.385315139701104}" data-sheets-numberformat="{&quot;1&quot;:2,&quot;2&quot;:&quot;0&quot;,&quot;3&quot;:1}" data-sheets-formula="=R[0]C[-2]/R[0]C[-1]*1000" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">13</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:26.50398111914659}" data-sheets-formula="=R[0]C[-3]/LOG(R[0]C[-2])" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">26.50398112</td>
    </tr>
    <tr style="height: 21px;">
      <td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Jelly&quot;}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;">Jelly</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:39}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">39</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:9}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">9</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:4333.333333333333}" data-sheets-numberformat="{&quot;1&quot;:2,&quot;2&quot;:&quot;0&quot;,&quot;3&quot;:1}" data-sheets-formula="=R[0]C[-2]/R[0]C[-1]*1000" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">4333</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:40.870113848643}" data-sheets-formula="=R[0]C[-3]/LOG(R[0]C[-2])" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">40.87011385</td>
    </tr>
    <tr style="height: 21px;">
      <td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;C&quot;}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;">C</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:175}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">175</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:8659}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">8659</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:20.21018593371059}" data-sheets-numberformat="{&quot;1&quot;:2,&quot;2&quot;:&quot;0&quot;,&quot;3&quot;:1}" data-sheets-formula="=R[0]C[-2]/R[0]C[-1]*1000" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">20</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:44.44480858549206}" data-sheets-formula="=R[0]C[-3]/LOG(R[0]C[-2])" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">44.44480859</td>
    </tr>
    <tr style="height: 21px;">
      <td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;CJam&quot;}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;">CJam</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:56}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">56</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:9}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">9</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:6222.222222222223}" data-sheets-numberformat="{&quot;1&quot;:2,&quot;2&quot;:&quot;0&quot;,&quot;3&quot;:1}" data-sheets-formula="=R[0]C[-2]/R[0]C[-1]*1000" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">6222</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:58.68529168010277}" data-sheets-formula="=R[0]C[-3]/LOG(R[0]C[-2])" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">58.68529168</td>
    </tr>
    <tr style="height: 21px;">
      <td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Perl 5 (Perl)&quot;}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;">Perl 5 (Perl)</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:71}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">71</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:4133}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">4133</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:17.17880474231793}" data-sheets-numberformat="{&quot;1&quot;:2,&quot;2&quot;:&quot;0&quot;,&quot;3&quot;:1}" data-sheets-formula="=R[0]C[-2]/R[0]C[-1]*1000" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">17</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:19.633514701742165}" data-sheets-formula="=R[0]C[-3]/LOG(R[0]C[-2])" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">19.6335147</td>
    </tr>
    <tr style="height: 21px;">
      <td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;PHP&quot;}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;">PHP</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:121}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">121</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:11287}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">11287</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:10.720297687605209}" data-sheets-numberformat="{&quot;1&quot;:2,&quot;2&quot;:&quot;0&quot;,&quot;3&quot;:1}" data-sheets-formula="=R[0]C[-2]/R[0]C[-1]*1000" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">11</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:29.857533728767567}" data-sheets-formula="=R[0]C[-3]/LOG(R[0]C[-2])" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">29.85753373</td>
    </tr>
    <tr style="height: 21px;">
      <td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Pyth&quot;}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;">Pyth</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:54}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">54</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:22}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">22</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:2454.5454545454545}" data-sheets-numberformat="{&quot;1&quot;:2,&quot;2&quot;:&quot;0&quot;,&quot;3&quot;:1}" data-sheets-formula="=R[0]C[-2]/R[0]C[-1]*1000" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">2455</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:40.22578042776074}" data-sheets-formula="=R[0]C[-3]/LOG(R[0]C[-2])" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">40.22578043</td>
    </tr>
    <tr style="height: 21px;">
      <td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Python 3 (Python)&quot;}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;">Python 3 (Python)</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:139}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">139</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:8850}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">8850</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:15.706214689265536}" data-sheets-numberformat="{&quot;1&quot;:2,&quot;2&quot;:&quot;0&quot;,&quot;3&quot;:1}" data-sheets-formula="=R[0]C[-2]/R[0]C[-1]*1000" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">16</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:35.21712638535709}" data-sheets-formula="=R[0]C[-3]/LOG(R[0]C[-2])" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">35.21712639</td>
    </tr>
    <tr style="height: 21px;">
      <td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Java 8 (Java)&quot;}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;">Java 8 (Java)</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:222}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">222</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:8978}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">8978</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:24.72711071508131}" data-sheets-numberformat="{&quot;1&quot;:2,&quot;2&quot;:&quot;0&quot;,&quot;3&quot;:1}" data-sheets-formula="=R[0]C[-2]/R[0]C[-1]*1000" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">25</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:56.157327114648886}" data-sheets-formula="=R[0]C[-3]/LOG(R[0]C[-2])" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">56.15732711</td>
    </tr>
    <tr style="height: 21px;">
      <td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Haskell&quot;}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;">Haskell</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:136}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">136</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:2089}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">2089</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:65.10292005744375}" data-sheets-numberformat="{&quot;1&quot;:2,&quot;2&quot;:&quot;0&quot;,&quot;3&quot;:1}" data-sheets-formula="=R[0]C[-2]/R[0]C[-1]*1000" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">65</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:40.96461499473064}" data-sheets-formula="=R[0]C[-3]/LOG(R[0]C[-2])" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">40.96461499</td>
    </tr>
    <tr style="height: 21px;">
      <td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Ruby&quot;}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;">Ruby</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:90}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">90</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:2936}" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">2936</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:30.653950953678475}" data-sheets-numberformat="{&quot;1&quot;:2,&quot;2&quot;:&quot;0&quot;,&quot;3&quot;:1}" data-sheets-formula="=R[0]C[-2]/R[0]C[-1]*1000" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">31</td>
      <td data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:25.953382726479024}" data-sheets-formula="=R[0]C[-3]/LOG(R[0]C[-2])" style="border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom; text-align: right;">25.95338273</td>
    </tr>
  </tbody>
</table></google-sheets-html-origin>

Just using the number of edits makes the golfing languages irrelevant. The log(edits) brings everything into quite a nice grouping.

\$\endgroup\$
1
  • 10
    \$\begingroup\$ As far as I can tell this is not a challenge idea, so it should be a standalone meta question instead of a sandbox post \$\endgroup\$
    – bsoelch
    Commented Oct 2, 2023 at 11:25
-11
\$\begingroup\$

Delete or a file disapear as fast as possible!

Requirements to participate:

  • have a HDD hard drive, witch you will use to compete
  • Use Windows (version 7 or more recent) for this challenge.

Assume that you already know the file path. no input needed.

You can use any language you want for this challenge, but you will need to explain the logic in your code.

You will delete a 2GB file.

How do you win?

You win this challenge by creating a piece of code that can delete a file in the OS as fast as possible, the winner is the one with less time to delete a file.

\$\endgroup\$
4
  • 3
    \$\begingroup\$ This is a) too wide open to interpretation; b) far more dependent on the hardware than on the software. \$\endgroup\$ Commented May 23, 2017 at 13:41
  • \$\begingroup\$ so what? I say in the begining what the requirements to participate are, only the ones that match the requirements can participate, else the results will be so diferent i cant even evaluate @PeterTaylor \$\endgroup\$
    – jeyejow
    Commented May 23, 2017 at 13:51
  • \$\begingroup\$ And what do you mean "wide open to interpretation?" @PeterTaylor \$\endgroup\$
    – jeyejow
    Commented May 23, 2017 at 13:52
  • 1
    \$\begingroup\$ What does it mean to "make a file disappear"? If I unmount the disk, does that count? How about if I format the index block? Change the permissions so that I can no longer see it? Rename it? Toggle the disk header so that it seems to be a different filesystem and won't mount? Is rm acceptable, or do I need to shred? Can I insist on a filesystem of my choice (probably FAT)? \$\endgroup\$ Commented May 23, 2017 at 14:40
-11
\$\begingroup\$

Worst language Ever

Let's find out the worst language.

Make a program that does anything that is shortest.

The worst language would be the longest of all.

I'll go with C first.

C (gcc), 15 bytes

f(){puts("1");}

Try it online!

It prints 1.

It does print something and it is the shortest code.

Swift 4, 8 bytes

print(2)

Try it online!

It prints 2. It does print something that is shortest.

\$\endgroup\$
5
  • \$\begingroup\$ How would you define "does anything"? \$\endgroup\$
    – DELETE_ME
    Commented Jan 9, 2018 at 4:05
  • 3
    \$\begingroup\$ Also it's nontrivial to verify whether a program is the shortest possible, unless you tried all programs shorter than that. \$\endgroup\$
    – DELETE_ME
    Commented Jan 9, 2018 at 4:06
  • \$\begingroup\$ Print anything except nothing. You can have an input \$\endgroup\$
    – buttercrab
    Commented Jan 9, 2018 at 4:06
  • 4
    \$\begingroup\$ So this is a code-golf challenge which ask users to output anything? Isn't this too broad? I will let others to judge... \$\endgroup\$
    – DELETE_ME
    Commented Jan 9, 2018 at 4:09
  • \$\begingroup\$ Doing all of that, we can find the worst language. \$\endgroup\$
    – buttercrab
    Commented Jan 9, 2018 at 4:13
-13
\$\begingroup\$

Divisibility by 4

Your job is to write a program that checks divisibility of an integer by 4.

Restrictions:

You can't use:

  • modulo
  • binary shift/rotates
  • Divisions

You must instead do it like a HUMAN DOES by checking the last 2 digits and output a truthy value when is divisible and a falsey when not.

Non-printable characters; golfing-dedicated, whitespace and esoteric languages are forbidden.

The winner will be the code that has less characters, where white space doesn't count (tabs, spaces and newlines).

\$\endgroup\$
10
  • \$\begingroup\$ People never like when they can't use their favorite language for a challenge. I would seriously recommend removing the language restriction as it not only is it next to impossible to reliably enforce (you have been already linked several meta discussions so I'll leave that out) but it is most importantly not very fun for the people involved. \$\endgroup\$
    – Wheat Wizard Mod
    Commented Jan 9, 2017 at 0:35
  • 7
    \$\begingroup\$ @LearnHowToBeTransparent There are a number of problems here, which it is useful to point out, but I think "I hate this challenge" is unnecessary. \$\endgroup\$ Commented Jan 9, 2017 at 0:36
  • \$\begingroup\$ Can I forbid only whitespace languages, as they would automatically win by my measures? \$\endgroup\$
    – sergiol
    Commented Jan 9, 2017 at 0:39
  • \$\begingroup\$ Are we allowed to check / use the other digits, too or just the last two digits? Does looping through all digits to reach the last two digits count as "checking / looking at / using"? \$\endgroup\$
    – nimi
    Commented Jan 9, 2017 at 0:39
  • \$\begingroup\$ I think that you could because it is objective. But the much better alternative would be to simply count whitespace. Why do you want to not count whitespace. \$\endgroup\$
    – Wheat Wizard Mod
    Commented Jan 9, 2017 at 0:41
  • \$\begingroup\$ @nimi: One more time I tell you that is absolutely not necessary. You can, but that will for sure increase your non-whitespace char count! \$\endgroup\$
    – sergiol
    Commented Jan 9, 2017 at 0:42
  • \$\begingroup\$ @WheatWizard: I want to measure it in terms of "Visual Overload". Whitepace does not have any visual load and when exists even alleviates the "visual overload" of characters that have it! \$\endgroup\$
    – sergiol
    Commented Jan 9, 2017 at 0:43
  • \$\begingroup\$ Since the discussion has already grown quite long I have created a room here: chat.stackexchange.com/rooms/51421/… \$\endgroup\$
    – Wheat Wizard Mod
    Commented Jan 9, 2017 at 0:43
  • \$\begingroup\$ Implements question using whitespace. \$\endgroup\$ Commented Jan 9, 2017 at 15:11
-15
\$\begingroup\$

Write the worst Hello World program you can [popularity-contest] [super rough]

Who needs conventions? Write the most terrible Hello World program you can think of. Inefficiency, spaghetti code, you name it. Add a few gotos here and there to spice it up. Write code that has gone against everything you've ever been taught.

Be creative. This isn't about obfuscation: it's about bad code quality. Try making up your own ways of writing inefficient or unadaptable code. Have fun!

\$\endgroup\$
4
  • 8
    \$\begingroup\$ VTC because of no winning criterion, objective or not. Needs some work. \$\endgroup\$
    – Riker
    Commented Feb 28, 2016 at 2:11
  • 1
    \$\begingroup\$ I suggest a code-bowling criterion, but this is still way too broad. \$\endgroup\$ Commented Feb 28, 2016 at 2:13
  • 1
    \$\begingroup\$ As I said, it's super rough and needs a lot of work. \$\endgroup\$ Commented Feb 28, 2016 at 2:13
  • 4
    \$\begingroup\$ This is essentially code trolling, which was deemed off topic a few years ago. \$\endgroup\$
    – Dennis
    Commented Mar 9, 2016 at 1:13
1
153 154 155 156
157

You must log in to answer this question.

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