577
\$\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\$ Commented May 29 at 13:27

4831 Answers 4831

1
155 156
157
158 159
162
-2
\$\begingroup\$

PHPFuck Golf - Hello World

Like this

PHPFuck is an esoteric language in which any PHP statement can be accurately reproduced into another valid PHP program that uses only the 5 characters (^.9).

The PHPFuck converter, when given an input of echo "Hello World!", produces a block of code that is 74,450 characters long. Because the program used a lot of automatic conversions to create that block, I believe that the code can be made a lot shorter using manual optimizations.

Your task is to build a PHP program that performs the task echo "Hello World!", using only the characters (^.9). The shortest code to do so wins.

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

Polishing off a Sudoku

Given a set of 8 numbers as input, output the missing one.

Examples

12346789 -> 5

94351726 -> 8

\$\endgroup\$
1
  • 1
    \$\begingroup\$ I am fairly certain this is a dupe of a more general question. This was the first I could find, though I feel like there was one with an arbitrary range too. \$\endgroup\$
    – Giuseppe
    Commented Feb 10, 2023 at 1:51
-2
\$\begingroup\$

Print the input times infinity

Make a program/function that prints the input of the function infinite times, separated be a line break. Do note that the output must be to stdout.
tags:

\$\endgroup\$
5
  • \$\begingroup\$ Might get marked as duplicate of Implement a truth-machine or Simple cat program \$\endgroup\$ Commented Jun 14, 2023 at 22:41
  • \$\begingroup\$ Why? It endlessly returns the input with a newline regardless of what it is \$\endgroup\$
    – Dadsdy
    Commented Jun 15, 2023 at 7:02
  • 1
    \$\begingroup\$ It’s not the same challenge, but I think it’s likely to be marked as a dupe of one of those since most answers to that can be easily ported to your challenge (this practice of handling duplicates is fairly common on this site) \$\endgroup\$ Commented Jun 15, 2023 at 12:14
  • \$\begingroup\$ @noodleman Really? My answer (in (,)) was very different. \$\endgroup\$
    – Dadsdy
    Commented Jun 15, 2023 at 18:18
  • \$\begingroup\$ Exact dupe restricted-source version fastest-code version \$\endgroup\$ Commented Jul 19, 2023 at 3:57
-2
\$\begingroup\$

That is disproportionate!

You want to overwhelm your nasty boss with an error message so large that they quit their job. But your boss will fire you instead if it's too long.


Challenge

In this challenge, you have to write code that is more than 0 bytes long that produces the longest error message possible.

Scoring

Answers will be scored using this formula: $$\frac{\text{Error message length in bytes}}{\text{Programme length in bytes}}$$

Other

All answers must include the answer score, source code and error message.



Meta

  • Is this a duplicate?
  • Any other appropriate tags?
  • Anything else?
\$\endgroup\$
1
-2
\$\begingroup\$

KCMCK

Print this ASCII art:

  +--------------  +-+                   +-+   +--------------  |
 ++                | |                   | |  ++                |
 |                 |  \                  / |  |                 |
 |                 |   \                /  |  |                 |
 |                 |    \              /   |  |                 |
 |                 |     \            /    |  |                 |
 |                 |      \          /     |  |                 |
 |                 |       \        /      |  |                 |
 |                 |        \      /       |  |                 |
 |                 |         \    /        |  |                 |
 ++                |          \  /         |  ++                |
  +--------------  |           \/          |   +--------------  |
________________________________________________________________|
________________________________________________________________|

Shortest code in characters wins!

  • Any leading whitespace must be the same on every line.
  • No restrictions on trailing whitespace.
\$\endgroup\$
-2
\$\begingroup\$

Be a cat

I have not found a single challenge that asks for a plain cat programme. The closest I have found requires you to print cat goes meow when the input is cat.


In this challenge, you must read everything from STDIN, or an acceptable alternative, and print the exact text to STDOUT, or an acceptable alternative, with only the leading and trailing whitespace in the input.


Meta

  • Have I been so silly that I missed a duplicate?
\$\endgroup\$
1
-2
\$\begingroup\$

Type annotation

Given a function definition and a list of types, both valid in your language, output the function annotated with those types. Shortest code wins, since this is .

Meta

  • Is it a duplicate?
  • How should I include languages without type annotation support?
  • Does it need to be explained better?
  • Anything else?
\$\endgroup\$
-2
\$\begingroup\$

Execute... yourself!

Almost a duplicate, but only requires you to compile a subset, and is closed.


You work at a compiler factory, making compilers tailored to your customers.


Challenge

In a programming language of your choice, write a program that executes code in the chosen language. Snippets are allowed, but you may not hardcode the input.

This is , so shortest code wins!


Meta

  • To deal with languages like No, should I change it to a , or disallow languages like that completely?
  • Is it clear enough?
  • Are there any unclosed challenges this duplicates?
  • Anything else?

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

Spaceman Simulator

The song A Spaceman Came Travelling presents a fictional story about an alien coming to earth and singing; it is loosely based on the account of the birth of Jesus. The spaceman first says this:

Then the stranger spoke, he said "Do not fear
I come from a planet a long way from here
And I bring a message for mankind to hear,"
And suddenly the sweetest music filled the air
And it went
"La la la la la la la la la la la
La la la la la la la la
La la la la la la la la la la la
Peace and goodwill to all men, and love for the child
La la la la la la la la la la la
La la la la la la la
La la la la la la la la la la la"

The next day, he returns:

And just before dawn at the paling of the sky
The stranger returned and said "Now I must fly
When two thousand years of your time has gone by
This song will begin once again, to a baby's cry."

Write a program that prints this string, followed by two newlines:

Do not fear
I come from a planet a long way from here
And I bring a message for mankind to hear

La la la la la la la la la la la
La la la la la la la la
La la la la la la la la la la la
Peace and goodwill to all men, and love for the child
La la la la la la la la la la la
La la la la la la la
La la la la la la la la la la la

Then, wait until just before dawn at the paling of the sky (approximated by 06:00 system time), and print this, also followed by two newlines:

Now I must fly
When two thousand years of your time has gone by
This song will begin once again, to a baby's cry

(If the program is run exactly at 06:00, you may either do this immediately or wait 24 hours.)

Finally, wait until two thousand years of our time has gone by, and begin the song once again. (This goes on in an infinite loop; it will print everything three times if you run it for six thousand years.)

Since it's not feasible to wait thousands of years to see if a program works properly, also include an explanation of why the full version works. If you golf the text generation for any of the parts, please also include a copy of the code for each part to generate the text, separate from the main program; this way it can be determined that your code works without waiting for the paling of the sky or the return of the spaceman.

For the 2,000 year delay, wait until the same time (within a second or so accuracy) and date as when the program was started (not after the dawn), 2,000 years later.

