Code-golf is a competition to solve a particular problem in the fewest bytes of source code. If you want to score by characters instead of bytes, state this explicitly in the challenge. If source code length is not the primary scoring criterion, consider using another tag instead.

learn more… | top users | synonyms

3
votes
0answers
26 views

Marching Squares Lookup

Marching Squares is an algorithm from computer graphics, which is used to recover 2D isocontours from a grid of samples (see also, its big brother Marching Cubes for 3D settings). The idea is to ...
4
votes
0answers
52 views

Display words using 7-segment display

My first ever Programming Puzzles & Code Golf is the Seven-Slash Display. Here is my first Challenge, also based on 7-segment display. I often think about, besides numbers, what kind of letters ...
7
votes
1answer
102 views

Write a D*mn Unambiguous Censor

Censors are a common tool used on the interwebs. But they often censor too much of the word, and thus make the cursing ambiguous to the reader. And sometimes they don't censor enough, so the words ...
0
votes
0answers
51 views

Create a working Stack [duplicate]

Your mission, if you choose to accept it, is to create a stack that can do basic math operations. Explanation: Your stack must be able to do basic arithmetic (+-*/) and must support normal base 10 ...
28
votes
11answers
2k views

A code golf challenge, m'kay

Mr. Mackey is a South Park character well-known for adding "m'kay" in everything he says. Write a program or function that transforms a string of text into something Mr. Mackey would say. M'kay ...
-5
votes
0answers
189 views

The Time Traveller's Watch

Disclaimer: The physics in this challenge are very simplified (i.e. ignoring gravitational field strength) to make the challenge easier to answer Challenge Using the phone GPS, produce a Pebble ...
30
votes
13answers
3k views

Minecraft Mirrored

This is Calvin. Just trying to get 20 rep so this user can chat in the PPCG Minecraft Server chatroom. Write a program or function that takes in a positive integer. If the integer is even (2, 4, 6, ...
30
votes
11answers
3k views

The Will Rogers Phenomenon

The so-called Will Rogers phenomenon describes a way to tweak statistics by raising the average in two (multi)sets when one element is moved between the two sets. As a simple example, consider the two ...
9
votes
3answers
292 views

Knödel numbers - Find Kn

Knödel Numbers The Knödel numbers are a set of sequences. Specifically, the Knödel numbers for a positive integer n are the set of composite numbers m, such that all i < m, coprime to m, satisfy ...
20
votes
17answers
2k views

Swap capitalization of two strings

your shift key is broken. wheNever you type two lines, the cApitaL LetteRs in them get swappeD. you must write a program to fiX THIS! Description The input is two strings, s1 and s2, equal in ...
11
votes
2answers
239 views

Creasing for Loot

Introduction After a long battle, you have managed to defeat a Sphinx in a contest of riddles. The Sphinx, impressed with your skill, wishes to give you a reward commensurate with your cleverness, ...
13
votes
8answers
754 views

Alphabetic Fannkuch

Fannkuch is a classic benchmark program. The name comes from the German "Pfannkuchen"- pancakes- for the algorithm's resemblance to flipping stacks of pancakes. A Fannkuch sequence of numbers is ...
25
votes
9answers
1k views

Sinusoidal text

Goal: Write a program or function which prints an input string in a sinusoidal shape. The ASCII sinusoid Here is one period of the sinusoid: ....... ...
5
votes
0answers
153 views

The lost pawn problem

The lost pawn problem After the chess game ended, a surviving pawn was left behind enemy lines. let's help him find the shortest way back home. The original problem describes a nXn "chess" board, ...
34
votes
47answers
4k views

Make the Mexican Wave

In as few bytes as possible, write a program or function that outputs the following: Abcdefghijklmnopqrstuvwxyz aBcdefghijklmnopqrstuvwxyz abCdefghijklmnopqrstuvwxyz abcDefghijklmnopqrstuvwxyz ...
10
votes
5answers
208 views

CipherSaber encryption

Implement a CipherSaber encryption program, as described below. Guidelines: The smallest entry, in bytes, wins. However, in a departure from code-golf norms, you are welcome to post interesting ...
12
votes
2answers
322 views

Enter your name via a D-pad

The puzzle: Consider a console/hand-held game with a d-pad where you are required to enter a name of sorts. This appeared in many older games before the use of QWERTY was popularised in consoles ...
20
votes
14answers
1k views

Calculating waves

I've been scrolling around this site for a while, but just recently got really interested in actually trying out some of the challenges. I was intending to try my hand at some of the existing ...
15
votes
13answers
471 views

Find the reference angle

This is a fairly simple question. According to this random website I found, a reference angle is the acute angle formed by the terminal side of the given angle and the x-axis. You have to write a ...
26
votes
3answers
280 views

FizzBuzz Reverse Solver

Synopsis: Given the output of a generalised FizzBuzz program, return the list of factors and words used for the program. Challenge Description Imagine a generalised FizzBuzz program that takes ...
14
votes
0answers
185 views

ASCII Scores ­­­­­

Digging around in the depths of your temp folder, you find some compositions for the piano. Unfortunately, these compositions were written with note names and durations only, and you only have access ...
31
votes
20answers
2k views

What day is it (on Flooptonia)?

You are a space tourist on your way to planet Flooptonia! The flight is going to take another 47,315 years, so to pass the time before you're cryogenically frozen you decide to write a program to help ...
43
votes
7answers
2k views

Make the Stretchy Snakes Kiss

A stretchy snake looks something like this: <||=|||:)~ Each separate sequence of vertical bars (|) in a stretchy snake, known as a stretchy portion, is individually extendable to twice its ...
5
votes
2answers
192 views

