Questions tagged [rosetta-stone]

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.

66 questions
152
votes
28 answers

Code Golf: Lasers

The challenge The shortest code by character count to input a 2D representation of a board, and output 'true' or 'false' according to the input. The board is made out of 4 types of tiles: # - A solid wall x - The target the laser has to hit / or…
LiraNuna
  • 64,916
  • 15
  • 117
  • 140
95
votes
26 answers

Code Golf - π day

The Challenge Guidelines for code-golf on SO The shortest code by character count to display a representation of a circle of radius R using the *character, followed by an approximation of π. Input is a single number, R. Since most computers seem to…
John La Rooy
  • 295,403
  • 53
  • 369
  • 502
88
votes
30 answers

Code Golf: Four is magic

The puzzle A little puzzle I heard while I was in high school went something like this... The questioner would ask me to give him a number; On hearing the number, the questioner would do some sort of transformation on it repeatedly (for example, he…
Platinum Azure
  • 45,269
  • 12
  • 110
  • 134
88
votes
22 answers

Code Golf: Piano

The challenge The shortest code by character count to output a part of a piano keyboard starting from input note in a given length. Input will be composed of a note ([ACDFG]#|[A-G]) to start printing the keyboard from and a positive number…
LiraNuna
  • 64,916
  • 15
  • 117
  • 140
86
votes
70 answers

Code Golf: Collatz Conjecture

Inspired by http://xkcd.com/710/ here is a code golf for it. The Challenge Given a positive integer greater than 0, print out the hailstone sequence for that number. The Hailstone Sequence See Wikipedia for more detail.. If the number is even,…
Earlz
  • 62,085
  • 98
  • 303
  • 499
83
votes
14 answers

Code Golf: Playing Tetris

The basics: Consider the following tetrominoes and empty playing field: 0123456789 I O Z T L S J [ ] [ ] # …
ChristopheD
  • 112,638
  • 29
  • 165
  • 179
76
votes
24 answers

Code Golf: Conway's Game of Life

The Challenge: Write the shortest program that implements John H. Conway's Game of Life cellular automaton. [link] EDIT: After about a week of competition, I have selected a victor: pdehaan, for managing to beat the Matlab solution by one character…
61
votes
13 answers

Code Golf: Playing Cubes

The challenge The shortest code by character count, that will output playing bricks tower series according to user input. The input will be a series of numbers (positive, negative and zero) that represents the height of the current cube tower…
LiraNuna
  • 64,916
  • 15
  • 117
  • 140
53
votes
7 answers

Code Golf: Regex parser

The goal Today's Code Golf challenge is to create a regex parser in as few characters as possible. The syntax No, I'm not asking you to match Perl-style regular expressions. There's already a very reliable interpreter for those, after all!…
Platinum Azure
  • 45,269
  • 12
  • 110
  • 134
53
votes
4 answers

Code Golf: Running Water

The challenge The shortest code by character count to identify and mark water depressions in the ASCII representation of a land from input. Input will be an ASCII representation of a landscape, having hills, valleys and flat lands. The program…
LiraNuna
  • 64,916
  • 15
  • 117
  • 140
51
votes
13 answers

Code Golf: Hourglass

The challenge The shortest code by character count to output an hourglass according to user input. Input is composed of two numbers: First number is a greater than 1 integer that represents the height of the bulbs, second number is a percentage (0 -…
LiraNuna
  • 64,916
  • 15
  • 117
  • 140
51
votes
17 answers

The Skyline Problem‍​​

I just came across this little problem on UVA's Online Judge and thought, that it may be a good candidate for a little code-golf. The problem: You are to design a program to assist an architect in drawing the skyline of a city given the locations of…
zeroDivisible
  • 4,041
  • 8
  • 40
  • 62
49
votes
33 answers

Code Golf: Happy Primes!

It's Sunday, time for a round of code golf! Challenge Write the shortest source code by character count to determine if an input number is a "happy prime", "sad prime", "happy non-prime", or "sad non-prime." Input The input should be a integer that…
mjschultz
  • 1,936
  • 1
  • 18
  • 20
49
votes
16 answers

Code Golf: Connecting the dots

You may remember these drawings from when you were a child, but now it's time to let the computer draw them (in full ascii splendour). Have fun! Description: The input are multiple lines (terminated by a newline) which describe a 'field'. There are…
ChristopheD
  • 112,638
  • 29
  • 165
  • 179
48
votes
23 answers

Code Golf: Triforce

This is inspired by/taken from this thread: http://www.allegro.cc/forums/thread/603383 The Problem Assume the user gives you a numeric input ranging from 1 to 7. Input should be taken from the console, arguments are less desirable. When the input is…
Grant Paul
  • 5,852
  • 2
  • 33
  • 36
1
2 3 4 5