You may assume that system time will increase monotonically throughout eternity, and that the time zone will never change.

If there is no way to wait for a duration or until a time in your language, then you may only output the text, as a complete submission would have printed 2,000 years after dawn. This will make the challenge easier in these languages, but will not give them an advantage in competing because submissions only compete within one language.

Example implementation

Here's an example in ungolfed Python. It will not work on Windows.

import datetime
import time

while True:
    now = datetime.datetime.now()

    if now.hour < 6:
        day_of_next_dawn = datetime.date.today()
    else:
        day_of_next_dawn = datetime.date.today() + datetime.timedelta(days=1)

    dawn = datetime.datetime(
        day_of_next_dawn.year,
        day_of_next_dawn.month,
        day_of_next_dawn.day,
        6,
        0,
    )

    in_two_thousand_years = now.replace(year=now.year + 2000)

    print(
        """Do not fear
I come from a planet a long way from here
And I bring a message for mankind to hear

La la la la la la la la la la la
La la la la la la la la
La la la la la la la la la la la
Peace and goodwill to all men, and love for the child
La la la la la la la la la la la
La la la la la la la
La la la la la la la la la la la
"""
    )

    time.sleep((dawn - now).total_seconds())

    print(
        """Now I must fly
When two thousand years of your time has gone by
This song will begin once again, to a baby's cry
"""
    )

    time.sleep((in_2000_years - datetime.datetime.now()).total_seconds())

