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

0
votes
2answers
29 views

Dice adventure in the river Styx

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 ...
7
votes
2answers
62 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 in the bzip2 compression algorithm, it is applied ...
9
votes
5answers
254 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
55 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 ...
37
votes
12answers
2k 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 ...
18
votes
16answers
1k 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
400 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
373 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
2k 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
107 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 ...
26
votes
17answers
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 ...
-3
votes
0answers
67 views

bit counting of an integer in ternary operator [on hold]

Following computes the number of bits set in an integer. int main() { int num = 7, mask = 1; int setBitscount = 0, cnt = 0; while(num) { if(mask & num) setBitscount++; num >>= 1; } ...
11
votes
4answers
518 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
97 views

Print n-z characters of Unicode table [on hold]

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 ...
23
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
264 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
612 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
330 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
542 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
536 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
60 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
274 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 ...
4
votes
0answers
201 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
136 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
320 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
226 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
105 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
205 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
164 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
264 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
203 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
822 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 ...
0
votes
0answers
82 views

Rubiks Cube Challenge 2 [closed]

Objective Build a program that does two things: 1) It must randomly generate a Rubik's cube consisting of six colors of your choice - meaning, your program doesn't need to draw a cube, but should be ...
4
votes
2answers
184 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
579 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
901 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
375 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 ...
11
votes
5answers
324 views

Tips for golfing in TI-BASIC

What general tips do you have for golfing in TI-BASIC? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to TI-BASIC (e.g. "remove ...
12
votes
11answers
1k views

Implement a FuzzyFinder

Inspired by this link I found on Reddit. A FuzzyFinder is a feature of many text editors. As you start to type a file path S, the FuzzyFinder kicks in and shows you all files in the current directory ...
30
votes
30answers
3k views

Stretching Words

Write a program or function that duplicates letters in a word, so that all the duplicated letters arranged from left to right in the word would form the input array. For example: input: chameleon, ...
13
votes
1answer
390 views

mtDNA mutation tree

Background: MtDNA is a part of the human DNA that is passed from a mother to a child and it rarely mutates. Since this is true for all humans it is possible to create a huge tree that visualize how ...
16
votes
2answers
1k views

Rotate a Chinese checkerboard

A Chinese checkerboard looks like this (based on this question, but this time it has a fixed size): G . G G G G G G . G B B B B . . Y G . Y . Y Y B B B . . ...
9
votes
3answers
477 views

Check if there is an isomorph substring

This question is an extension of Check if words are isomorphs and copies the first part of it to give the definition of an isomorph. Two words are isomorphs if they have the same pattern of letter ...
19
votes
2answers
308 views

Turn over a new leaf

You're given a tree, which in computer science tradition, has the root at the top and leaves at the bottom. The leaf nodes are labelled with numbers. Your goal is to take the special leaf marked -1 ...
13
votes
18answers
932 views

Format the given number of bytes to a human readable format

Challenge and origin On Stack Overflow a popular question is: How to convert byte size into human readable format in java? The most up voted answer has a quite nice method for doing this, but this is ...
15
votes
13answers
556 views

A Spintax {Task|Problem|Question}

Article Spinning with Spintax Article spinning is a search engine optimization technique by which search engine optimizers post a unique version of relevant content on article directories, web 2.0 ...