# Tagged Questions

120 views

### Beer Friday Challenge #1: Dynamic conditional puzzle [closed]

Solve, ((15, 'less_than', 30) == true) Use any language you are comfortable with. The only thing you must not do is mentally substitute the words for the symbols. Here's a link to the gist if you ...
384 views

### Compute the number of ways how you can express a number as a sum

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, for n = 1 there is just one way. For n = 4 we have 5 possible ways: 1 ...
203 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 negative ...
432 views

### Challenge: take ciphered text and decipher, also print out if it was offset to the left or right

Problem: Take input text like this: (all input should be considered strings) Upi djpi;f ytu yu[omh pmr yp yjr ;rgy. And figure out if it was offset left or offset right (on a standard qwerty ...
915 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 ...
709 views

### Find largest prime which is still a prime after digit deletion

Over at http://math.stackexchange.com/questions/33094/deleting-any-digit-yields-a-prime-is-there-a-name-for-this the following question is asked. How many primes are there that remain prime after you ...
697 views

### Breakout in half an hour

When I was a young teen I had a very boastful friend who claimed he could code up breakout (http://en.wikipedia.org/wiki/Breakout_(video_game)) in half an hour. Half an hour later he had done a great ...
757 views

### Write ASCII-Art Obfuscated Code, read as, and resulting in: “DFTBA”

The challenge is to write the most elaborate code, embedded in ASCII art that reads and prints "DFTBA". For example, the following reads DFTBA: oooooooooo. oooooooooooo ooooooooooooo oooooooooo. ...
299 views

### Compact a Befunge program

Befunge is a 2-dimensional esoteric programming language. The basic idea is that (one-character) commands are placed on a 2-dimensional grid. Control flow walks across the grid, executing commands it ...
480 views

### Implementing bool() without any conditionals

Title says it all. Given some input, turn it into a boolean value (0 or 1), without using conditional statements (e.x. == > < <= >= != ~=), or any function which uses conditional ...
393 views

### Program my microwave oven

I'm very lazy so I try to always program my microwave with the fewest possible button presses. My microwave has the following buttons: A "minute plus" button which may only be pressed first and ...
598 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 ...
226 views

### List ALL prime-factorized natural numbers in ANY order

This is a variant of List prime-factorized natural numbers up to N in ascending order, but the solutions can be very different. Write a program that outputs prime factorizations of all natural ...
262 views

### List prime-factorized natural numbers up to N in ascending order

For a given n list prime factorization of all natural numbers between 1 and n in ascending order. For example, for n = 10 the output would be: 1: 2: 2^1 3: 3^1 4: 2^2 5: 5^1 6: 2^1 3^1 7: 7^1 8: 2^3 ...
866 views

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 ...
411 views

### Help johnny to solve this Puzzle

Scenario Little Johnny wants to play with his friends today. But his babysitter won't let him go! After a lot of begging, the heartless nanny gives him her brand new electronic puzzle and says: "If ...
293 views

### Prime tester + nth-prime finder (TO BE CLOSED) [duplicate]

Possible Duplicate: List of first n prime numbers most efficiently and in shortest code This is to be closed soon - please don't answer (mod- please close!) This challenge is to write the ...
1k views

### Executable haiku that outputs a haiku

Puzzle: Write a short, three-line program which: has 5/7/5 syllables per line when read aloud outputs a haiku when run. An example of a program having the correct structure, but non-haiku output, ...
231 views

### Implement a model of computation using a type system

Implement any model of computation as powerful as a Turing machine using any existing language's type system. Your solution should handle the computation using the language's type system, not the ...
537 views

### Constant output program

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 ...
607 views

### Build a code minifier

Pick a programming language. In that language, write a function or program that takes as input a string of working code (in the same language). It should return/output a minified version of the ...
1k views

### What code compiles in the most number of languages?

Excluding trivial programs, what code compiles in the most number of languages? (By "trivial" I mean to exclude answers such as the empty program or text that will be echoed directly.) The following ...
612 views

### Illuminate a Mirrored Room

Goal In this competition, you are given a random room with one candle inside. The goal is to write the shortest program (this is golf) that determines what parts of the room are illuminated by the ...
1k views

### Creative Programming [closed]

Make a story out of your programming. Example in JavaScript: self.book = { "story": function() { var once = "upon", aTime = setTimeout(function() { // Code ...
622 views

### Solving triangles with trigonometry

Time to dig up your old trigonometry notes from high school! The challenge is to solve the unknown sides and angles of different triangles. And as is customary in code golf, the smallest working code ...
1k views

### Meta Golf Challenge

On that challenge you have to solve that challenge. Contest is over! Check the end of the question Specs: Write the smallest code (Any language*). The score of an answer is the sum of: Code ...
592 views

### Manchester encode a data stream

Manchester coding is a telecom protocol used in radio communications that guarantees bit transitions at a regular interval so a receiver can recover the clock rate from the data itself. It doubles the ...
296 views

### Program that runs when rows and columns are transposed

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 ...
1k views

### Shuffle a deck without local variables

The object of this puzzle is to take a deck of 52 cards and shuffle it so that each card is in a random position. Given (i.e. assumed to exist already): A length-52 array of integers representing ...
732 views

### Find all number pairs that sum to 121212

This problem is quite easy to do by brute force. In fact, it'll be reasonably fast to brute force as well. But where's the fun in that? The Problem Produce a list of all unique 5 digit number ...
994 views

### Arbitrary Base Conversion

Create a routine that takes an array of blocks in one numeric base system, and convert them to an array of blocks in another numeric base system. Both the from and to systems are arbitrary and should ...