\$\endgroup\$
3
  • \$\begingroup\$ This is a duplicate of [Sleep for 1000 years](codegolf.stackexchange.com/q/196917/108687 \$\endgroup\$ Commented Dec 15, 2023 at 1:42
  • \$\begingroup\$ @noodleman would it be a non-duplicate if I changed it to "print the song, wait until the next morning in local time, print the 'Now I must fly' text, wait two thousand years, and start the cycle over"? \$\endgroup\$
    – Someone
    Commented Dec 15, 2023 at 1:57
  • 1
    \$\begingroup\$ That would be further from a duplicate, but I'm not convinced it wouldn't be closed anyway. You may have noticed, but this site tends to close song-based kolmogorov-complexity challenges with high frequency. \$\endgroup\$ Commented Dec 15, 2023 at 2:18
-2
\$\begingroup\$

Write an optimal Python program for distributed worknode to find prime.

Prime is defined as a number with no divisor but 1 and itself. Write an optimised for speed program for Pythons distributed worknode to check if an input is a prime.

The usual approach is to try possible divisors to see if they are, an optimisation begins at 2 (since we have to find n/2 anyway for a limit) and does not try multiples of a possible divisor, if a number does not divide by two then no even numbers divide that number, similarly if a number does not divide by three then it does not divide by three, six and nine. No number higher than n/2 need to be tried.

Entries in programming languages other than Python are acceptable for study.

\$\endgroup\$
6
  • \$\begingroup\$ Is 1 considered prime? \$\endgroup\$ Commented Dec 28, 2023 at 23:21
  • \$\begingroup\$ @AlanBagel 1 is self prime. \$\endgroup\$
    – Willtech
    Commented Dec 29, 2023 at 14:25
  • \$\begingroup\$ twitter.com/Willtech101/status/… \$\endgroup\$
    – Willtech
    Commented Dec 29, 2023 at 14:27
  • \$\begingroup\$ ? (filler filler) \$\endgroup\$ Commented Dec 29, 2023 at 14:31
  • \$\begingroup\$ Not popular? Probably there is already a real world solution I will work on it here github.com/Willtech/Prime \$\endgroup\$
    – Willtech
    Commented Dec 31, 2023 at 5:25
  • \$\begingroup\$ @AlanBagel Actually I was looking even -3 is considered prime and 2. \$\endgroup\$
    – Willtech
    Commented Dec 31, 2023 at 5:27
-2
\$\begingroup\$

Tiniest ELF under x64 Linux to perform ROT13

We already have a ROT13 challenge. But all those solutions, while short in source form, require/produce huge binaries in order to run. A simple C implementation ends up at around ~14 KiB! If that doesn't shock you, see the quoted text below from this article (emphasis mine):

The first version of UNIX was written in PDP-11 assembler; it had 34 system calls, it was written in 4,200 lines of code, and it ran on 12KB of main memory

Goal

Create the tiniest ELF executable you can that runs under x64 Linux (4.14+), takes input from stdin, performs ROT13 on it and writes the result to stdout.

Notes

  • You may use whatever language you want (C, C++, Rust, Assembly, Hex, ...), but please provide version numbers and your environment, as well as any extra necessities (compiler/linker flags, linker scripts, custom scripts, commands, etc.) so that we can reproduce the result.
  • You may assume input will always be in ASCII.
  • It has to be a relatively complete program. You must handle errors (mainly, a system call failing). The program must exit with exit code 0 on sucess and 1 on failure.
  • I encourage you to try higher-level languages. Answers in assembly will, no doubt, be shorter, but it's interesting to see how others will fare.

This is (no loopholes), the smallest binary wins!

\$\endgroup\$
3
  • 1
    \$\begingroup\$ I feel this is still a dupe of the rot13 challenge. a Tiny Elf binary would be valid for the Rot13 challenge. \$\endgroup\$
    – ATaco
    Commented Jan 2 at 2:10
  • \$\begingroup\$ @ATaco A C (or any other language) answer that produces a tiny ELF can compete in this challenge but not in the original. \$\endgroup\$
    – pan
    Commented Jan 2 at 2:20
  • \$\begingroup\$ I get it, but even a C answer is probably just going do directly emit assembly, which doesn't make for a very interesting change of the original challenge. \$\endgroup\$
    – ATaco
    Commented Jan 2 at 21:02
-2
\$\begingroup\$

Identify RARE Kpop Manifesto's AWK one-liners

RARE Kpop Manifesto is a Code Golf & Code Challenge StackExchange user who is known for an AWK golfer. He or she is famous for posting AWK answers with just variables of underscores, not trying to follow our style of posting, trying to play a game off from us, and advising AWK programming in Stack Overflow for over 1,000 times. Today I brought their 25 AWK codes; oldest one is posted on November 1, 2022 and newest one is on June 22, 2024.

How I brought code

As of July 10, 2024 they had posted 38 answers; I chose one-line AWK codes out of them. If the answer has several AWK codes I took first one.

If the program was

echo 'Hello, World!' |

gawk '{ print $0 }'

then I took

{ print $0 }

as a data. If the program had some assignments or flags, like

echo 1.1b2.2b3.3b4.4 |

mawk -F b 'BEGIN { __ = __^__ }; { for ( _=NF; _--; ORS = ORS ___ ) print $_ * ___; }' ___=`ps -Ao pid,etime,pcpu,vsz | cksum`

then I took

-F b 'BEGIN { __ = __^__ }; { for ( _=NF; _--; ORS = ORS ___ ) print $_ * ___; }' ___=`ps -Ao pid,etime,pcpu,vsz | cksum`

as data. The code may have some escapes because they were intended to be run from shell, but took as-is. E.g.

nawk \$_=RS=ORS

to

\$_=RS=ORS

Challenge

Given an one-line AWK program, identify on which answer post it appears.

Input

One of one-line AWK program shown in the dataset below, as a strings.

Output

An integer to indicate the post id of the answer corresponding to the input. However since every id is greater than 200,000 and less than 300,000, you may output only bottom five digits. E.g. if the answer is 234,567, then you may output 34,567 instead.

Scoring

Number of IDs your program or function answered correctly, which is N/25.

Tie-breaking

Dataset

The format is:

answer-id program

Here are 25 test cases:

253982 function __(_){return index("=anebarprayunulugepctovec",substr(_,2,2))/2}
254001 __=$(_^=___=_<_){++_;do{___+=__%_}while(__=int(__/_))}$!NF=___ ""
254007 -F\[^FU] NF=NF OFS=T
254012 NF+=sub("  ",OFS=" "tolower($2=$4=$1)" ")
255693 '{for(_=NF-2;1<_;_-=3)$_=","$_}NR' FS= OFS=
255694 ($_+=$2)_
255695 /%[dfrs]/
255696 -M 'function __(_){return _*_==_?+$_:$_*__(--_)}($_=__(NF*=!/0/))_' FS=
255709 $_*=$++_++/(_+_--)
256002 gsub("[^"$NF"]",_,$--NF)
256043 'function __(_){return $_=--_?_+=_=__(_):!_}__(NF=$_)' OFS=,
259913 ($_*=$2)_
260775 function ___(_,__) { gsub(".","\\&& ",__)gsub(".",__,_); return _ }$++NF = ___($++_, $++_)
260782 $__=sprintf("%.f",($5-($2$3))/(_+=$_)^!!_)
261246 BEGIN { print (_+=++_)!_!!_ _^_ }
261310 gsub(_,"!")
263592 func __(_){return(-_<_)-(_<-_)}
265230 function leap(_) { return _~"(([2468][048]|[13579][26]|(^|[0+-])[48])(00)?|0000|^[+-]?0*)$" ? "y" : "n" } ($2 = leap($1))^_
269628 '($++NF=(__=$++_)*(_!_)^((__=length(__))-$(_+_)%__)%((_!_)^__-_--))' FS=,
269629 NF=OFS=\$_
272251 $_=int(3E-3^-4)-102
273321 gsub(/./,"&&")_
273407 BEGIN{print$-($_=(_="*****")_)^gsub(/./,RS$_)}
273687 '$_=substr($2,$_,1)' FS=' ?"'
273743 'ORS=RT?length(RT):_' RS=0+

Notes

260775 was originally two-line answer but joined into one line. 265230 was originally three-line answer.

More rules

About source code

https://stackoverflow.com/help/licensing

Content contributed on or after 2018-05-02 (UTC) is distributed under the terms of CC BY-SA 4.0.

Meta

  • To @RareKpopManifesto: can I post this question?
  • Other tag ideas?
\$\endgroup\$
-2
\$\begingroup\$

Print an interesting number

An interesting number is a number which can be written as an expression which is shorter than the number itself.

The following 150-digit number is interesting. Write a function or program that outputs this number to the console.

654747700701377386126856657861679570529800895801424573182559133258946484061065580876771978236269380302819034101955696785289596873888391234225359484521

Rules

You may either print the output, or return a string or integer from a function. A trailing newline is allowed.

This is , so shortest answer in bytes wins!

\$\endgroup\$
5
  • \$\begingroup\$ OK, so I got two down-votes, but no comments! Can someone please comment so I can make improvements to the question. \$\endgroup\$ Commented Jul 25 at 5:50
  • \$\begingroup\$ printing a fixed string is too boring especially as the string is quite short \$\endgroup\$ Commented Jul 25 at 16:40
  • \$\begingroup\$ If you mean 0x333497d0ef5042a6ea65420e47cc6489890b9be6ca3877c1862b31f09c9074d96ce7f90bde052cf23730fb0d1bb02c3462af4e4713aea20d5de105106f669 then almost every integer is interesting, which is not good. Unless generator of your number is given \$\endgroup\$
    – l4m2
    Commented Jul 27 at 5:16
  • \$\begingroup\$ @l4m2 The answer I have in mind is an expression of the form a** b+c** d. The numbers a,b,c,d are quite small. Would this be a more interesting question, if I added that hint to the description? \$\endgroup\$ Commented Jul 27 at 6:01
  • \$\begingroup\$ Then it's interesting but not here, maybe puzzle.SE \$\endgroup\$
    – l4m2
    Commented Jul 27 at 6:43
-2
\$\begingroup\$

Short Query, Long Answer

Give ChatGPT 4o a prompt to get it to generate as long a message as possible.

\$\text{Score} = {\text{Output Length}\over{\text{Input Length}}}\$

Highest score wins! (Will add more details later, it’s 10:16pm as of posting)

\$\endgroup\$
2
  • \$\begingroup\$ Immediately a -1… do you hate LLMs? \$\endgroup\$ Commented Aug 16 at 21:29
  • 5
    \$\begingroup\$ LLMs are nondeterministic and it's impossible to test past versions of them, which doesn't fit well with our definition of "language" on this site. \$\endgroup\$
    – emanresu A
    Commented Aug 16 at 21:57
-2
\$\begingroup\$

Fast! Factorial!

Calculate the factorial of an integer.


The submission with the lowest time complexity wins!


Meta

  • What is the tag for time complexity challenges?
  • Anything else?
\$\endgroup\$
1
-2
\$\begingroup\$

Symmetrical Function

Objective: Write a symmetrical function that outputs the string 'code golf'. The function itself must be symmetrical, and when executed, it should output the exact string.

Requirements:

  1. The function must be symmetrical, meaning it should read the same forward and backward.

  2. The output must be exactly 'code golf' when run.

  3. Minimize the number of characters used in your solution (code golf).

  4. The symmetry must be in the code structure itself, not just in comments or output.

Bad Example (Not allowed):

print("code golf") # ("flog edoc")tnirp

This example is invalid because the code structure is not truly symmetrical — the symmetry only exists in the comment, which does not contribute to the function's execution.

Rules:

The function must maintain visual symmetry in the code itself (excluding comments).

The function must execute properly and output only 'code golf'.

Any programming language can be used.

\$\endgroup\$
4
  • \$\begingroup\$ Disallowing comments is a bad requirement. \$\endgroup\$ Commented Oct 9 at 0:19
  • \$\begingroup\$ @DannyuNDos I think that allowing comments will make this much too mundane. \$\endgroup\$
    – jdt
    Commented Oct 9 at 0:50
  • \$\begingroup\$ There have been past attempts to enforce palindrome code with banning comments, like this one, and they didn't go well. \$\endgroup\$
    – xnor
    Commented Oct 10 at 6:42
  • \$\begingroup\$ I'd recommend calling them 'palindromic', rather than 'symmetric'. The term "visual symmetry" makes me think that suns or bod might be valid answers. \$\endgroup\$
    – nyxbird
    Commented Oct 12 at 14:01
-3
\$\begingroup\$

Code-challenge: Guess my number

The challenge

You have a number from 1 to 10 in mind, and your program should ask questions to find out which number. These questions can be any questions, the program only has to find out the number as fast as possible.

Your program should ask a question, such as "Is the number a prime?", and the user must answer either y or n (yes or no). Ask questions until you know the number.

The scoring

To calculate the score, you need to take the sum of the question count for each number. For example, if you need 1 question to find the number 1, 2 questions to find the number 2, and so on, the score is 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10, so the score is 55.

Important note: the question count for a specific number must always be the same. For example, if you need 4 questions to find out the number 10, then you have to ask always 4 questions to find out the number 10, otherwise it is impossible to calculate the score.

\$\endgroup\$
3
  • 6
    \$\begingroup\$ boooring. The Huffman tree for a uniform set is any perfectly balanced tree. The question asks us to perform a binary search on the usr device. Is the number greater than 5? Is the number greater than 2? Is the number greater than 1? Hey' I think it's 1. \$\endgroup\$ Commented Jan 2, 2014 at 11:49
  • 3
    \$\begingroup\$ Maybe if this were a pop-contest and the goal was to make the most original set of questions while still keeping the score at its theoretical minimum. \$\endgroup\$ Commented Jan 3, 2014 at 5:28
  • \$\begingroup\$ This is off-topic and AI is off-topic for this site \$\endgroup\$
    – Fmbalbuena
    Commented Nov 12, 2021 at 17:39
-3
\$\begingroup\$

Popularity Contest: Implementation of a Hash Table

Create a class in some OOP language for a hash table that supports getting, setting, and removing values. You can't use the built in hash table/dictionary/map implementation. Highest votes in one week wins.

A key is any valid string. A value is any valid string, number, or boolean.

Example functionality:

hash.set("key","value");
hash.get("key"); // returns "value"
hash.set("key", 1234);
hash.get("key"); // returns 1234
hash.set("key2",hash.get("key"));
hash.get("key2"); // returns 1234
hash.delete("key");
hash.get("key"); // returns null/undefined/none/etc. or throws an error
hash.get("key2"); // still returns 1234

Definition of a hash table (from Wikipedia):

In computing, a hash table (also hash map) is a data structure used to implement an associative array, a structure that can map keys to values. A hash table uses a hash function to compute an index into an array of buckets or slots, from which the correct value can be found.

The hash table cannot be simply an array that is searched in linear time. It must be an actual hash table that uses a hash function to map the keys to the value.

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Popularity contest and shortest don't mix. That aside, the spec is too vague. What is a "value"? What assumptions can be made about hashcodes? If the language makes all types nullable, should null be permitted as a key? What should the type be in languages which have co- and contravariance? And for that matter, what qualifies as a "hash table", bearing in mind that people will try to exploit any loophole? \$\endgroup\$ Commented Jan 2, 2014 at 23:16
  • \$\begingroup\$ @PeterTaylor Thank you for the feedback! Please see my edits, and let me know what you think. Could you meant about co/contravaraince? I looked at the wikipedia article about it but I'm not really sure how that has anything to do with this question. \$\endgroup\$
    – hkk
    Commented Jan 2, 2014 at 23:37
  • \$\begingroup\$ I think it's still vulnerable to the loophole of "I have a hashtable with one bucket" (i.e. it's really a list of (key, value) pairs which I traverse in linear time). The thing about variance is to do with static typing of the elements of the map. E.g. in Java Map<String, Integer>'s get method has signature public Integer get(Object); in C#, a Dictionary<string, int>'s Get method has signature public int Get(string). The edited version makes it clear enough that the hashtable isn't expected to be genericised. \$\endgroup\$ Commented Jan 3, 2014 at 0:08