Probability to clear the board or win

In the game Hearthstone there is a playing board containing friendly and enemy minions, and two heroes - yours and the enemy's. To generalize and simplify, we will assume it's your turn, the opponent ...
1
vote
9answers
234 views

Through the bases

Through the bases In this challenge, you will be taking a number through all the bases of the rainbow Given an input, n, you will output n in every base from 9 to 2, and back up to 9. That's 9 8 7 6 ...
14
votes
21answers
1k views

Calculate average characters of string

Task Your task is to produce string that contains average characters of string. First character of result would be average character of first character (which is first character) and second character ...
16
votes
8answers
875 views

Every Possible Cycle Length

A function (or program) which takes inputs and provides outputs can be said to have a cycle if calling the function on its own output repeatedly eventually reaches the original number. For instance, ...
-7
votes
7answers
130 views

Make each digit of an integer its own string [closed]

This may seem like it's a question for StackOverflow, but I want to make this question into a challenge. Challenges are more fun. Some introduction: In iOS programming and game development, I wanted ...
5
votes
10answers
602 views

Checking Word Grids

Your Task Given a list of words, check if they form a valid word grid. They form a valid grid if there are N words with N letters and they spell the same words vertically as they do horizontally. The ...
6
votes
11answers
359 views

Divisor sum from prime-power factorisation

The task is to compute the divisor sum of a number given its prime factorisation. Input Two arrays (or something equivalent) of length n, one containing the prime factor and the other containing the ...
18
votes
9answers
3k views

Average Color of an Image

Average color of an image Scientists have been able to determine the average color of the universe but in how many bytes can we find the average color on an image? Your task Your input will be a ...
3
votes
7answers
396 views

Alphabet Between Encryption

You must write a program that encrypts an input into a string of characters. For every character i in the input up to the second to last character, take the i and i+1 characters and encode them by ...
16
votes
6answers
378 views

Numbering Hierarchical Outlines

Write a program that takes in a string where every line consists of the character 0 indented by some number of spaces. The top line is not indented and every other line will be indented by at most one ...
42
votes
37answers
8k views
+500

Retina or Trash!

