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
28
votes
70answers
5k views

Return 1 - Popularity Contest [closed]

The Task Create a function/subroutine which returns 1. You can make it as elaborate as you like, as long as it returns 1. The Rules The entry with the most upvote wins - just like any popularity ...
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 ...
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 ...
3
votes
8answers
1k views

Compute the number of ways how you can express a number as a sum [closed]

For a given natural number n, compute the number of ways how one can express n as a sum of positive natural numbers. For example,...
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 ...
5
votes
10answers
2k views

Eight Queens Obsfucation [closed]

You've probably heard of the classic Eight Queens Puzzle. For those of you who haven't it goes something like this: Position 8 queens on an 8×8 chessboard so that no two queens threaten each ...
43
votes
7answers
12k views

(Re)Implementing Tetris

In the spirit of re-implementing classic video games, I would like to invite the community to create their best implementation of Tetris. For reference, a screenshot of the official NES version of ...
7
votes
4answers
3k views

Breakout in half an hour [closed]

When I was a young teen I had a very boastful friend who claimed he could code up breakout in half an hour. Half an hour later he had done a great job but it didn't quite work. This challenge is to ...
11
votes
2answers
1k views

Underhanded launcher [closed]

Your goal is to write a super-secret program which launches another (independent) program. You don't have to provide the payload in your answer, it can be any program name your program will launch. ...
5
votes
3answers
669 views

Compiled quine variant