-3
\$\begingroup\$

Bovine Ignorance

I'm curious about code which still works after being mangled by figlet, toilet, cowsay et al, but I'm not sure whether this in any way sane.

What I'm toying with is a challenge in which a participant may submit any program in any language. It should be possible to use this program's source code as input to cowsay or whatever, and the result should be another valid program in any language, which still does a similar thing. For instance, the following bf program prints Hello world! with no newline:

+++++ +++++
[
> +++++ ++
> +++++ +++++
> +++
> +
<<<< -
]
> ++ .
> + .
+++++ ++ .
.
+++ .
> ++ .
<< +++++ +++++ +++++ .
> .
+++ .
----- - .
----- --- .
> + .
+++++++++++++++++++++++++++++++++++++++++

Running cat ./prog.bf | cowsay -e .. -T $'>.' yields the following output:

 _________________________________________
/ +++++ +++++ [ > +++++ ++ > +++++ +++++  \
| > +++ > + <<<< - ] > ++ . > + . +++++   |
| ++ . . +++ . > ++ . << +++++ +++++      |
| +++++ . > . +++ . ----- - . ----- --- . |
| > + .                                   |
| +++++++++++++++++++++++++++++++++++++++ |
\ ++                                      /
 -----------------------------------------
        \   ^__^
         \  (..)\_______
            (__)\       )\/\
             >. ||----w |
                ||     ||

Which is itself a valid bf program which prints Hello world!!!, followed by a newline.

The problem with using bf here is that it ignores most of the cow, making this a bit too easy. The problem with using any other language is that it doesn't ignore most of the cow, making this far too difficult. Is there a sensible middle ground I could pick for this? I don't think it's impossible, I'm fairly sure you can exploit cowsay's behavior on one-liners to produce valid svgs, but I'm not sure how best to pose this challenge. Any ideas?

