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

14
votes
2answers
798 views

Which Friends characters were really the best friends?

The six main cast members of the American sitcom Friends all agreed that they would be paid the same salary throughout the run of the series (after season 2, at least). But that doesn't mean that they ...
6
votes
2answers
254 views

Brainfuck to Unary and Back

A language that is very useful in restricted source and other such challenges is Unary, a brainfuck derivative in which programs are written in with only one character. Your job is to write a program ...
0
votes
1answer
97 views

Insta-Name… Just Add Coder! [on hold]

In the English language, a surefire way to make a pronounceable nonsense letter combination is to make it entirely out of consonant- vowel pairs, e. g., Wu ko pa ha, or, Me fa ro. The challenge is to ...
2
votes
12answers
1k views

Print the Flag of the Arab Revolt!

It seems flags are a trend now, so what better place to start an account? I thought bars could use a twist to them, so I found this flag. Produce the following in the console output the fewest ...
20
votes
13answers
878 views

Format microseconds as hours:minutes:seconds etc

I'm new to this, but it looks fun. The following is inspired by a question that came up on SO today. Given a number of microseconds 0 <= n <= 86400000000 (e.g. 12345678900), output a formatted ...
6
votes
3answers
272 views

Print the Australian Flag!

Here we go again! This is my last flag for now! I originally wanted to do my national flag but I thought the stars were too hard so I posted Print the British Flag! instead, which itself was inspired ...
11
votes
4answers
373 views

Print out the Smallest Perfect Squared Square

Squaring the Square is a process of tiling a square using only other squares. If this tiling only uses squares of different sizes, then it is considered to be perfect. The smallest possible perfect ...
10
votes
5answers
494 views

Print the British Flag!

Inspired by Print the American Flag! this is a direct copy but with the British flag as it has some symmetries but is still quite complex! Your challenge is to produce the following ASCII-Art in as ...
6
votes
1answer
284 views

Find the Formula

Introduction What you have to do is, given an an ASCII diagram of a chemical, output the chemical formula. Rules Your code must not access the internet and may not use a stored library of ...
22
votes
8answers
4k views

Print the American Flag!

Special Independence Day (USA) themed challenge for you today. You must write a program that prints this ascii-art representation of The American Flag. 0 ...
10
votes
0answers
104 views

Automatic price-identification of scrolls in Nethack

OH GODS NO!! You can't leave us here with Doorknob! It'll be nethack everywhere! - 1d ago by Geobits Well, couldn't disappoint... Introduction (you can skip this section if you don't care about ...
2
votes
4answers
110 views

Dice adventure in the river Styx [duplicate]

You're sitting in the school cafeteria, microwaving your food like you always do around lunch. Suddenly the programming devil rises from the ashes of your burnt food and proposes a challenge: Sup ...
18
votes
7answers
520 views

Move to the printable ASCII front

Background The move-to-front transform (MTF) is a data encoding algorithm designed to improve the performance of entropy encoding techniques. In the bzip2 compression algorithm, it is applied after ...
13
votes
7answers
496 views

Recursive Binary Description

Recursive Binary Description Recently, I made my very first contribution to OEIS by extending and adding a b-file to sequence A049064. The sequence starts with 0, and then the next values are derived ...
4
votes
0answers
67 views

Shortest Wireworld [duplicate]

Wireworld is fun for the whole family! Your goal is to create a Wireworld implementation in the shortest amount of code possible. A Wireworld cell can be in one of four different states, usually ...
45
votes
15answers
4k views

Minimal NetHack

NetHack is a roguelike game where a player must retrieve the Amulet of Yendor from the lowest level of the dungeon. Commonly played via telnet, the entire game is represented with ASCII graphics. The ...
20
votes
16answers
2k views

Write a program that finds the most occurring paired letter in a string

The program must output the letter that is paired the most. For example, if your program was given the following string: "Sally's friend Bobby searched for seashells." it must output L because "ll" ...
10
votes
6answers
452 views

Print an ascii spiral in O(log n) memory

You may write a program or function that receives an odd, positive integer n, where n >= 3, as either a function argument, command line arguments, or on STDIN (or equivalent for your system), and ...
9
votes
5answers
385 views

High Precision Metallic Means

