A code challenge is a competition for creative ways to solve a programming puzzle with an objective winning criterion not covered by other scoring tags (e.g. code-golf).
3
votes
2answers
106 views
2D javascript table graphics
The challenge
Make a JavaScript program that can use a HTML table as a canvas, having each cell a pixel.
You can either input the position and color values in a form or by using the console.
Score ...
-2
votes
0answers
80 views
Write a program that can use as much or as little memory as requested [on hold]
This task asks you to create a program of any kind that can tell the user how much memory it is using, but can also minify and magnify the amount of bulk memory used in its stack by command.
The goal ...
8
votes
7answers
698 views
Is it a prime? w/o math
Write a program or function in any language that tells if the input is a prime number.
The input is a string representing a natural number in base-10.
The output is one of the two strings "Prime" or ...
-2
votes
0answers
85 views
Atari Emulation Development Challenge [on hold]
Rules:
Create an emulator that can mimic either Atari 2600 or Atari 5200 (or both). Any language, any OS.
The program must be able to load and execute at least one commercial game from start to end.
...
-2
votes
0answers
68 views
Shortest code to calculate A + B until EOF
Write the shortest code you can for calculating the sum of two numbers until EOF.
Rules:
You can only use 5 languages: C, C++, Python, Java and FPC
Not only expression, the whole code.
Example:
...
0
votes
1answer
136 views
Theoretical algorithm to compute Graham's number
Graham's number G is defined in that way:
3^n = 3*..n times ...*3
3^^n = 3^(3^n)
3^^^n = 3^^(3^^n)
3^^^^n = 3^^^(3^^^n)
g1 = 3^^^^3
g2 = 3^^...g1 times^^3
g3 = 3^^...g2 times^^3
...
G = 3^^...g63 ...
-1
votes
4answers
211 views
Four-Letter Words
Your task is to write a program that, given a text input, filter 'four-letter words' from the text, using any desired technique.
Only vulgar words with exactly four letters in them need to be ...
3
votes
3answers
184 views
Write code to determine the accepted answer
Post an answer to this question that evaluates any answer to this question and determines whether it wins.
Who wins:
Winner is the answer that wins according to the most answers at 1700 UTC, ...
0
votes
0answers
152 views
Make “The day we fight back” Logo
Seeing that Feb. 11, 2014 is being celebrated as "The day we fight back", your code-challenge is to make a
Day we fight back Logo, similar to the once shown below, in the language of your choice.
...
6
votes
2answers
210 views
Eco-ize data for printing
Inspired by ecofont.
Given a string containing # and , output it more eco-friendly by cutting out circles, while keeping it "recognizable" (defined later, in the Circles section). # represents ...
6
votes
1answer
195 views
Graphical, networked, two-(human)-player Tic-Tac-Toe
Create a Tic-Tac-Toe game that allows two human players to play against each other using two networked devices.
Requirements:
Network play.
Program must let both players know whose turn it is.
...
3
votes
2answers
225 views
Build a program that creates a minimal one-ohm resistor diagram for a given resistance
You are a contractor for a company who designs electrical circuits for the various products they make. One day, the company accidentally gets a huge shipment of one-ohm resistors and absolutely ...
5
votes
1answer
104 views
Inverse CIDR whitelist
The task
The task is to write a program that turns a list of IPv6 addresses into a shortest possible list of CIDR masks, such that everything but those IPs is matched.
CIDR masks
A CIDR mask ...
2
votes
6answers
272 views
Rotate simple ASCII art
This is similar to a previous question on this site, but with much simpler rules, so we should get much shorter results (in bytes):
Input: ASCII art with only two possible characters: space and ...
0
votes
0answers
107 views
Find the best path in a “match-3” game
Suppose you want to cheat in a "match-3" game. In this "match-3" game:
In each turn you can move a gem along a path. For example, you can move a gem right-right-down, as in A. (The gems are ...
5
votes
5answers
428 views
Add an integer to a set and take it back out
Definition: a set is a datatype which allows testing of inclusion ("does set X contain element Y?") but does not have order. Its size is the number of distinct elements it contains.
Define an ...
4
votes
4answers
398 views
Golf with a bowling ball: hello world with high complexity yet short code
In this challenge, you must write a Hello World program that is both short and complex. We measure complexity by Cyclomatic McCabe complexity, and length by the number of bytes (not characters).
...
17
votes
10answers
946 views
Smallest chess board compression
Write an algorithm or program that can encode and decode a chess board. The goal is to make the smallest representation of a chessboard that could be used (once decoded) to determine all movement ...
9
votes
8answers
844 views
Insanity Check Program
Insanity: doing the same thing over and over again and expecting different results.
Write a program that just throws an exception (runtime error) each time it is run. The challenge being to have ...
1
vote
1answer
128 views
Alphanumeric recursive meeting
This challenge is about finding the perfect match between your program sourcecode and the output from your program.
Scoring table for the output:
Each letters (a-z|A-Z) :
`a` or `A` ...
-4
votes
0answers
159 views
Cracking Your Own Code
Today, I am presenting a challenge about encryption and decryption. The program will have five parts: random data generator, key generator, encryptor, key cracker, and decryptor. Each of the parts ...
0
votes
7answers
146 views
Find all problems that equal an integer [duplicate]
In this challenge, your job is to write a program that allows a user to enter an integer. Then, the program must find all the possible ways of multiplying two numbers to get the user's integer.
Rules:
...
7
votes
5answers
241 views
Metapoem equinox
Objective:
Write one program that outputs sourcecode for another program that outputs words.
General information:
Any programming language.
Rules:
Your programs should not take any input. ...
19
votes
6answers
690 views
Wikipedia: Philosophy!
As many geeks may know most pages (95% i think) on wikipedia eventually lead to Philosophy like this:
Click on the first non-italic or in parentheses link that is to another normal article: (i.e. not ...
3
votes
6answers
325 views
Compute every combination of operations written in a .TXT file
Your task is to create a program that computes every combination of the operations written in a .TXT file.
Example TXT File:
1
+
2
/
3
Example Output:
1+2/3=1
1+3/2=2
2+1/3=1
2+3/1=5
3+2/1=5
...
2
votes
6answers
478 views
Produce a palindrome from this text
Copy and paste or curl this text:
http://lorem-ipsum.me/api/text
Using any language make the text palindromic.
You may remove letters.
You may rearrange letters.
The goal is to make the text ...
-5
votes
3answers
106 views
Making “Code runner” [closed]
The task is to execute functions stored in a database, preferably xml. For example a function containing system.out.println("a"); is stored in a file code.xml and has been extracted as a string, how ...
5
votes
7answers
712 views
Count the Zeros
For a given n, count the total number of zeros in the decimal representation of the positive integers less than or equal to n. For instance, there are 11 zeros in the decimal representations of the ...
58
votes
59answers
11k views
Largest Number Printable
Before opening this I've done a little search and I've found there is a similar question, but it has been closed because it was ambiguous. I hope this won't.
So, your goal is to write a program that ...
3
votes
3answers
550 views
Thinking inside the circle
In as few characters of code as you can, create an algorithm which will pack the least number of rectangles necessary to completely fill a rasterized circle with integer radius r and return the ...
0
votes
2answers
130 views
Packing binary data to source-safe ascii efficiently
Description
Here's a challenge with a somewhat practical use, at least for us golfers.
Your mission, should you choose to accept it, is to write a program that can take arbitrary binary data (either ...
13
votes
4answers
485 views
Syntax Highlighting for Greater Golf!
Golfers.
Together, we have banded together to produce code that is concise, is functionally beautiful and is uglier then the Phantom of the Opera from the original novel.
The time has come for us to ...
1
vote
5answers
338 views
Search for files on your computer [closed]
Task
Write some code that will walk through the entire file-system tree and collect details from file-names, folder-names, text files etc to form a tag-group. This tag group, when searched in (user ...
14
votes
4answers
3k views
Meta regex golf
In the spirit of this xkcd
Write a program that plays regex golf with arbitrary pairs of lists. The program should at least attempt to make the regex short, a program that just outputs ...
1
vote
4answers
181 views
Sorting a List with a Another Sorted List [closed]
Say i have a list (unorder):
Score = ['score1','score10','score6','score2','score22','score12']
Names = ['name1','name10','name6','name2','name22','name12']
email = ...
1
vote
8answers
748 views
Can you cancel the stackoverflow exception in the following code?
The following code will produce a run-time error, stackoverflow exception.
class Foo
{
//static Foo foo = new Foo(); // you are not allowed using this approach
//static readonly Foo foo = ...
15
votes
6answers
719 views
Make the Matrix Digital Rain using the shortest amount of code
Rules:
Any language you choose (Standard Libraries).
Output displayed in Terminal or Windows Command Processor or any other way you prefer.(width buffer = 80)
ASCII Characters are enough. (may add ...
-1
votes
1answer
237 views
Raytracer in odd or high level language
Ray tracers are easy to write. At each pixel on the screen, you shoot a ray into the scene and see what it hits. For the most basic ray tracer, the ray acquires the color of the object it hit.
If ...
3
votes
0answers
273 views
Create a server in Brainfu*k [closed]
Create a brainfu*k program that can act like a simple server. It will be given a JSON representation of a file folder to serve from. It'll look something like this:
{
"something.html":"<!DOCTYPE ...
3
votes
12answers
521 views
Array Merge without Duplicates
I recently saw this Javascript code on StackOverflow for merging two arrays, and removing duplicates:
Array.prototype.unique = function() {
var a = this.concat();
for(var i=0; i<a.length; ...
5
votes
1answer
278 views
Rosetta Stone Challenge: Gene Mapping
The goal of a Rosetta Stone Challenge is to write solutions in as many languages as possible. Show off your programming multilingualism!
The Challenge
Your challenge is to implement a program that ...
5
votes
6answers
341 views
How many <LANGS> can you hack in? [duplicate]
Your program should print out just another <LANG> hacker where <LANG> is replaced by whatever language you are running in. Your program must run in at least two different languages, and ...
261
votes
140answers
90k 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 ...
0
votes
1answer
217 views
Four score and twenty. (Complete Obfuscation) [closed]
This challenge is to write a program that prints a great famous speech.
Goals:
Obfuscated text (you should not be able to tell what speech it prints without running it)
Obfuscated code (it is more ...
21
votes
3answers
664 views
Mirror quine (or my head hurts)
I was reading Print your code backwards - reverse quine And I thought, this could be more interesting if your backwards code is also executable. So this challenge will have all the rules and ...
2
votes
1answer
163 views
Generate a sequence with unique subsequences
The string 2123132133 has the property that no subsequence of length 3 is the same as any other subsequence of length 3.
Your task is to build a program that will output as long of a string as ...
13
votes
3answers
720 views
Dungeon Construction Set
When I was a kid, I played the Intellivision game Advanced Dungeons and Dragons: Treasure of Tarmin. The 3-D graphics put you in a first-person-perspective point of view with shocking realism:
But ...
6
votes
1answer
324 views
Build an exact change calculator [closed]
When I'm at a store and I pay for something in cash, I always try to give as exact change as possible in order to minimize the number of coins I have left in my wallet afterwards.
Your task is to ...
3
votes
5answers
434 views
Need change of 78 cents
You bought a tasty Orange in the supermarket and got 78 cents change. How many possible ways the supermarket guy can give you the change using 1,5,10 or 25 coins
Input: Change amount
Output: The ...
-1
votes
1answer
226 views
Compressing a DNA-like string [closed]
my app is multiple choice test, where for each question the response results in a 4 letter string "eg" GTAC or ATGC or CATG, etc. There are always just 24 questions. so the final result is something ...