\$\endgroup\$
6
  • 2
    \$\begingroup\$ I could not think of any language that falls in the middle ground. Even brainfuck is affected by the -----------------------------------------..>.---- inserted by cowsay. Most languages have strong parsing rules that would not cope with being post-processed by cowsay. The few exceptions for this will be either completely unaffected or badly affected, making the challenge uninteresting. \$\endgroup\$ Commented Feb 19, 2014 at 12:32
  • \$\begingroup\$ Actually, you can't transform just any brainfuck program to cowsay-brainfuck. Namely those that can output fewer than three characters cannot be transformed at all. \$\endgroup\$ Commented Feb 19, 2014 at 14:52
  • \$\begingroup\$ @JanDvorak, I was intending to allow competitors to choose the parameters of their calls to cowsay. For the uninitiated, -e controls the string used for eyes and defaults to oo, and -T controls the string used for the tongue, defaulting to ` U`. This is all yak-shaving, though, and having written this up and read the comments, I suspect that this idea has neither legs, horns nor udders. \$\endgroup\$
    – ymbirtt
    Commented Feb 19, 2014 at 23:19
  • 2
    \$\begingroup\$ If I could propose a variant that is more feasible, you could do a challenge like "Write a program in your language of choice that draws ASCII art of a cow saying something (does not have to be identical or even similar to the cowsay art). The entire drawing must itself be valid source code that does something other than no-op. Post results of both programs." That gives people more leeway to work around the specific restrictions of their compiler. \$\endgroup\$ Commented Feb 21, 2014 at 23:22
  • \$\begingroup\$ Ok, I found a language that falls within the middle ground: whitespace. Anyway, this question has a too narrow scope to develop an interesting challenge. \$\endgroup\$ Commented Feb 22, 2014 at 18:31
  • \$\begingroup\$ @JonathanVanMatre That would be a subjective validity criterion, and would probably be closed as too broad. \$\endgroup\$
    – wastl
    Commented Jul 2, 2018 at 13:55
-3
\$\begingroup\$

99 Bottles of Errors

While there are already many versions of "print 99 Bottles of Beer," I thought another one wouldn't hurt.


The challenge is fairly simple: print the lyrics to 99 bottles of Beer to STDERR. I don't care how you do it, so long as the entire lyrics show up. An entire program is required, so the following Java program would be invalid (even if it did do the correct thing):

System.out.println("99 Bottles of Beer on the Wall, take one down and pass it around...");

The scoring:

  • This challenge is , so shortest code by byte count wins.
  • If necessary, assume UTF-8 is the character encoding used.

The rules

  • All the code must be in one file.
  • Any language is allowed.
  • Reading input, whether it is from STDIN, a file, or the web, is not allowed.
\$\endgroup\$
1
  • 6
    \$\begingroup\$ This is trivial in some languages (Java), where it reduces to a simple kolmogorov challenge, and impossible in others (those that have no distinct STDERR) \$\endgroup\$ Commented Mar 27, 2014 at 7:42
-3
\$\begingroup\$

Create an Identicon Generator

The challenge is to create an identicon generator. The identicons must be randomly generated, so we get a new identicon for each key the program receives. You can input a key using std-in or you can use your language's random number generator for the key.

In order to make your identicon look reasonably nice, it must generate a picture, then rotate that picture around the bottom right corner, the way this mockup shows:

enter image description here

The output must be to a PNG file. Shortest code wins.

\$\endgroup\$
3
  • 5
    \$\begingroup\$ Far too broad. As this stands I can create a 1-pixel image whose colour is just the key. I don't think this question will be ready to go until you've found a way to prevent me from making the images differ only in their palette (and to pre-empt, I think that adding a rule "Images may not differ only in their palette" isn't a real fix). \$\endgroup\$ Commented Mar 28, 2014 at 14:50
  • 5
    \$\begingroup\$ If you just ask for "random" images, you'll get images that are either hardly random at all (a solitary pixel in a random location), or completely random (noise). To get something "reasonably nice", you'll have to provide very clear instructions on how to produce these images. I suggest you try creating a few of these yourself, and find a minimal set of rules that produces results that look OK. Include requirements on dimensions (100x100px?), selection of colours (at least 2, not too similar), and drawing method (e.g., "five triangles with random vertices and a minimum area of 20 px²"). \$\endgroup\$
    – r3mainer
    Commented Mar 28, 2014 at 15:25
  • 1
    \$\begingroup\$ How important is the PNG file output? This will be a challenge in itself for many languages. Would you accept an uncompressed non-interlaced format like PPM? \$\endgroup\$ Commented Apr 16, 2014 at 9:45
-3
\$\begingroup\$

Shortest Program that May or May not Terminate:

Write a program such that whether or not it terminates depends on the answer to an unsolved question in Computer Science or Mathematics. For example, your program might test the Goldbach conjecture for every N and quit if a counterexample is found, or hunt for odd perfect numbers. Please include an explanation of why your program may or may not terminate!

Note: assume infinite memory and stack size, because otherwise they all terminate. Your program must be self contained, take no input, and only use standard libraries. This is Codegolf, so shortest code wins!

\$\endgroup\$
6
  • \$\begingroup\$ What about "unsolvable" problems, e.g. halting problem? Can I take another code as input and terminate if that terminates? Because that other program may or may not terminate, and there's no way to tell. \$\endgroup\$ Commented Nov 20, 2014 at 18:03
  • \$\begingroup\$ The intention was that the program isn't allowed to take input. I'll be more specific. \$\endgroup\$ Commented Nov 20, 2014 at 18:50
  • 2
    \$\begingroup\$ Does this differ from this previous question in the sandbox? \$\endgroup\$ Commented Nov 20, 2014 at 19:34
  • \$\begingroup\$ (even if not the comments explaining why that one wouldn't work as a question may help Taylor this one) \$\endgroup\$ Commented Nov 20, 2014 at 19:35
  • \$\begingroup\$ The intent of this doesn't differ significantly from the question you linked, I searched posted questions but forgot to search the sandbox. \$\endgroup\$ Commented Nov 20, 2014 at 19:41
  • \$\begingroup\$ Infinite memory isn't required. \$\endgroup\$
    – feersum
    Commented Nov 20, 2014 at 21:46
-3
\$\begingroup\$

Every number is interesting

We know that every number is interesting but how?

You should write a program or function which:

  • takes a list of N positive integers (>0 and <2^31)
  • outputs N lines each of them showing how the corresponding input number is interesting
  • is not longer than 1024 bytes
  • uses no more than 1 second per number
  • doesn't use external sources

Examples

172: 444 in base6
5776: 76*76
9801: 9 * 1089 (reverse)
68101: no 11 in base2 (10000101000000101)
491033: 317 * 1549 (product of 2 big primes)
467808816: no digit 5 from base6 to base10

Inputs

You should include the output for the following input in your post:

58 92 120 224 358 490 912 1578 7812 222008 1645060 19796411 550453633 

If you care to run your program on a bigger sample and share the result with us use this input data (2500 numbers). (You can upload your output to e.g. pastebin.)

This is a popularity-contest so highest voted answer wins.

Tags: popularity-contest, number

\$\endgroup\$
7
  • 1
    \$\begingroup\$ What sort of criteria are necessary for defining a number as 'interesting'? I see things like square numbers, other bases, etc. But are there any specifics? I'm interested in this challenge (but worried it might be closed as too broad). \$\endgroup\$ Commented Apr 7, 2015 at 13:18
  • \$\begingroup\$ @ASCIIThenANSI There wasn't a clear definition. That's part of the reason why I abandoned the challenge. \$\endgroup\$
    – randomra
    Commented Apr 8, 2015 at 1:55
  • 1
    \$\begingroup\$ Would you mind if I tried taking it up? I would have to post as a new answer, because I can't directly edit. \$\endgroup\$ Commented Apr 8, 2015 at 2:00
  • \$\begingroup\$ @ASCIIThenANSI Not at all. \$\endgroup\$
    – randomra
    Commented Apr 8, 2015 at 2:01
  • \$\begingroup\$ @ASCIIThenANSI Where did you post it? \$\endgroup\$
    – wizzwizz4
    Commented Jul 24, 2019 at 13:33
  • \$\begingroup\$ @ASCIIThenANSI I am also curious \$\endgroup\$
    – MilkyWay90
    Commented Aug 27, 2019 at 23:41
  • \$\begingroup\$ I don't think he posted it or at least with this account. (he only has asked 1 question and it is not this one). \$\endgroup\$
    – Bjop
    Commented Sep 9, 2022 at 10:58
-3
\$\begingroup\$

Something Else - ASCII Art maker:

A text to ASCII art generator maker, the program must input a string and return ASCII art from it. Something like patorjk.com/software/taag/. It has to use the Graffiti font. The winning criteria is the whoever gets the most likes.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Hello! Just a few things to point out: 1) The current spec is very broad. For example, what fonts, how does spacing look, what characters need to be supported... there's a lot more details that need to be included than just "return ASCII art of this text" \$\endgroup\$
    – Sp3000
    Commented Feb 24, 2015 at 4:07
  • 1
    \$\begingroup\$ 2) What's the winning criterion? Popularity contest? Code golf? \$\endgroup\$
    – Sp3000
    Commented Feb 24, 2015 at 4:08
