Questions tagged [popularity-contest]

A popularity-contest is a competition where the answer with the highest vote tally (upvotes minus downvotes) wins. As these are frequently closed, read the tag info and post your challenge to the sandbox first.

Filter by
Sorted by
Tagged with
21
votes
4answers
2k views

Make Me a Sandwich

Challenge: Write a makefile, which would lead to this behavior: % make me a sandwich What? Make it yourself % sudo make me a sandwich Okay Rules: Should work on ...
20
votes
20answers
3k views

Print a Variable's Name [closed]

Write a function (not a full program), so that if the function is called with a single global variable (or your language's closest equivalent) as its argument, it outputs (i.e. prints or returns) the ...
20
votes
18answers
4k views

Write a short story using only valid code

What I'd like to see is your attempts at writing a kind of "story" that has a fairly easy to read meaning, but also creating a valid code fragment. For example, this (BBC) BASIC code: ...
20
votes
6answers
3k views

Parallel projected voxel terrain generator

Your job is to generate a heightmap and show it as a parallel projected, voxel landscape. The rules are the following: The (heightmap of the) landscape has to be randomly generated You also have to ...
20
votes
7answers
3k views

Confuse the Dakotas [closed]

You have been hired by the government of North Dakota to encrypt the state's communications. Write two programs, one to encrypt a message and one to decrypt that message. The government is not really ...
20
votes
4answers
2k views

Force an Average on an Image

Write a program that takes in a standard truecolor image and a single 24-bit RGB color (three numbers from 0 to 255). Modify the input image (or output a new image with the same dimensions) such that ...
19
votes
27answers
2k views

8 ought to become Infinity [closed]

Let's take a look on a typical loop, which usually performs 8 iterations: for (int x=0; x<8; ++x); You have to make it infinite! It's a popularity-contest ...
19
votes
6answers
2k views

An unintentional-looking but crash-causing bug [closed]

There are a range of questions revolving around this concept, but these all seem to just involve causing a crash, resulting in many answers which are very obviously designed to cause a crash. So the ...
19
votes
10answers
3k views

Create a programming language interpreter [closed]

Task: You must create an interpreter that can parse snippets of a programming language. The language does not need to be complex, but it must include the following syntactical elements: Ability to ...
19
votes
3answers
1k views

Freehand red circles

Over on http://meta.stackoverflow.com, we have a few memes of our own. One of them is Freehand Red Circles. See this post: So, the challenge is, can you draw freehand red circles... with code? ...
19
votes
15answers
2k views

Write a function that tells you which TWO of its lines has been removed

In my previous code challenge, I asked you to write a function that tells you which of its lines has been removed. The instructions were: Write a function that contains five lines. If you run ...
19
votes
9answers
2k views

ASCII ART edge detection

As the title says, I was thinking to contest in which one must detect edges of an ASCII art. The code should accept a B/W ASCII art as input. A B/W ASCII art is defined as (by me) an ASCII art with ...
19
votes
4answers
2k views

Forest - A Simulated Ecosystem

NOTE This problem was taken from this reddit thread (spoiler alert!), and I have adjusted it to make it fit with this site's format. All credit goes to reddit user "Coder_d00d". In this problem, we ...
18
votes
61answers
7k views

How do I find the factorial of a positive number?

The challenge: Write a program or a function that inputs a positive number and returns its factorial. Note: This is a code-trolling question. Please do not take the question and/or answers ...
18
votes
17answers
2k views

Build interpreter for non-existent language

Build an interpreter for a fake, stack-based language that gets an input, interprets it, and outputs the result as an array of numbers. It should iterate through each byte and perform a different ...
18
votes
8answers
2k views

Classic Proof Fallacy [closed]

The Background So, we all know the classic proof that goes like this: a = b a² = ab a² - b² = ab - b² (a-b)(a+b) = b(a-b) (a+b) = b b+b = b 2b = b 2 = 1 (Ha ha!) Of course, the mistake is that ...
18
votes
3answers
1k views

Recreate an xkcd graph procedurally with your favorite plotting tool

Lately there have been quite a number of questions regarding the recreation of xkcd-style graphs like the following one (1064) in various languages. Your goal is to recreate any existing xkcd comic ...
18
votes
2answers
995 views

String to Image

A bit of background: When I first learned about Brainf*ck, one of the first things I did was to write a Java application that would take in a string and create a, somewhat, optimized program to print ...
17
votes
1answer
3k views

Hide evil code - print files containing a given string anywhere in a directory tree [closed]

The point of this puzzle is to learn how a malicious code can be hidden and discovered in a program. A person is asking the question: Plz give me some code that how can I search a file may be in ...
17
votes
5answers
1k views

Lets take Beal's $1,000,000

Beal's Conjecture has a million dollar prize if you prove/disprove it. It states that if where A, B, C, x, y, and z are positive integers with x, y, z > 2, then A, B, and C have a common prime ...
16
votes
10answers
3k views

Valentine's day greetings card generator

Create a program that, given a name as input, will generate a Valentine’s day greeting card featuring that name, with its source code also having a Valentine’s day theme. The greeting can be either ...
16
votes
10answers
6k views

Crash (i.e. cause the interpreter to stop working and force close) Python [closed]

I would like to see who can make Python have a fatal crash with the most creative code. This means that when the program runs, Windows for example, will take over and pop up with something like “IDLE ...
16
votes
14answers
2k views

Rock, Paper, Scissors, Lizard, Spock [closed]

Create a function that will take two strings as input and return a single output for the result. Most popular answer wins. The rules of Rock-paper-scissors-lizard-Spock are: Scissors cut paper ...
16
votes
8answers
1k views

Thinking outside the box

You are trying to fit a sphere into a 5-sided box, but sometimes it does not fit completely. Write a function to calculate how much of the sphere is outside (above the rim of) the box. There are 3 ...
16
votes
4answers
1k views

Lorem Ipsum Generator [closed]

Lorem Ipsum is placeholder text used when preparing layout without wanted to have content already filled. One of its key features over using some arbitrary text is that it is nonsense. It isn't even ...
15
votes
26answers
4k views

“Hello world!”, repeating each character n times [closed]

In your language of choice, write a program that outputs exactly Hello world!. Each character in your program must be repeated n times - you choose n. For example, ...
15
votes
20answers
1k views

Quine…but shifted by one

Referring to the printable ASCII character codes in decimal, we know that from 32 to 126 we have the printable characters with 32 being (space). Your challenge is to write a program using only ...
15
votes
7answers
2k views

The Quickest Fox in the East

In the spirit of Hello world! with NO repetition Write a program that prints the string "the quick brown fox jumps over the lazy dog" with optional newline. The entire program must not repeat any ...
15
votes
24answers
5k views

Generate me some appropriate license plates!

The scenario: You are a software designer working for a gov't-run company that designs license plates for cars and other vehicles. You've been asked to develop software that generates license plates. ...
15
votes
3answers
3k views

Self-matching regex [closed]

Write a non-trivial regex that matches itself. For example, #.*$ will match a comment outside of a string in python until the end-of-line, and also matches itself ...
15
votes
5answers
1k views

RTTTL Obfuscation

RTTTL, or Ring Tone Text Transfer Language is a music format that was invented by Nokia in the dawn of time when dinosaurs roamed the land. It allows for fairly crude pieces of music (no chords or ...
15
votes
2answers
1k views

Pathological Sorting

Pathological Sorting Your boss has demanded that you develop a sorting algorithm to improve the performance of your company's application. However, having written the application, you know that you'...
15
votes
1answer
744 views

Optimum Letter Cards for Spelling Words

Let's say you have a list of words and you want to be able to use letter cards to spell each word. For example, to spell cat, you would use three cards labelled C, A, T. Assuming each card is double-...
15
votes
1answer
2k views

Sabotage a Train to Make It Run Late [closed]

"I want to go to the Araby bazaar to buy a present for the one I have fallen in love with. However, if I arrive too late all the stores will be closed and I won't be able to buy anything. Can you help ...
14
votes
57answers
17k views

Write a function that takes (x, y) and return x to the power of y WITHOUT Loops [closed]

This is a really neat short challenge. Write a function or a procedure that takes two parameters, x and y and returns the ...
14
votes
17answers
2k views

Break some standards! [closed]

Everyone knows the phrase "Rules are made to be broken!", so here is your task: Write some code in any language that breaks a standard. This can be anything, from putting 240 volts down a USB cable, ...
14
votes
14answers
3k views

Throw a null-pointer exception [closed]

Your task is to generate a null-pointer exception. That is, your program must accept a value which it expects to be non-null, and throw an exception/error or crash because the value is null. ...
14
votes
7answers
946 views

Avoid duplicate entries using a sign change

This anecdote contains the following intriguing exchange: "Fine, Fred," Avi interrupted. "Then how would you change this to avoid duplicate entries?" "Oh, just change that one there to a ...
13
votes
17answers
2k views

Create a Y2K disaster [closed]

Your program can do anything you want. The only condition is that it perform as expected if the date is before 2000, and fails spectacularly afterward. Define spectacularly however you'd like. For ...
13
votes
19answers
2k views

Goodbye, world! [closed]

Write a program that erases itself. While the exact behavior may be implementation-defined, it should at minimum attempt to remove the file the program was stored in before execution on a best-effort ...
13
votes
22answers
3k views

Input text from one file, output it to another

The challenge: Input text from one file and output it to another. Solution should be a complete, working function. Note: This is a code-trolling question. Please do not take the question and/or ...
13
votes
38answers
3k views

Count occurrences of an integer [closed]

Based on the question How many positive integers < 1,000,000 contain the digit 2?. I'm looking for the most creative solution to count all the Integers from X to ...
13
votes
12answers
7k views

Make a Valentine wish with your favourite language [closed]

Write the most creative program to display your Valentine wish to your favorite programming language, in that language. E.g. ...
13
votes
10answers
2k views

Make the most useful program within 100 characters [closed]

In this task, you are allowed make an useful program to do anything you can write within 100 characters. You are allowed to use less characters, but not more. Rules, just to protect from standard ...
13
votes
11answers
2k views

Render a version of the BBC Micro owl logo

Can you render out a version of the BBC Micro Owl logo as per above from code? Rules: You can use any programming language you like. Output can be text or graphic. Circles don't have to overlap. ...
13
votes
5answers
1k views

Hide a Brainf*** greeting in other code

The goal is to write a program (anything except explicit brainfuck) which prints Barney Stinson's best rule: New is always better. when interpreted normally, but Legen... wait for it... dary! ...
13
votes
5answers
1k views

Program that encodes a message into its own text

Write a program that encodes given text into its own text, provided as input, without disrupting its logic. The program must also work as a decoder, restoring the original message from its text. It ...
13
votes
2answers
487 views

The poet's quine

Write a quine with 1 or more rhyme scheme from http://en.wikipedia.org/wiki/Rhyme_scheme when read. The following characters are spoken aloud: any alphanumeric words or characters not in a comment; ...
13
votes
1answer
2k views

Duct tape can fix anything [closed]

Overview This challenge was inspired by this StackOverflow Meta post. In it, @hakre says: I've seen a project really written by Stackoverflow (a noob copies together from SO here and SO there), ...
13
votes
2answers
1k views

Underhanded Bank Account [closed]

You are working as a programmer for a bank. Your task is to write a program that handles the transactions from one bank account to another. The program should do the following: Run in an infinite ...