Retina or Trash! We live in a wonderful age of technology where we can have beautifully detailed 8K screens on our TVs, and even 2K displays on our phones for our mobile browsing pleasure. We've come ...
-6
votes
11answers
147 views

My Squiggly Lamp

While moving, I broke my lamp. Now, I need a new one. It's your job to make me a lamp! I'm not sure what size I want, though I know I want a squiggly one. Your program/function must take in a number ...
1
vote
0answers
110 views

Simple single-player board game, expected score distribution

This is the first problem I've posted here; please post criticisms in comments. Summary A game board consists of a starting space, an ending space, and between them are N spaces, each with an ...
8
votes
3answers
439 views

Square from Digits with Largest Sum

You should write a program or function which receives a list of digits as input and outputs or returns the largest sum achievable by putting these digits in a square. Input will always contain a ...
17
votes
12answers
3k views

Simpson diversity index

The Simpson index is a measure of diversity of a collection of items with duplicates. It is simply the probability of drawing two different items when picking without replacement uniformly at random. ...
5
votes
0answers
289 views

Printing the Cracker Barrel Game

Revised formatting and instructions Given a list of moves for a Cracker Barrel peg board game, or as @Steveverrill stated, Peg Triangle Solitaire: Game 1 Game 2 Game 3 1: 0 ,-1, -1 ...
12
votes
13answers
2k views

Draw the combinations that add up to 100

You have a box with a single digit number in each corner: 1|2 --- 3|4 If we concatenate the digits along rows left to right, we get 12 and 34. If we concatenate the digits along columns top to ...
1
vote
1answer
204 views

VSEPR Strikes Back! [Revamped Again]

(Note: I know that the VSEPR method fails sometimes, and that there are exceptional molecules. The challenge is about the molecules which conform.) Most people who have taken an introductory ...
7
votes
16answers
1k views

Word with greatest repeat of letters

Recently there was a question on Stack Overflow where the OP was trying to write a function to find the word in a string that has the most repeated letters. It is of course not hard to write one up in ...
17
votes
5answers
2k views

ASCII Borromean Rings

The Borromean rings are a curious set of three circles, linked such that the removal of any one of them will unlink the other two: You can make a set for yourself with a couple rubber bands and a ...
5
votes
5answers
431 views

Count from 1 to n in Negabinary and Negaquaternary

Instead of normal binary, you must count from 1 to an input in negabinary concatenated to negaquaternary. Here's an example, put in the form of an array: [11, 1102, 1113, 100130, 101131, 11010132, ...
33
votes
13answers
3k views

Fibonacci Spiral

Your goal is to generate a Fibonacci spiral with numbers. Example Input / Output 1 -> 1 2 -> 1 1 3 -> 1 1 2 2 2 2 6 -> 8 8 8 8 8 8 8 8 5 5 5 5 5 8 8 8 8 8 8 8 8 5 5 5 ...
10
votes
5answers
207 views

Generate Probabilities around a Numpad

Inspired by this question earlier today, I'd like to see interesting ways various programming languages can turn a numpad into probabilities. Commonly, tile-based games will allow you to use a numpad ...
7
votes
1answer
247 views

Knockout probabilities

Knockout is a basketball game where players take turns shooting. It is played as a sequence of two-player contests, each of which has the possibility of "knocking out" one of those players. Suppose ...
17
votes
1answer
406 views

Mini Golf Code Golf

This is a mini golf hole: The outer boundary is a circle with radius 10 and center (0,0). The inner boundary is a circle with radius 3 and center (0,5). The tee is at (0,-8). Assume the ball is ...
17
votes
9answers
502 views

Modular Fibonacci Cycles [duplicate]

The Fibonacci sequence is a well known and famous sequence, where each successive element is the sum of the previous two. A modular Fibonacci sequence is the same, except that the addition is ...
5
votes
1answer
121 views

Transit all day every day

In addition to contributing to Stack Overflow and other SE sites, I like to ride public transit during my free time. I'd be spending a fortune on cash fare and/or bus tickets every month if I didn't ...