-3
\$\begingroup\$

Identifying a Sonnet

This challenge is about determining if a given file (read-in from stdin) meets the criteria to be a sonnet. You may use any language for this challenge. If your language supports an API to use an online dictionary you may use that API, if your language doesn't then too bad.

Additionally, it is preferred if your language is one that can be ran directly from the command line and is a language that has a compiler or interpreter available directly from my distro's repos(Fedora), as I would rather just use a bash script to test the various programs, then test each program manually.

Definition of a Sonnet

  • Has 14 Lines (lines are denoted as the standard newline on your operating system).
  • Has a definite rhyme scheme, it will have one of the following rhyme schemes
    • ABBA ABBA CD CD CD
    • ABBA ABBA CDE CDE
    • ABAB ABBA EFEF GG
  • Iambic Pentameter - consists of alternating stressed, unstressed syllables. This doesn't have to be perfect 100% of the time, just at least 50% of the time.

In order for your program to declare a given string a sonnet, it must meet all of the above criteria.

Additional Notes

You do not have to identify the following:

  • Thought Structure - too intense for a code golf challenge, and too subjective.
  • Topic - computer lacks context to determine this

Input

Input will be read from stdin. This is the string that you will be declaring to be or not to be a sonnet.

Output

Your program will output either yes or no for the question:

Does this string meet the given requirements to be a sonnet?

As this is code golf yes or no can be abbreviated to Y/N.

Winner

The solution with fewest number of bytes win that has the highest accuracy ratio for the correct identification of a sonnet. The preference is for higher accuracy rather than brevity of the program.

Test Data and Resources

What is not a sonnet

The following are examples that you program should return false on:

  • Beowulf
  • Haiku
  • Input that doesn't have exactly 14 Lines in it
  • The text of this question.
  • The text of just about any other question on StackExchange.
  • Things that don't have a rhyme scheme. See Below

Not A Sonnet

A man got on a boat
The boat was leaky
and had poor construction
For it was made by a one-eyed blind man
and his dumb intern
As soon as he got out of port
at the fort
it started to sink
eventually, it tanked.
And it capsized
If only that shipwright
wasn't so blind deaf and dumb
as microsoft tech support
That's not much support at all.
\$\endgroup\$
9
  • 3
    \$\begingroup\$ I think without dictionaries for rhymes and stresses this is probably not a good idea. Of course you can use some sort of accuracy ratio, but then you also need false positives, and you need a lot more examples than the few on the pages you've linked. But if you do this there's no requirement to actually recognise the sonnets by their rhymes and stresses - instead, I'm pretty sure, people will just regex golf the test sets. \$\endgroup\$ Commented Mar 24, 2015 at 19:36
  • \$\begingroup\$ @MartinBüttner I updated the requirements with an accuracy percentage, and added the option to use an API to look up terms from a dictionary. \$\endgroup\$
    – HSchmale
    Commented Mar 24, 2015 at 19:57
  • 1
    \$\begingroup\$ 1. Test data which only covers one possible output isn't test data. I can write a program which always outputs Y in as little as one byte and it will pass all of the linked "test data", but it comes nowhere near to meeting spec. 2. Unless you specify which rhyme/stress dictionary to use, you can't guarantee that the test data is "correct". \$\endgroup\$ Commented Mar 24, 2015 at 20:20
  • \$\begingroup\$ @PeterTaylor I added examples of what is not a Sonnet. \$\endgroup\$
    – HSchmale
    Commented Mar 24, 2015 at 20:32
  • 1
    \$\begingroup\$ I'm not sure how to say this, but it feels as though this task has a lot of individual parts, each of which could be quite tricky. Especiallly detecting rhymes/syllables/stresses, since words can be pronounced/stressed differently based on context. Also if you're using Shakespeare's sonnets I have no idea where to get rhyming and stress dictionaries for Elizabethan English... \$\endgroup\$
    – Sp3000
    Commented Mar 25, 2015 at 14:18
  • \$\begingroup\$ To make this interesting, you'll need some interesting near-misses: non-sonnets that can't be detected by something simple like counting lines or words per line. \$\endgroup\$
    – xnor
    Commented Mar 25, 2015 at 20:59
  • \$\begingroup\$ @xnor You mean a file with a that looks like a sonnet but has no rhyme. \$\endgroup\$
    – HSchmale
    Commented Mar 25, 2015 at 21:04
  • \$\begingroup\$ Yes, for example. Or, one with rhyme by wrong rhythm. Or, one with nonsense characters that seem to "rhyme". \$\endgroup\$
    – xnor
    Commented Mar 25, 2015 at 21:06
  • \$\begingroup\$ @Sp3000 You can just use modern english, or just base it on words that have similar endings. \$\endgroup\$
    – HSchmale
    Commented Mar 25, 2015 at 21:11
