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
432
votes
47answers
146k views

Images with all colors

Similar to the images on allrgb.com, make images where each pixel is a unique color (no color is used twice and no color is missing). Give a program that generates such an image, along with a ...
393
votes
156answers
237k views

Write a program that makes 2 + 2 = 5 [closed]

Write a program that seemingly adds the numbers 2 and 2 and outputs 5. This is an underhanded contest. Your program cannot output any errors. Watch out for memory holes! Input is optional. ...
386
votes
110answers
81k views

Most creative way to display 42

Douglas Adams was born on March 11, 1952, and died when he was just 49. In honor of this wonderful writer, I challenge you to display 42 in the most creative way possible. You could print it in the ...
377
votes
36answers
66k views

American Gothic in the palette of Mona Lisa: Rearrange the pixels

You are given two true color images, the Source and the Palette. They do not necessarily have the same dimensions but it is guaranteed that their areas are the same, i.e. they have the same number of ...
330
votes
55answers
103k views

Tweetable Mathematical Art [closed]

Integer math can generate amazing patterns when laid out over a grid. Even the most basic functions can yield stunningly elaborate designs! Your challenge Write 3 Tweetable (meaning 140 characters ...
280
votes
141answers
457k views

I need a program where the user inputs an array of doubles and the program outputs the array sorted

Note: This question was severely edited since I first posted it here. The rules were moved to here, read them before posting any answer to understand the purpose of this. This was the first question ...
278
votes
33answers
76k views

Make it look like I'm working

Often, I find myself running a script or query that will take a significant amount of time to run. I can leave that script open and enjoy some guilt-free procrastination. Now, what if I could write ...
222
votes
75answers
74k views

Code that will only execute once

Goal The goal of this challenge is to write code that will execute once and only once. This means basically that it damages the program, script, or environment in some way. If rebooting the system ...
197
votes
81answers
24k views

What? No error? [closed]

Your task is simple. Write a program that should obviously produce an error on first glance either when compiled or run, but either doesn't or produces some other unrelated error. This is a popularity ...
187
votes
85answers
33k views

Make your language unusable

Try to write some code in your language and make it not satisfying our criteria of being a programming language any more. A language satisfies our criteria (simplified version for this challenge) of ...
184
votes
50answers
35k views

Trolling the troll [closed]

A troll has captured you and is forcing you to write malware (defined as a program that damages the computer that runs it). The troll can read and understand code, but is not so good at spotting bugs. ...
169
votes
8answers
30k views

Draw an Image as a Voronoi Map

Credits to Calvin's Hobbies for nudging my challenge idea in the right direction. Consider a set of points in the plane, which we will call sites, and associate a colour with each site. Now you can ...
168
votes
36answers
23k views

Write program in your favorite language in another language [closed]

The determined Real Programmer can write Fortran programs in any language. from Real Programmers Don't Use Pascal Your task is to write program in your programming language of choice, but you are ...
167
votes
96answers
37k views

Programming Languages Through The Years

In this challenge, users will take turns completeing three fairly simple coding tasks in programming languages that are allowed to be progressively older. The first answer must use a programming ...
161
votes
57answers
38k views

Debunking Stroustrup's debunking of the myth “C++ is for large, complicated, programs only”

Stroustrup has recently posted a series of posts debunking popular myths about C++. The fifth myth is: “C++ is for large, complicated, programs only”. To debunk it, he wrote a simple C++ program ...
157
votes
13answers
34k views

Emulate an Intel 8086 CPU

Note: A couple of answers have arrived. Consider upvoting newer answers too. Common Lisp from happy5214 C from luser droog Java from NeatMonster Javascript from crempp C from Mike C C++ from Darius ...
146
votes
116answers
48k views

Weirdest way to produce a stack overflow [closed]

As a programmer you certainly know the error of a stack overflow due to an obvious recursion. But there are certainly many weird and unusual ways to get your favourite language to spit that error out. ...
133
votes
28answers
10k views

Making Future Posts Runnable Online with Stack Snippets

Stack Snippets were recently added to PPCG! Reminiscent of JSFiddle, Stack Snippets allow HTML, CSS, and JavaScript to be run directly in posts! Here is a very simple Stack Snippet: ...
114
votes
10answers
6k views

Patch the Image

In a popular image editing software there is a feature, that patches (The term used in image processing is inpainting as @mınxomaτ pointed out.) a selected area of an image, based on the information ...
114
votes
40answers
16k views

Write a program that always outputs “2012” - even if it's modified!

This idea is not mine, though I don't know where it originated. I once met it in a programming contest very long ago (1998, if I remember correctly). The task is to write a program in your favorite ...
111
votes
7answers
24k views

So obviously, P = NP [closed]

SAT is the problem of determining whether a boolean expression can be made true. For example, (A) can be made true by setting A=TRUE, but (A && !A) can never be true. This problem is known to ...
107
votes
65answers
20k views

Random script that isn't actually random

As a little joke in the office someone wanted a script that randomly picks a name, and said person will make a round of drinks. Let's call the people John, Jeff, Emma, Steve and Julie. I thought it ...
102
votes
157answers
15k views

Execute prints backwards

Your task is to reverse the order in which some prints get executed. Specs: Your code will be in this form: ...
101
votes
95answers
11k views

Make an error quine!

Your challenge: write a "program", for a language of your choice, that causes the compiler/interpreter/runtime to produce error output when compiling/running your program which is identical to your ...
97
votes
20answers
8k views

Sort a list and write some English!

Your boss managed to read the secret hidden message. He didn't end up firing you, though, he just made you a secretary and forbade you from writing code. But you're a programmer. You need to write ...
95
votes
29answers
33k views

Make a scalable Christmas Tree [closed]

Your challenge: Make a Christmas tree. The size must be choosable by some input method, but doesn't have to be directly related to any part of the tree; however, larger inputs should produce a larger ...
95
votes
73answers
18k views

Why isn't it ending? [closed]

Your task: To write a program that should obviously terminate, but it never (to the extent of a computer crash) does. Make it look like it should perform a simple task: adding numbers, printing ...
90
votes
109answers
23k views

4, 8, 15, 16, 23, 42 [closed]

4, 8, 15, 16, 23, 42 Write a program that outputs this sequence of numbers infinitely. However, The Numbers must not appear in your source code anywhere. The following is not a valid Java program to ...
89
votes
10answers
4k views

Write a Programming language of Unknown Completeness

Determining whether a Language is Turing Complete is very important when designing a language. It is a also a pretty difficult task for a lot of esoteric programming languages to begin with, but lets ...
85
votes
132answers
42k views

Loop without 'looping' [closed]

A question similar to this has been asked a couple of years ago, but this one is even trickier. The challenge is simple. Write a program (in your language of choice) that repeatedly executes code ...
85
votes
28answers
21k views

Rearrange pixels in image so it can't be recognized and then get it back

Create a program which can rearrange pixels in image so it can't be recognized. However your program should able to convert it back to original image. You can write two functions - for encoding and ...
85
votes
14answers
8k views

Create a programming language that only appears to be unusable

Robbers' challenge thread is here. Cops' challenge: Design a programming language that appears to be unusable for programming, but admits computation (or at least completion of the task) through some ...
83
votes
14answers
15k views

Make a circle illusion animation

Your job is to animate this circle illusion. It looks like the points rotating inside of the circle, but they are actually just moving in straight lines. Criterias The result has to be animated. The ...
82
votes
16answers
16k views

Undefined Behavior Killed My Cat [closed]

Undefined Behavior Killed My Cat It's well known that undefined behavior can kill your cat [citation needed]. But can it? Your Task Write a program that invokes undefined behavior. Describe a ...
79
votes
71answers
15k views

Hello world! with limited character repetition

In a language of your choice, write a program that exactly outputs the characters Hello world! followed by a newline. The code: should not use any character more ...
78
votes
7answers
9k views

Start a revolution in Oceania

Winners (decided 14/09/14) Winning answer by Markuz (Python) - 63 votes Runner up by kuroi neko (PHP) - 55 votes Introduction You are in the world of the book Nineteen Eighty-Four by George Orwell....
77
votes
78answers
13k views

Call a method without calling it [closed]

Inspired by a now deleted StackOverflow question. Can you come up with a way to get a particular method executed, without explicitly calling it? The more indirect it is, the better. Here's what I ...
74
votes
5answers
12k views

Redraw an image with just one closed curve

Inspired by vi.sualize.us Goal The input is a grayscale image and the output is a black and white image. The output image consists of just one closed curve (loop) that is not allowed to intersect ...
72
votes
27answers
8k views

More is less and less is more

Anybody can make the output of a program bigger by adding characters, so let's do the exact opposite. Write a full program, an inner function or a snippet for a REPL environment in a language of your ...
70
votes
17answers
20k views

What colour is this? [closed]

Given three number values - being the Red, Green, and Blue elements of a colour (eight bits per channel, 0 to 255) - your program must output the name of the given colour. For example; ...
69
votes
8answers
9k views

Is it dark outside? Draw a sun map!

Our closest star, the sun, is quite fidgety. The times it rises and sets depend on where you are, and whether it is winter or not. We would like to be able to deduce if the sun is shining outside ...
68
votes
46answers
69k views

How to write a C program for multiplication without using the * and + operators?

Is it possible to write a C program that multiplies two numbers without using the multiplication and addition operators? I found this on Stack Overflow. Please help this poor programmer with his ...
67
votes
8answers
6k views

Draw random black-and-white forest

Your task is to write program which will draw 800x600 black-and-white image with something resembling a forest. Like this (it is dithered photo): Rules You are disallowed to use any existing images ...
66
votes
55answers
67k views

Weirdest obfuscated “Hello World!” [closed]

Task: Create an obfuscated program that prints Hello World! (exactly like that). Your program may not have any strings in it. Rules: You can use any programming ...
65
votes
117answers
19k views

99 Bottles Of Beer [closed]

Recreate '99 bottles of beers on the wall'. The desired output is this: ...
65
votes
21answers
12k views

Translate your English source code into a foreign language [closed]

I have noticed that there are a disproportionate number of computer languages based on English. I propose to fix this by translating existing computer languages into foreign languages! Pick a ...
62
votes
42answers
9k views

π Day puzzle for 3/14

Happy π Day. The goal of this question is to calculate the area for a circle of radius 3, where A = πr². The catch is that you have to use the constant π that is defined in a different language than ...
60
votes
37answers
9k views

Factorial in haiku!

Task Create a program that calculates the factorial of a number using no built-in factorial functions. Easy? The catch is that you must write your entire program (including testing it) in haiku form. ...
57
votes
9answers
5k views

xkcd challenge: “Percentage of the screen that is [x] color”

So I think we've all probably seen this xkcd comic: : This might either be too general or too difficult, I'm not sure. But the challenge is to create a program in any language that creates a window ...
56
votes
6answers
2k views

Paint by Numbers (using programming, not numbers)

Your task is to create a program which takes a black-and-white outlined image (example images are below) and fills it in with colour. It is up to you how you section off each region and which colour ...