462
votes
171answers
168k views

Produce the number 2014 without any numbers in your source code

It's 2016 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 ...
342
votes
171answers
48k views

Showcase your language one vote at a time

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 ...
328
votes
36answers
57k 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 ...
292
votes
44answers
85k 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 ...
241
votes
7answers
22k 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 ...
224
votes
14answers
29k views

Build a Compiler Bomb

Introduction You're probably familiar with zip bombs, XML bombs, etc. Put simply, they are (relatively) small files which produce enormous output when interpreted by naïve software. The challenge ...
199
votes
56answers
31k 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 ...
196
votes
178answers
29k 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 ...
187
votes
5answers
12k views

Upgoat or Downgoat?

Given an image of a goat, your program should best try to identify whether the goat is upside down, or not. Examples These are examples of what the input may be. Not actual inputs Input: Output: ...
178
votes
32answers
26k views

Paint Starry Night, objectively, in 1kB of code

Below is a 386x320 png representation of van Gogh's Starry Night. Your goal is to reproduce this image as closely as possible, in no more than 1024 bytes of code. For the purposes of this ...
177
votes
54answers
57k 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 ...
176
votes
12answers
16k 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 ...
173
votes
402answers
31k views

“Hello, World!”

So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most ...
164
votes
21answers
10k views

Fibonacci Sequence Generator [closed]

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.
162
votes
57answers
61k 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 ...
155
votes
38answers
20k 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 ...
153
votes
64answers
28k 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 ...
152
votes
201answers
28k views

The Programming Language Quiz

Congratulations to Dennis who won both the cops' and the robbers' challenge! Calvin's Hobbies has already delivered on his promise and wrote this challenge for Dennis for winning the robbers' ...
142
votes
55answers
33k 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 ...
141
votes
57answers
13k 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 ...
140
votes
9answers
21k 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 ...
138
votes
95answers
29k 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 ...
133
votes
19answers
15k 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 ...
132
votes
102answers
28k 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 ...
125
votes
73answers
15k views

I'm not the language you're looking for!

Isn't it annoying when you find a piece of code and you don't know what language it was written in? This challenge attempts to somewhat solve this. Challenge You will have to write a program that ...
125
votes
116answers
45k views

Don't google “google”

We all know that if you google the word "google" it will break the internet. Your task is to create a function that accepts 1 string and returns its length, in as few amount of Unicode characters as ...
125
votes
91answers
11k views

What is the smallest positive base 10 integer that can be printed by a program shorter (in characters) than itself?

I think the question as above is clear, but just in case: Write a full program (not just a function) which prints a positive base 10 integer, optionally followed by a single newline. Qualifying ...
124
votes
12answers
25k 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 ...
123
votes
19answers
78k 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 ...
122
votes
60answers
19k 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 ...
120
votes
241answers
23k 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 ...
112
votes
22answers
7k 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 ...
109
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 ...
106
votes
51answers
26k views

Draw the Olympic Games logo

Challenge Draw the Olympic Games logo... ...as character (e.g. ASCII) art! Sample Output * * * * * * * * * * * * * * ...
104
votes
27answers
7k 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: alert('This ...
102
votes
24answers
11k 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 ...
98
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 ...
97
votes
164answers
20k views

Is this number a prime?

Believe it or not, we do not yet have a code golf challenge for a simple primality test. While it may not be the most interesting challenge, particularly for "usual" languages, it can be nontrivial in ...
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 ...
96
votes
1answer
2k views

“KNOT” or “NOT”?

Write a program that processes an ASCII art representation of a tangled string and decides whether or not it can be untangled into a simple loop. The tangle is represented using the characters - and | ...
95
votes
90answers
25k 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: ...
95
votes
39answers
11k views

It's my Birthday :D

Introduction Yesterday was my birthday (really!) and sadly I had to organise my own party. Well, now you know, couldn't you at least make the cake? Challenge Given an integer n as input, write a ...
93
votes
36answers
6k views

Source code ecological footprint

You've just been hired by a German car manufacturing company. Your first task, as an engineer, is to write a program that computes the ecological footprint of ASCII strings. The ecological footprint ...
92
votes
29answers
17k 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 ...
92
votes
77answers
13k 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 | ...
91
votes
70answers
14k views

Draw the national flag of France

There have been many other flag challenges posted but not one for the national flag of France. This week seems like an appropriate time. Produce this flag in the fewest bytes possible: The image ...
90
votes
148answers
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*/ ...
90
votes
45answers
9k 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
15answers
17k 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 ...
87
votes
95answers
15k 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 ...

15 30 50 per page