423
votes
156answers
159k views

Produce the number 2014 without any numbers in your source code

It's 2015 already, folks, go home. So, now that it's 2014, it's time for a code question involving the number 2014. Your task is to make a program that prints the number 2014, without using any ...
381
votes
107answers
63k 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 ...
321
votes
121answers
159k views

Write a program that makes 2 + 2 = 5

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. ...
309
votes
56answers
78k views

Tweetable Mathematical Art

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 ...
304
votes
35answers
53k 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 ...
253
votes
40answers
73k 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 ...
230
votes
32answers
33k 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 ...
229
votes
95answers
28k views

Showcase your language one vote at a time [experimental challenge]

In this experimental popularity contest users will be able to showcase their favorite programming languages. However, the amount of code they are allowed to write is dependent on the number of votes ...
221
votes
7answers
20k views

Draw with your CPU

I have come across an article where students used network traffic to draw their university on the country's IPv6 graph. [image] Your goal is simple to tell, but hard to implement. Draw the text MAIL ...
189
votes
52answers
26k views

Survival Game - Create Your Wolf

The Board The Board is a two dimensional array of cells. Cells are populated by Animals. Every day, all Animals on the Board simultaneously make one move. If two or more Animals move to the same ...
188
votes
80answers
19k views

What? No error?

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 ...
173
votes
169answers
26k views

Evolution of “Hello World!”

This contest is officially over, the winner is user23013. Congratulations! The challenge is to make a program that prints Hello World! to stdout. The catch is that your program must have a ...
168
votes
45answers
28k views

Trolling the troll

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. ...
165
votes
11answers
14k views

DISARM THE B.O.M.B.!

You have been hired for your tech knowledge as a Secret Agent's sidekick to ensure that the good guy can get his job done and the world can be saved. This is your last mission before retiring with a ...
159
votes
62answers
9k views

Fibonacci Sequence Generator

Can you create a clever or unexpected Fibonacci generator? Your code must print or return either the nth Fibonacci number or the first n Fibonacci numbers.
155
votes
54answers
54k views

We're no strangers to code golf, you know the rules, and so do I

Write the shortest program that prints the entire lyrics of "Never Gonna Give You Up" by Rick Astley. Rules: Must output the lyrics exactly as they appear in the above pastebin. Here's the raw ...
143
votes
38answers
18k views

Write program in your favorite language in another language

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 ...
140
votes
115answers
39k views

Weirdest way to produce a stack overflow

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. ...
136
votes
53answers
26k views

Print every character your program doesn't have

Your task is to build a program (using only printable ASCII characters and/or tabs and newlines) that prints out exactly the characters in the printable ASCII space (0x20 to 0x7e) that don't appear in ...
134
votes
55answers
30k 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 ...
133
votes
9answers
18k 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 ...
130
votes
55answers
12k views

Caveman Duels (or: Me poke you with sharp stick)

Caveman mad. Other caveman take stick but stick was for me. Caveman fight! Description Caveman need sharp stick to stab other caveman. Other caveman also try to stab with sharp stick. Caveman ...
129
votes
49answers
57k 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 ...
125
votes
92answers
26k 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 ...
124
votes
19answers
12k views

Do you want to code a snowman?

Here is a simple ASCII art snowman: _===_ (.,.) ( : ) ( : ) Let's make him some friends. This will be the general pattern for our ASCII art snowpeople: HHHHH HHHHH X(LNR)Y X(TTT)Y (BBB) The ...
117
votes
241answers
22k views

Unscramble the Source Code

Note: This challenge is now closed to new cop submissions. This is to ensure that no one can post submissions that only remain uncracked because there aren't enough robbers interested in the ...
116
votes
12answers
20k views

Emulate an Intel 8086 CPU

Note: A couple of answers have arrived. Consider upvoting newer answers too. Java from NeatMonster Javascript from crempp C from Mike C C++ from Darius Goad Postscript from luser droog C++ from ...
114
votes
19answers
66k views

How slow is Python really? (Or how fast is your language?)