-3
\$\begingroup\$

Represent a Number in the Strangest Way You Can Think Of.. while staying under 8 unique characters

Your goal is to represent some numbers in the strangest way possible.

Rules:

  • The result must be a number that can be used in the programming language like any other ordinary number. For instance, <my expression> + 3 should return 3 more than the value of <my expression>.
  • The code must be under 20 kilobytes. That's a rather large size for a number so you should be all set.
  • The expression must have under 8 unique characters! The length of it can be as long you want, just keep it under 8 unique characters. aaaaaaaaaaaaaaaaaa is valid (if it works in the programming language) but abcdefghijklm isn't valid because it uses 8 or more unique characters.

Guidelines:

  • The goal here is to represent a number in the strangest and most interesting way possible, so if I ask you to represent the number 35 it would be a good idea to respond with something more interesting than 35 or 12 + 23.
  • This isn't a ! Feel free to make your code as long as you want, so long as it's under 20 kilobytes. Fancy code can look nice!
  • The code doesn't need to support decimals (floats) but if it does, it will get 10 extra points (see below).
  • The code also doesn't need to support negative numbers (for instance -37) but if it does, it will get 10 extra points (see below).
  • Try to make your post follow the below:

Post format:

Language

Description

0

...

1

...

30

...

108

...

1337

...

1234567890

...

3.1415 [10 bonus points if you can get this!]

...

-25 [10 bonus points if you can get this!]

...

Bonus numbers:

...

The points is equivalent to the number of votes on the answer plus 10 if it supports decimals with 10 more points if it supports negative numbers. Whoever has the highest points is considered the current winner. Have fun!


This is my first go at making a popularity contest so if you have any tips those would be appreciated.. :)

\$\endgroup\$
7
  • \$\begingroup\$ This is a great challenge... whoever downvoted this has to rethink their concept of code-restriction challenges... \$\endgroup\$ Commented Jul 15, 2015 at 22:49
  • \$\begingroup\$ Ah, thank you. :) \$\endgroup\$
    – Nebula
    Commented Jul 15, 2015 at 23:28
  • \$\begingroup\$ Updated again with negative numbers added (-25), as well as 1 and 0. \$\endgroup\$
    – Nebula
    Commented Jul 15, 2015 at 23:33
  • \$\begingroup\$ @Sp3000 8 unique chars, not 8 total. \$\endgroup\$
    – isaacg
    Commented Jul 16, 2015 at 10:04
  • \$\begingroup\$ @isaacg Didn't I state that? \$\endgroup\$
    – Nebula
    Commented Jul 16, 2015 at 11:11
  • \$\begingroup\$ @liam_ You did, the person I was responding to who deleted their comment missed it. \$\endgroup\$
    – isaacg
    Commented Jul 16, 2015 at 11:32
  • 1
    \$\begingroup\$ TBH, I think this is such a poor popcon that it can't be rescued, but if you want to at least make it clear what you're asking then: 1. You talk about representing "a" number, but also about "support[ing] decimals" and "support[ing] negative numbers". What exactly do you want? A function which maps numbers to code? But if so, the "Post format" makes no sense. 2. What is the code which has a 20kB limitation? Total for all the numbers listed in the "Post format"? Each individual number listed in the "Post format"? Something else? 3. Are the 8 distinct characters per number or for all numbers? \$\endgroup\$ Commented Jul 17, 2015 at 16:19
-3
\$\begingroup\$

Stop the dance!

Your sister was at the hospital, but now she's fine, awfully, you lost a day of work, one of your most important days.

You work at your local television, and they have a contest, called "Stop the dance!", what is it about?: People is dancing, they have a big screen in the wall, while it says "Dance!", they have to dance, if it says "Stop!", they must stop, if you move, you lose.

You don't have internet at the studio, so you use some strange offline data sharing method. The day you weren't there, another programmer came, such a silly programmer! He made a "Reciever" program, basically, gets data, processes data and prints data in the Big Screen Wall.

The programmer was bored, so he made a way to get data, well, you don't know what way he choose! (Author comment: Let's assume he made all the possible ways. Cya.) Now you have to make a sender program, in any language, that sends data to that program using the protocol specified under this section.

You are an expert code golfer, so you decide that you must make the shortest code possible. (Another author comment: Any lang is allowed. Cya.)

How did I came out with this idea?

Having a shower, my friend...

Your task

You must make the shortest (and winner) code possible, that sends data to the reciever, using this protocol:

The reciever must recieve:

$displaytext:"<text here>";$instnm:<integer here>;

$displaytext corresponds to what it is going to be displayed on the Big Screen Wall.

$instnm corresponds to the number of the instruction, the count of things displayed, starts from 1.

Your program may take an input, and send the data, in any way (except the ones in Rules) to the Reciever. Remember there's no internet.

The winner will be the user with shortest bytes of code.

Rules

As a good code golfer, you may not:

  • You can't use program arguments to send the data.
  • It must be an application.
  • If you apply for the bonus, mind you have to make both programs, if not, just the sender.
  • The string you have to send it has to be STRICT, no different ones, if not, unvalid answer. (I decided to call that "Strict JASON Protocol", get the joke?)

Bonus

You can make the reciever program, and you get -1 byte. Not much, but k. (In bytes, you must not decrement your byte result, you must do: "n Bytes + Bonus")

Example Input and Output

Input:

From Sender program:

Dance! or Stop!

Protocol:

Inbetween both commands

$displaytext:"Dance!";$instnm:5

Output:

In Reciever program:

Dance! (9) or Stop! (187)

Overall objective:

Send data between two programs, without internet connection.

Edit: i can't post an example answer, because then i can give ideas of how to do this codegolf/puzzle, while the ideas are limited, i'm finding for the creativity of the user.

\$\endgroup\$
4
  • 9
    \$\begingroup\$ I have no idea what you're asking me to do. \$\endgroup\$ Commented Feb 3, 2016 at 21:26
  • \$\begingroup\$ It is pretty clear what is asking you to, is defined in Task (You must make the shortest (and winner) code possible, that sends data to the reciever, using this protocol), all the story and background is defined on Introduction. I dont see any hole on the post. \$\endgroup\$
    – TheCrimulo
    Commented Feb 3, 2016 at 22:11
  • \$\begingroup\$ @TheCrimulo Example answer? \$\endgroup\$
    – Xwtek
    Commented Feb 7, 2016 at 7:06
  • \$\begingroup\$ There is no Example, because you are just sending the same info you wrote in. If you type ´Dance!´, the output will be Dance! (n), n being the number of the sequence. The idea isn't to read input, and append (n) to it. You have to make it, in anyway (except command args/internet), dropping out the enoded data (input in the protocol), and, if necessary, make a reciever program, the reciever program its a bonus that discounts 1 byte, also, it can help you making your sender smaller. I can, i.e., make a file with the info on it. As explained, the reciever will read it. \$\endgroup\$
    – TheCrimulo
    Commented Feb 7, 2016 at 15:54