Thinking about various quine puzzles here, I got an idea for another one: Compose a program that outputs its own compiled code to a file (or multiple files, if the compiled code is). (This means that ...
28
votes
12answers
7k views

Hello World in 1024 characters [closed]

In exactly 1024 characters, no more, no less: Must print Hello World. Must not use unnecessary whitespace. Must not use comments. Judging should favor ...
5
votes
6answers
2k views

RPN calculator without pointers

Me and some other students were at a bar discussing programming languages, in particular the C programming language. At some point a first year student said he didn't need no damn pointers. Another ...
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 ...
3
votes
9answers
624 views

Generate a valid sequence of numbers with specific rules [closed]

The challenge The program must return a valid sequence of numbers into some rules Rules x is the size of the sequence; x ...
44
votes
26answers
6k views

Crash your favorite compiler [closed]

Write a perfectly legal code in a decent language of your choice whose compiling will either crash the compiler or send it into an infinite loop (infinite compile time). Restrictions: Use a standard ...
4
votes
1answer
484 views

Minimum number of transactions so everyone has paid the same [closed]

On a road trip, N people pay for fuel. Each pays a different amount. At the end of the trip, calculate the minimum number of transactions so that each person has paid the same amount. e.g. on the ...
40
votes
32answers
4k views

Ridiculous Runtime Errors [closed]

Write programs that produce crazy, obscure, ridiculous, or just plain nutty runtime errors. Obfuscation and golfitude (shortness) not required. solutions that look like they should work fine are ...
2
votes
7answers
625 views

Random with your hands tied [closed]

Task Develop some code to generate a psuedo-random number between X and Y (taken as input). Explain why or how it works. Conditions Do not use any random generating seeds, pre-written randoms, or ...
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 ...
29
votes
7answers
4k views

Underhanded contest: The OS war [closed]

We all know how the discussion about which is the best operating system caused a lot of flame-wars. Your goal is now, to provide decisive "proof" that your favorite operating system is better... ah, ...
5
votes
7answers
925 views

Generating Binary shapes [closed]

How could we generate shapes or images using binary? I got to messing around trying to create something that looked matrix like and got to thinking, wouldn't a great CodeGolf be to see who can make ...
34
votes
12answers
5k views

Code Golf of Death [closed]

Write some code that causes a BSOD or kernel panic! Rules: On Windows, you must cause a BugCheck (Blue Screen of Death), on Linux (or other *nix systems) you must cause a kernel panic. Must not ...
49
votes
7answers
4k views

Create a User-Profile Mini-Game

Yesterday, I stumbled on a very clever thing. Yes, that's a working implementation of Tic-Tac-Toe on a user profile page, from @minitech. Of course, the moment I ...
4
votes
29answers
1k views

Constant output program [closed]

I was wondering how one might go and produce a program that takes input from some kind of random source and uses it to produce constant output. An obvious way is, for example, to take an integer x and ...
24
votes
6answers
3k views

Write the prettiest bytebeat composition

Bytebeat is a style of music one can compose by writing a simple C program that's output is piped to aplay or /dev/dsp. ...
157
votes
13answers
35k 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 ...
11
votes
3answers
1k views

Play a valid chess move, given a board on stdin

The program plays white. Example stdin: ...
12
votes
1answer
815 views

Make something tasty! [closed]

Your challenge is to write a Chef program that works well as a recipe and also as a program. Its utility as a recipe is strictly required (I don't want a recipe for grapeleaves in chocolate-mustard ...
47
votes
15answers
6k views

Generate the Stack Overflow logo [closed]

The challenge is to generate an image similar to the StackOverflow logo: The output must contain: Image size 64*64 or greater A gray |__| shaped base A curved segmented stack coming up from the base....
116
votes
42answers
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 ...
12
votes
22answers
1k views

JAxH obfuscated method, not text [closed]

A JAPH is a grand tradition of making a program that prints "Just another Perl hacker,". We already have a question about JAPH on this site but they seem more concerned with hiding the text, but JAPH ...
30
votes
3answers
2k views

Plant a tree and watch it grow

The trees we are growing have some rules that define how they grow: Growth Rules: Trees consist only of branches. Branches are made up of a combination of the following symbols: ...
26
votes
7answers
3k views

Write a code golfer [closed]

Your job, should you choose to not refuse it, is to write a program that will "golf" a piece of given code in your language of choice. Basic functionality: Remove extraneous whitespace Remove ...
7
votes
14answers
928 views

400th Question Celebration/Challenge [closed]

I just looked and saw that there are 399 questions on this wondrous "Programming Puzzles & Code Golf" site!!! That means that...THIS IS THE 400th question!!! To celebrate this momentous occasion,...
5
votes
0answers
1k views

Artistic source code: Hello World [closed]

Back to basics! Create a "Hello World" program which prints, well, "Hello World". The winner this time though, is the one who gets the most interesting source code done. For instance, use obscure ...
7
votes
2answers
703 views

Program that runs when rows and columns are transposed [closed]

I posted this to The Daily WTF coder challenge forum a few years ago but only got one response. I figure CodeGolf stack exchange might generate more interest! Description Write a program that runs ...
44
votes
3answers
4k views

What can you do in a 4k data URI? [closed]

Bounty is over, thephpdeveloper wins with Conway's Game of Life The web platform today is advancing at a rapid rate. Features like CSS3 animations, transforms, drop shadows and gradients, ...
40
votes
86answers
7k views

What's my name? Produce the name of the language indirectly [closed]

Produce only the name of a programming language using only the facilities of the language itself. The name of the language can only be invoked indirectly, i.e., from non custom environment variables, ...
55
votes
21answers
5k views

Add a feature to a programming language [closed]

Your task is to tack on a feature to a programming language, either by implementing a very clever library, or by processing the input text and/or tweaking the compilation process. Ideas: Add PHP-...
23
votes
61answers
5k views

Reinvent the For loop [closed]

For loops are used extensively in many languages, but what would you do if no languages supported them? Create a way to execute a basic ...
5
votes
9answers
3k views

Partition of a positive integer N [closed]

Find the number of partitions of a positive integer n. Hope someone uses the explicit finite formula for the partition function defined in Jan Hendrik Brunier and Ken Ono paper here. ...
25
votes
17answers
8k views

Print 1 to 1000 in C++ without semi-colons

Following this popular question, present your solution which prints the numbers 1 to 1000 (all of them, not the string "1 to 1000" verbatim or something funny) in C++ without using any semi-colons. ...
65
votes
117answers
19k views

99 Bottles Of Beer [closed]

Recreate '99 bottles of beers on the wall'. The desired output is this: ...
22
votes
5answers
4k views

Just Another Perl Hacker [closed]

Classic code golf challenge. Write the most obscure Perl program to print "Just another Perl hacker". Here's the Wikipedia article on it. Bonus points if it fits in 3 lines / 70 characters each.