Encouraging users to solve a challenge using as many different languages as they know. The end goal is to demonstrate how the same challenge is accomplished in different programming languages.
Questions tagged [rosetta-stone]
66 questions
27
votes
36 answers
Fibonacci Code Golf
Generate the Fibonacci sequence in the fewest amount of characters possible. Any language is OK, except for one that you define with one operator, f, which prints the Fibonacci numbers.
Starting point: 25 14 characters in Haskell:
…

Claudiu
- 224,032
- 165
- 485
- 680
27
votes
19 answers
Code Golf: Ulam Spiral
The Challenge
The shortest code by character count to output Ulam's spiral with a spiral size given by user input.
Ulam's spiral is one method to map prime numbers. The spiral starts from the number 1 being in the center (1 is not a prime) and…

LiraNuna
- 64,916
- 15
- 117
- 140
26
votes
4 answers
Code Golf: 2D Platformer
The Challenge
Reach the end of the level!
Bonus points if you hit each of the (C)oin blocks exactly 2 times.
Disallowed
Hard coding the command sequence in any way.
Your favorite "One character language" that happens to do exactly one thing,…

Ivo Wetzel
- 46,459
- 16
- 98
- 112
26
votes
10 answers
Code Golf: Code 39 Bar Code
The challenge
The shortest code by character count to draw an ASCII representation of a Code 39 bar code.
Wikipedia article about Code 39: http://en.wikipedia.org/wiki/Code_39
Input
The input will be a string of legal characters for Code 39 bar…

gwell
- 2,695
- 20
- 20
26
votes
9 answers
Code Golf: Diamond Blackjack
The challenge
The shortest code by character count to output a best-case blackjack hand from the list of number-cards given.
Input is a list of numbers from 1 to 10 (inclusive) separated by space.
Output will be the best blackjack hand formed from…

LiraNuna
- 64,916
- 15
- 117
- 140
26
votes
18 answers
Code Golf: Mathematical expression evaluator (that respects PEMDAS)
I challenge you to write a mathematical expression evaluator that respects PEMDAS (order of operations: parentheses, exponentiation, multiplication, division, addition, subtraction) without using regular expressions, a pre-existing "Eval()"-like…

gary
- 511
- 6
- 11
25
votes
45 answers
Code Golf: Print the entire "12 Days of Christmas" song in the fewest lines of code
Print all 12 verses of the popular holiday song.
By 12 verses I mean the repetition of each line as is sung in the song, ie
Verse One:
On the first day of Christmas my true love gave to me
a partridge in a pear tree.
Verse Two
On the second day of…

fizzer
- 13,551
- 9
- 39
- 61
25
votes
6 answers
Code Golf: draw ascii art stars
Since this week noone has posted a code-golf challenge, I'll give it a try. I do it so you can do something other than playing with swords during those long compile cycles.
The challenge:
Draw ASCII art stars, given three numbers on standard input…

ninjalj
- 42,493
- 9
- 106
- 148
25
votes
14 answers
Code Golf: Calculate Orthodox Easter date
The Challenge
Calculate the Date of the Greek Orthodox Easter (http://www.timeanddate.com/holidays/us/orthodox-easter-day) Sunday in a given Year (1900-2100) using the least amount of characters.
Input is just a year in the form '2010'. It's not…

Tokk
- 4,499
- 2
- 31
- 47
25
votes
10 answers
Code Golf: Zigzag pattern scanning
The Challenge
The shortest code by character count that takes a single input integer N (N >= 3) and returns an array of indices that when iterated would traverse an NxN matrix according to the JPEG "zigzag" scan pattern. The following is an example…

fbrereto
- 35,429
- 19
- 126
- 178
24
votes
7 answers
Code Golf: Word Search Solver
Note: This is my first Code Golf challenge/question, so I might not be using the correct format below. I'm not really sure how to tag this particular question, and should this be community wiki? Thanks!
This Code Golf challenge is about solving word…

Maxim Zaslavsky
- 17,787
- 30
- 107
- 173
23
votes
15 answers
Code Golf: Pig Latin
Challenge:
Take a sentence of input of any length and convert all the words in that sentence to pig latin. If you do not know what pig latin is please read Wikipedia: Pig Latin.
Specifications:
Assume all words are separated by spaces and all…
thyrgle
23
votes
12 answers
Code Golf: Lights out
The challenge
The shortest code by character count to solve the input lights out board.
The lights out board is a 2d square grid of varying size composed of two characters - . for a light that is off and * for a light that is on.
To solve the board,…

LiraNuna
- 64,916
- 15
- 117
- 140
22
votes
13 answers
Code Golf: Diamond Pattern
The challenge
The shortest code by character count to output a a pattern of diamonds according to the input.
The input is composed of 3 positive numbers representing the size of the diamond and the size of the grid.
A diamond is made from the ASCII…

LiraNuna
- 64,916
- 15
- 117
- 140
22
votes
9 answers
Code Golf: Phone Number to Words
Guidelines for code-golf on SO
We've all seen phone numbers that are put into words: 1-800-BUY-MORE, etc.
What is the shortest amount of code you can write that will produce all the possible combinations of words for a 7 digit US phone number. …

Nick Hodges
- 16,902
- 11
- 68
- 130