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

8
votes
4answers
224 views

64 bit ASCII weaving

Input Two integers: A non-negative integer W in the range 0 to 2^64-1, specifying the weave. A positive integer S in the range 1 to 255, specifying the side length. These can be taken in ...
4
votes
0answers
90 views

Code Golf : Parsing google results

When you search something on google, within the results page, the user can see green links, for the first page of results. In the shortest form possible, in bytes, using any language, display those ...
7
votes
1answer
110 views

All your bijective base are belong to us

Background A bijective base b numeration, where b is a positive integer, is a bijective positional notation that makes use of b symbols with associated values of 1 to b. Unlike its non-bijective ...
2
votes
1answer
275 views

MIRROR | ЯOЯЯIM

Challenge Given the equation of a line and the coordinates of the vertices of a shape, output the coordinates of the shape when reflected across the given line. Further Information The line's ...
5
votes
11answers
2k views

Is 7 l8r than 9? (Is seven later than nine?)

This is a fairly simple code golf challenge. Your program, given an ASCII string, is to parse that string into two strings, which it will evaluate. If the second string is "later" than the first one, ...
17
votes
4answers
1k views

Bowl Filled with Water

You should write a program or function which receives the volume of a bowl and the volume of the water in it as input and outputs or returns an ASCII representation of a bowl with water in it with the ...
9
votes
1answer
259 views

Pair Capacitors

Capacitors are notorious for being manufactured with high tolerances. This is acceptable in many cases, but some times a capacity with tight tolerances is required. A common strategy to get a capacity ...
19
votes
1answer
243 views

telgif: inverse figlet

figlet is utility that converts plain text to an ascii-art representation for use in banners and the like. For example: $ figlet "CODE GOLF" ____ ___ ____ _____ ____ ___ _ _____ / ...
1
vote
2answers
275 views

Quit Whining; Start Quining

Quit Whining; Start Quining Goal: Write a function or program that, given an integer n, will output a program in the same language that is a quine with a period of n. Description of Output Program: ...
7
votes
5answers
374 views

Average Out Two Lists

Average out two lists Challenge Given two lists of positive integers, determine whether it is possible to rearrange the elements into two new lists such that the new lists have the same arithmetic ...
15
votes
5answers
1k views

Find the nearest clock hands

Challenge Given a number of seconds past midnight, output the smallest angle between any two hands on a clock face, using as few bytes as possible. You may assume that the number of seconds is ...
8
votes
1answer
170 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 ...
10
votes
4answers
436 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 ...
10
votes
1answer
184 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
60 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 ...
45
votes
14answers
5k 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
208 views

The Time Traveller's Watch [on hold]

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 ...
32
votes
15answers
4k 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, ...
31
votes
12answers
4k 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
307 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
18answers
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
250 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
768 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
10answers
2k 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
165 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, ...
41
votes
51answers
6k 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
213 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 ...
16
votes
3answers
408 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 ...
21
votes
16answers
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
477 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
287 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 ...
17
votes
0answers
267 views
+50

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 ...
32
votes
21answers
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
194 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
879 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
136 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
605 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
360 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
398 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
379 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
39answers
8k views

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
155 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
114 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
444 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
290 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 ...