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
22
votes
6 answers

Code Golf: Ghost Leg

The challenge The shortest code by character count that will output the numeric solution, given a number and a valid string pattern, using the Ghost Leg method. Examples Input: 3, "| | | | | | | | |-| |=| | | | | |-| | |-| |=| | | |-| |-| |…
Anax
  • 9,122
  • 5
  • 34
  • 68
22
votes
10 answers

Code Golf: Easter Spiral

What's more appropriate than a Spiral for Easter Code Golf sessions? Well, I guess almost anything. The Challenge The shortest code by character count to display a nice ASCII Spiral made of asterisks ('*'). Input is a single number, R, that will be…
friol
  • 6,996
  • 4
  • 44
  • 81
21
votes
63 answers

Create, sort, and print a list of 100 random ints in the fewest chars of code

What is the least amount of code you can write to create, sort (ascending), and print a list of 100 random positive integers? By least amount of code I mean characters contained in the entire source file, so get to minifying. I'm interested in…
TheSoftwareJedi
  • 34,421
  • 21
  • 109
  • 151
20
votes
12 answers

Code Golf: Build Me an Arc

Challenge The shortest program by character count that accepts standard input of the form X-Y R, with the following guarantees: R is a non-negative decimal number less than or equal to 8 X and Y are non-negative angles given in decimal as multiples…
Jon Purdy
  • 53,300
  • 8
  • 96
  • 166
20
votes
14 answers

Code Golf - Generate nearby page numbers based on the current page

The challenge is to create an algorithm for generating a specifically-sized subset of numbers in a sequence based on the current position in that sequence. While navigating through the many pages of content on a busy site like Stack Overflow or Digg…
Nathan Taylor
  • 24,423
  • 19
  • 99
  • 156
20
votes
7 answers

Code Golf: Rotating Maze

Code Golf: Rotating Maze Make a program that takes in a file consisting of a maze. The maze has walls given by #. The maze must include a single ball, given by a o and any number of holes given by a @. The maze file can either be entered via…
Thomas Eding
  • 35,312
  • 13
  • 75
  • 106
19
votes
14 answers

Code Golf: Automata

I made the ultimate laugh generator using these rules. Can you implement it in your favorite language in a clever manner? Rules: On every iteration, the following transformations occur. H -> AH A -> HA AA -> HA HH -> AH AAH -> HA HAA -> AH n…
Unknown
  • 45,913
  • 27
  • 138
  • 182
19
votes
9 answers

CodeGolf: Find the Unique Paths

Here's a pretty simple idea, in this pastebin I've posted some pair of numbers. These represent Nodes of a directed graph. The input to stdin will be of the form, (they'll be numbers, i'll be using an example here) c d q r a b b c d e p q so x y…
st0le
  • 33,375
  • 8
  • 89
  • 89
18
votes
40 answers

Code-golf: Output multiplication table to the Console

I recently pointed a student doing work experience to an article about dumping a multiplication table to the console. It used a nested for loop and multiplied the step value of each. This looked like a .NET 2.0 approach. I was wondering, with the…
fletcher
  • 13,380
  • 9
  • 52
  • 69
18
votes
6 answers

Code Golf: Who has the best poker hand?

I love challenges like this, I'll hopefully submit my answer soon. Which player has the best 7 card hand? Given an unordered list of 9 cards (separated by a space), work out which player has the best poker hand. Here is a list of poker hand…
Tom Gullen
  • 61,249
  • 84
  • 283
  • 456
18
votes
23 answers

Code Golf: Decision Tree

In Google Code Jam 2009, Round 1B, there is a problem called Decision Tree that lent itself to rather creative solutions. Post your shortest solution; I'll update the Accepted Answer to the current shortest entry on a semi-frequent basis, assuming…
C. K. Young
  • 219,335
  • 46
  • 382
  • 435
17
votes
31 answers

Code Golf New Year Edition - Integer to Roman Numeral

Write a program that take a single command line argument N and prints out the corresponding Roman Numeral. Eg N = 2009 should print MMIX. Let's say this should work for 0 < N < 3000. (Had fun playing my first ever round of code golf with the…
user4812
  • 5,942
  • 9
  • 30
  • 35
17
votes
15 answers

Code Golf: Email Address Validation without Regular Expressions

(Edit: What is Code Golf: Code Golf are challenges to solve a specific problem with the shortest amount of code by character count in whichever language you prefer. More info here on Meta StackOverflow. ) Code Golfers, here's a challenge on string…
Alex
  • 75,813
  • 86
  • 255
  • 348
16
votes
15 answers

File Fix-it codegolf (GCJ 2010 1B-A)

Last year (2009), the Google Code Jam featured an interesting problem as the first problem in Round 1B: Decision Tree As the problem seemed tailored for Lisp-like languages, we spontaneously had an exciting codegolf here on SO, in which a few…
KirarinSnow
  • 1,062
  • 2
  • 9
  • 22
16
votes
12 answers

Turing Machine Code Golf

Ok guys, today's goal is to build a Turing machine simulator. For those that don't know what it is, see the Wikipedia article. The state table we are using today is found at the end of the Formal Definition that's part of that page. The code will…
RCIX
  • 38,647
  • 50
  • 150
  • 207