-3
\$\begingroup\$

Biggest single character

This challenge is simple, its like the challenges we've had before where the goal is to produce the biggest output one can. But in this one, you can only use one character in your code.

You get no input, your code has to be a single character (not byte), and the person with the largest output in byte wins, ties broken by posting time.

\$\endgroup\$
7
  • 5
    \$\begingroup\$ Doesn't this boil down to which language has the biggest output stored in a predefined variable? \$\endgroup\$
    – Denker
    Commented Apr 3, 2016 at 20:50
  • \$\begingroup\$ @DenkerAffe true. maybe i should make it 2 byte src code. that might allow some interesting stuff \$\endgroup\$
    – Maltysen
    Commented Apr 3, 2016 at 20:52
  • 1
    \$\begingroup\$ I think I would raise the char amount a bit more to allow for some competition between the same language. Also you should keep in mind that this rules out every non-golfing language. While this should be allowed per meta consensus, I am not sure how much the community likes this. \$\endgroup\$
    – Denker
    Commented Apr 3, 2016 at 20:58
  • \$\begingroup\$ G for pyth wins :D :D \$\endgroup\$
    – Leaky Nun
    Commented Apr 4, 2016 at 4:45
  • 3
    \$\begingroup\$ Befunge & co. would probably win via infinite output. If output has to be finite though, I wouldn't consider this a very interesting challenge since it would just be one big language hunt. \$\endgroup\$
    – Sp3000
    Commented Apr 4, 2016 at 10:27
  • \$\begingroup\$ Actually, N in Seriously wins. 11752 bytes output. \$\endgroup\$
    – user45941
    Commented Apr 6, 2016 at 4:06
  • \$\begingroup\$ @Mego Vitsy wins. 0 bytes, 11752 bytes of output. \$\endgroup\$ Commented Apr 7, 2016 at 17:07
-3
\$\begingroup\$

Alphabetization 101 (popularity contest)

Your task is to use all 52 letters of both the uppercase and lowercase alphabet, ONCE and ONCE only, and make a program.

You are free to use any other ASCII character more than once, or use a letter of the alphabet more than once if it's required for the language to function.

Meta:

  • Not sure if this has been done before.
  • Any questions regarding the task?
\$\endgroup\$
5
  • \$\begingroup\$ Not really meta: Is there any place I can go to (like a chat or something) to post a question about BF? StackOverflow probably isn't suitable. \$\endgroup\$
    – clismique
    Commented Apr 17, 2016 at 6:48
  • 1
    \$\begingroup\$ Come to our chatroom! :) \$\endgroup\$
    – Leaky Nun
    Commented Apr 17, 2016 at 6:50
  • 3
    \$\begingroup\$ I would vote to close this as too broad. It's not a particularly interesting restriction per se, and it certainly doesn't make a good question without some restriction on the task to be performed. \$\endgroup\$ Commented Apr 17, 2016 at 14:07
  • \$\begingroup\$ @PeterTaylor That's why it's a popularity contest, though - it lets the people decide whether the program made is good or not. What WOULD be a good restriction on the task? \$\endgroup\$
    – clismique
    Commented Apr 18, 2016 at 1:40
  • \$\begingroup\$ The popularity-contest tag is not an excuse for a broad challenge. "Write a program that does anything..." is pretty much the definition of "too broad", regardless of any source code restriction put on the program. So at least you should choose a specific task. Could be anything really, but if it relates to the restriction it might be more interesting (e.g. a pangram checker). Even so, I agree with Peter that the restriction isn't particularly interesting. There are tons of languages where it's trivial to avoid unwanted letters and then include the remaining ones in a string or comment. \$\endgroup\$
    – Martin Ender Mod
    Commented Apr 21, 2016 at 7:04
-3
\$\begingroup\$

Why did I come to Sandbox?

I have a very specific challenge, and I wanted to see if it was too specific.

The challenge is to output "Valdosta ACM" using the shortest number of characters with the BrainF**k programming language.

I've noticed it isn't the norm to specify a programming language on this domain, so I've come here to get feedback on whether or not this is acceptable.


Introduction

As a challenge to the members of my local Association for Computing Machinery(ACM) chapter, I asked them to produce the shortest Brainf**k code that would output "Valdosta ACM".

This was a very fun challenge for all of our members, and we got very competitive! I was impressed with the solutions turned in, but I wondered if it was possible to beat our best solution. Surely it's possible, but who could do it?

Challenge

Output the string "Valdosta ACM".

Stipulations:

  • Use only the Brainf**k programming language (you can test your code here)

  • No input can be accepted by your program

  • Your program must halt

  • The space in the string must be ASCII character #032.

These are the ASCII values of each character, as they appear in the string, for convenience:

 086 097 108 100 111 115 116 097 032 065 067 077

The winner is determined by the shortest code, by character count.

Example Input and Output

Input:

NO input is allowed

Output:

Valdosta ACM

\$\endgroup\$
5
  • \$\begingroup\$ Welcome to Programming Puzzles & Code Golf! Thanks for using the Sandbox. :) A few things to note: 1.) Generally we discourage language-specific challenges, 2.) typically code golf is scored by bytes rather than characters, and 3.) printing a fixed string like this would be insufficiently different from the Hello, World! challenge to avoid it being closed as a duplicate. \$\endgroup\$
    – Alex A. Mod
    Commented Apr 25, 2016 at 3:38
  • \$\begingroup\$ Thanks Alex! Since I want to compare the results of my local competition with the results of the challenge here, is there anything I could change about the challenge to make it acceptable? I don't see a way to do this, but I was so excited about seeing if anyone here could do better than our coders. And thanks for the warm welcome! :) \$\endgroup\$
    – Matt C
    Commented Apr 25, 2016 at 3:48
  • \$\begingroup\$ You could look at Brainf**k solutions to other challenges (like this one), and see if the techniques used there can help you improve your solution. \$\endgroup\$
    – ugoren
    Commented Apr 25, 2016 at 7:09
  • \$\begingroup\$ We also have a tips question that may be of interest. \$\endgroup\$ Commented Apr 26, 2016 at 6:30
  • 2
    \$\begingroup\$ Although this particular challenge is probably too similar to "Hello, World!" (as Alex pointed out), if you had a different challenge that you wanted to see solutions for in a specific language, you can still post it but just allow all languages to compete. If you don't see solutions in your specific language you can post a bounty for that language to encourage it. \$\endgroup\$ Commented Apr 26, 2016 at 6:33
1
155 156
157
158 159
162

You must log in to answer this question.

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