Background The metallic means, starting with the famous golden mean, are defined for every natural number (positive integer), and each one is an irrational constant (it has an infinite non-recurring ...
32
votes
14answers
3k views

Staircase writing

Write a program or a function that will output a given string in a staircase fashion, writing each part of a word that starts with a vowel one line below the previous part. For example: Input: ...
5
votes
1answer
114 views

Tokenize a String [duplicate]

Write a program or function that takes in a string through STDIN or function parameters, tokenizes it by parenthesis, and outputs the tokens on different lines. If the string contains a parentheses ...
27
votes
19answers
4k views

Leap for Leap Seconds!

Since today marks the occasion of the 26th leap second ever to occur, your challenge will be to output the date and time of every leap second in GMT or UTC that has occurred so far, as well as the one ...
11
votes
4answers
548 views

The very weird word counter

INPUT: Any string consisting exclusively of lowercase letters via function argument, command line argument, STDIN, or similar. OUTPUT: Print or return a number that will represent the sum of the ...
-2
votes
1answer
103 views

Print n-z characters of Unicode table [closed]

The challenge is to write a program which outputs all characters of the Unicode table from n to z range. For code "0000" is the first in order and you must skip all blank Unicode combinations. For ...
24
votes
24answers
3k views

Simple ASCII Gantt

This is a simple one: print an ASCII Gantt chart. Given tasks' ranges (start-time - end-time Tuples), print a Gantt timeline in the form of - characters for each task duration - each task in a new ...
5
votes
4answers
272 views

Find the optimal nim move

The game Nim is a mathematical strategy game, where 2 players take turns taking items from distinct heaps. On your turn, you must take at least one item, and you may take as many as you want, ...
23
votes
6answers
626 views

National Scheduling Conflict Championships

(I meant to post this while 1542: Scheduling Conflict was still the current xkcd, but I had a scheduling conflict.) Input The input will be a list of 3n elements, which represent n events. The ...
7
votes
4answers
335 views

Calculate the Orthocenter of a Triangle

Try to write the shortest program or function you can that prints or returns the calculated orthocenter of a triangle. The orthocenter of a triangle is the intersection point of the three altitudes ...
17
votes
11answers
549 views

Determine ranges from a list of values

Given an unsorted list of unique, positive integers, output the shortest list of the longest possible ranges of sequential integers. INPUT An unsorted list of unique, positive integers e.g. 9 13 ...
30
votes
2answers
555 views

Poor man's LaTeX

You are transported in a parallel universe where people write mathematical equations on computers as ASCII art by hand. As a LaTeX addict, this is totally unacceptable, and you ought to automate this ...
0
votes
0answers
61 views

Lost in (programming langage) translation [duplicate]

The goal Write a program that when executed will output code instruction in another programming langage. This code snipet can then be run to output the original program itslef. The rules Any two ...
1
vote
6answers
278 views

Number of characters in an integer's name [duplicate]

The goal of this challenge is to show how many characters are in the name of a given integer. This is code golf, so the smallest code wins. RULES The input will be between 0 and 100 (inclusive). If ...
3
votes
0answers
209 views

Write an interpreter for my new esoteric language PointerLang

I designed a language in which pointer arithmetic is the main tool of programming. Here are some examples. (print 0 to 9) =9[>1=9-*-1.>-1-1] (print 1 to 10 with spaces in between, character ...
29
votes
26answers
2k views

Mass of elements

There are more than 100 elements in the modern periodic table. You challenge is to output the rounded mass of an element with respect to the input given. Input Input will contain an abbreviation of ...
4
votes
0answers
140 views

Display a MIDI Track

Background MIDI files are quite different from WAV or MP3 audio files. MP3 and WAV files contain bytes representing a "recording" of the audio, while MIDI files have a series of MIDI messages stored ...
-2
votes
4answers
326 views

Write “Code Golf” without using any letters [duplicate]

Goal Your goal is to write "Code Golf" without using any letters [A-Z, a-z], even in your source code. It can't use of the following special characters either (!, _, <, (, ), ., {, }, ', and >). ...
17
votes
6answers
1k views

Nuggets of Code

Nuggets of Code It's a hypothetical situation where it is Friday evening, and you've invited over the usual golfing buddies to participate in your favourite hobby: code golfing. However, as this is ...
10
votes
3answers
230 views

Highest perimeter polyomino

This is code golf. The winner is the valid code with the smallest number of bytes. Challenge Given inputs M and N, the width and height of a rectangular grid of squares, output a polygon that ...
7
votes
0answers
113 views

Rotate a diamond tiling

Any regular hexagon can be tiled with diamonds, for instance like so (stolen from this question): ______ /_/_/\_\ /_/\_\/\_\ /\_\/_/\/_/\ \/_/\_\/_/\/ \_\/_/\_\/ \_\_\/_/ We'll consider ...
9
votes
2answers
206 views

Play a Perfect Game of 4x4 Hex

Background Hex is a two-player abstract strategy game played on a K×K rhombus of hexagonal tiles. Two opposite sides of the rhombus are colored white, and the other two black, and the two ...
-5
votes
4answers
169 views

Workweek completion

I work from monday to friday. I start my day at 8:12 and have lunch from 12:00 to 12:42. My workday ends at 16:30. If you are wondering why 8:12 and 12:42 -it's because 8:00 is the goal but it never ...
14
votes
2answers
268 views

Fill a water balloon

In this challenge, you must display ASCII art of a water balloon given the amount of water that the balloon is filled with: | __||__ | | / # #\ | | |######| | | |######| | | |######| | | |######| ...
8
votes
4answers
206 views

Ionic Compound Golf

Challenge Given two inputs, a positive ion and a negative ion, you must output the formula for the ionic compound which would be made from the two ions. This basically means balancing out the charges ...
8
votes
10answers
826 views

Triangular Square Numbers

Square numbers are those that take the form of n^2 where n is an integer. These are also called perfect squares, because when you take their square root you get an integer. The first 10 square ...
4
votes
2answers
186 views

Cut a silicon wafer into dies

When manufacturing chips, circular silicon wafers are cut into dies of needed size: The goal of this challenge is maximizing the number of whole dies that can be cut from a wafer of a given ...
17
votes
9answers
1k views

Draw Growing Stacks of Boxes

The Task In this challenge, your task is to draw an ASCII art representation of several stacks of boxes of increasing height. You are given as input the number of stacks, which is a positive integer. ...
16
votes
12answers
1k views

Output the Iccanobif Sequence

Write a program or named function that will output or return the sequence up to the nth integer in the Iccanobif sequence, documented on OEIS as A014258. Note that only the zeroth element in the ...
16
votes
11answers
588 views

Grid crossing sequence

If you take a sheet of graph paper and draw a sloped line that goes m units right and n units up, you cross n-1 horizontal and m-1 vertical gridlines in some sequence. Write code to output that ...
15
votes
8answers
904 views

Analyzing Earthquakes

Background The Random Domino Automaton is a toy model for earthquakes, inspired by cellular automata. In this challenge, your task is to simulate a simplified version of this model, and collect data ...
13
votes
2answers
377 views

Explosions on a chessboard

Atomic chess is a (very fun) variant of chess in which every capture causes an "explosion," destroying the captured piece, the piece doing the capturing, and all non-pawns in a 1-square radius. The ...