I have this code which I have written in Python/NumPy from __future__ import division import numpy as np import itertools n = 6 iters = 1000 firstzero = 0 bothzero = 0 """ The next line iterates ...
106
votes
92answers
17k views

Good Versus Evil

Results - July 19, 2014 The current King of the Hill is Mercenary by user Fabigler! Keep submitting entries and knock him off of his throne! Click here to view the Scoreboard. Programs submitted on ...
105
votes
51answers
25k views

Draw the Olympic Games logo

Challenge Draw the Olympic Games logo... ...as character (e.g. ASCII) art! Sample Output * * * * * * * * * * * * * * ...
104
votes
7answers
21k views

So obviously, P = NP

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 ...
102
votes
63answers
16k 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 ...
98
votes
85answers
19k views

Tips for golfing in Python

What general tips do you have for golfing in Python? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Python (e.g. "remove comments" is ...
96
votes
31answers
9k views

What Doesn't Kill Me…

Overview This is a bot battle to see who can survive the longest. These bots increase their power by being attacked, though, so you need to think carefully before you shoot. Each turn, you can ...
96
votes
39answers
13k 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 ...
95
votes
22answers
6k views

Red vs. Blue - Pixel Team Battlebots

This contest is officially over. The Blue Team won! I autoran two sets of 50 battles and amazingly, Blue won all 100 of them. Looking at the stats, it is clear that the cooperative entries of ...
94
votes
24answers
10k views

Lab Rat Race: an exercise in genetic algorithms

This is Fortnightly Challenge #3. Theme: Genetic Algorithms This challenge is a bit of an experiment. We wanted to see what we could do, challenge-wise, with genetic algorithms. Not everything may be ...
92
votes
73answers
15k views

Why isn't it ending?

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
108answers
20k views

4, 8, 15, 16, 23, 42

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
45answers
8k views

Survival Game - AlienWar

AlienWar This game takes place in a very crowded planet where aliens are the superior race. Your task is to create your own alien and beat all other. The Board It is a 2 dimensional board. The ...
88
votes
27answers
13k views

Make a scalable Christmas Tree

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 ...
88
votes
77answers
12k views

The Rock, Paper, Scissors, Lizard, Spock Tournament of Epicness

Most Recent Leaderboard @ 2014-08-02 12:00 | Pos # | Author | Name | Language | Score | Win | Draw | Loss | Avg. Dec. Time | ...
85
votes
147answers
12k 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: //some lines of code /*code*/ print "Line1" /*code*/ /*code*/ print "Line2" /*code*/ ...
85
votes
86answers
21k views

Obfuscated Hello World

Create the shortest possible obfuscated program that displays the text "Hello World". In order to be considered an obfuscated program, it must meet at least two of the following requirements: ...
84
votes
42answers
22k views

Fifty Shades of Grey

Boys and girls are excited to see Fifty Shades of Grey on the silver screen, we just want to code without being bothered, so here's a challenge to pick our brain. You have to: Print on the screen ...
83
votes
32answers
14k views

If a program terminates and there is no one to see it, does it halt?

It's time to face the truth: We will not be here forever, but at least we can write a program that will outlive the human race even if it struggles till the end of time. Your task is to write a ...
83
votes
15answers
16k views

Possibly quit your job with a polyglot

Despite your protest, you have been put to work by your boss on a program that takes a single unsigned integer as input and prints the string "prime" if that integer is prime and "not prime" if it ...
82
votes
94answers
14k views

When does (x == x+2)?

The challenge: Define x in such a way that the expression (x == x+2) would evaluate to true. I tagged the question with C, but answers in other languages are welcome, as long as they're creative or ...
82
votes
14answers
9k views

Has my milk expired?

Aww, man, this expiry date doesn't write the months with letters! I can't tell if it's expiring on March 10th or October 3rd... Wait, no, never mind, the year says 2012. (alley-oops half-used brick of ...
80
votes
58answers
10k views

BrainF***edBotsForBattling - A Brainf*** Tournament

All bots at the battle arena suddenly got brainfucked and no one can explain why. But who cares as long as they are still able to fight - although Brainfuck is the only language they understand ...

15 30 50 per page