Tagged Questions

Kolmogorov complexity, informally, is the amount of code it takes to produce a given string of text. When posting a challenge in this category, please make sure it adds something new to existing challenges.

106 views

Brute force my code lock [duplicate]

The code lock for my garage has 5 buttons, labeled "1 2", "3 4", "5 6", "7 8", and "9 0". To open the garage door, you have to enter the correct 4-digit PIN. As you can see, every button represents ...
550 views

Output a Magical 8 Trapezium

Your task is to output a Magical 8 Trapezium: 1 × 8 + 1 = 9 12 × 8 + 2 = 98 123 × 8 + 3 = 987 1234 × 8 + 4 = 9876 12345 × 8 + 5 = 98765 123456 × 8 + 6 = 987654 ...
5k views

Print Numbers from 1 to 10 [duplicate]

This might be a very simple challenge, but I am surprised it hasn't been done on code-golf yet: Print all Integers from 1 to 10 inclusive in ascending order to the Standard Output Your output format ...
4k views

Polar Bear, Polar Bear, what do you hear?

The text of the children's book Polar Bear, Polar Bear, What Do You Hear? has a very simple pattern. You might use the text to teach introductory programming concepts. My son was quickly bored by ...
3k views

Print all alphanumeric characters plus underscore

Write a program or function that prints or returns a string of the alphanumeric characters plus underscore, in any order. To be precise, the following characters need to be output, and no more: ...
746 views

Print the ASCII printable character set [duplicate]

Challenge: Print the entire printable ASCII charset (not just a range!) in order. [space]!"#\$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ (Of ...
319 views

Use 16 colors while writing Hey! 4 times

i.e each byte appears in a different ANSI shell colour. Rules Resetting the color of the shell after output is not required Must be output in STDOUT or the primary colour text output of your ...
3k views

Visualise Bit Weaving

The esoteric programming language evil has an interesting operation on byte values which it calls "weaving". It is essentially a permutation of the eight bits of the byte (it doesn't matter which end ...
475 views

All Armstrong numbers

An Armstrong number (AKA Plus Perfect number, or narcissistic number) is a number which is equal to its sum of n-th power of the digits, where n is the number of digits of the number. For example, ...
484 views

Send a cosmic call

The cosmic call is a message sent into space in 1999 and 2003. It's made of 23 127*127px monochrome bitmap images, as detailed here. Your mission is to write a program that displays the entire 127*...
539 views

The teacher is always wrong, flip his answer

Your dumb teacher is always wrong, so flip his answer. Change these responses True -> False Yes -> No 0 -> 1 Yeah -> Nope and vice versa. Keeping punctuation and the first letter's ...
319 views

Ain't there nothing up my sleeves

Note: reference to Nothing up my sleeve number. Your task is to take no input and generate this exact output: d76aa478 e8c7b756 242070db c1bdceee f57c0faf 4787c62a a8304613 fd469501 698098d8 ...
320 views

Display a cribbage score in ASCII

Cribbage is an interesting game, because you need a specific board to score your game. A cribbage board looks like this: Notice how the first column is on the left as it goes up, then on the right ...
3k views

24 and 12 Hour Times

Write a program or function with no input that prints or returns this string of 24-hour and 12-hour times: 00:00 12:00am 01:00 1:00am 02:00 2:00am 03:00 3:00am 04:00 4:00am 05:00 5:00am 06:00 6:...
74 views

Create a 3d-like ASCII art [duplicate]

Your challenge is to convert a string to an ASCII art version of it. Input Your input is a single string, wich you should convert into the ASCII art version of it. Output Your output should be ...
322 views

Golf me an ASCII Alphabet

Don't you find that reading simple text isn't appealing enough? Try our ##### ### ### ##### ##### ##### ##### # # ##### # # # # # # # # # # # # # #...
583 views

Correct way to add numbers to get lots of 8's

Inspired by this question which was further inspired by this one, write a program which takes two integers and adds them in a unique way, by performing an OR operation on the segments used to display ...
310 views

Adam7 is an interlacing algorithm for raster images, such as PNG. It is called the "Adam7" algorithm because it was invented by Adam M. Costello, and it is generated by following a certain pattern 7 ...
346 views

EDIT It is not clear how answers to the question of compressing a long text, without cumulative properties are relevant to golfing a short cumulative strong, any more than general Lempel Ziv ...
5k views

Build a triangle without any triangles

As a little kid, I liked to play with these toys a lot: They probably intended for these to be used for art, but I always used them for math! Fractals, patterns, etc. One time, I was given this ...
516 views

420 <s>Blaze</s> Golf It

This is a pretty simple challenge, but (I hope) a fun one. Task If right now either the month is 4 and the day is 20, the hour (on a 12 hour clock) is 4 and the minute is 20, or the minute is 4 and ...
443 views

Code a code page

Introduction A code page maps integer values to a specific character. We can visualize a code page like this: +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | | 0 | 1 | 2 | ...
2k views

Display “Happy Easter!”

Your task is to print the following: _ _ _______ _ | | | | (_______) _ | | | |__ | | ____ ...
956 views

Fun with flags!

Write a full program with a source code of 256 bytes or less that looks at an image of a flag and determines what country that flag is from. A zip file containing the 196 different flags in the ...
385 views

Draw an ASCII art phone keypad

Draw the following in the fewest bytes possible: ------------------------- | | ABC | DEF | | 1 | 2 | 3 | ------------------------- | GHI | JKL | MNO | | 4 | 5 | ...
269 views

Golf English – using contractions

I have not laughed as much from Stack Exchange content as I have from this. I think you all will enjoy this challenge, as it is inspired by what is over there. You will write a function or program ...
128 views

Generate E-series of preferred numbers

Resistors and other electronic components are typically manufactured with values that conform to one of the E-series of preferred numbers. IEC 60063 defines the following E-series: E6: 10 15 ...
442 views

How many sides does this polygon have?

So in 1st grade math, you learn the names of polygons. Three sides is a triangle, 4 is a square, and 5 is a pentagon. However, in 1st grade honors, you go a bit further. Your challenge There is a ...
393 views

Given a the name of a state of the United States as a string (with case), return the number of votes the state has in the Electoral College. Write a full program or function, and take input and output ...
763 views

Is this number random?

I asked random.org for 128 random integers between 0 and 232 - 1. Since the random number generator was so eager to give the first 64 numbers first, they're obviously more random than the other 64. ...
2k views

Code Golf Golf Score

It's Friday... so let's go golfing! Write code that determines the player's scoring on a hole in a game of golf. The code can be either a function or entire program. As the genre suggests, shortest ...
2k views

How many characters are there on the icon of a Stack Exchange site?

Given the name of a Stack Exchange site which doesn't have their own design yet, decide how many ASCII characters (non-ASCII ones are counted separately) are there on their icons. Your code should ...
1k views

Draw an ASCII house

This is a window: --- | | --- Let's add some walls |. Put two spaces on either side of it so that the window has plenty of room. | --- | | | | | | --- | Now let's add a roof and a ceiling. ...
727 views

Surrounding Countries

Ever wonder what countries surround another? I do too, sometimes, and, well, here's the challenge for it. I have provided a list of countries and the countries that they touch that you must recognize ...
3k views

Quack the Angry Duck

No one is quite certain what the emoticon >:U is intended to represent, but many scholars believe it looks like an angry duck. Let's assume that's the case. Task Given an integer n between 0 and ...
176 views

It's the end, but the code-golf has been prepared for

Welcome to BBC Casting. We need a program that we can use to select a new actor to play The Doctor on Doctor Who. In the spirit of the show, your program will perform a regeneration from one actor's ...
4k views

Picture of an old friend in ASCII art

I hope this picture looks familiar to you. It's one of Pacman's ghosts in his "vulnerable" state, after Pacman has eaten a power pill. The challenge Picture our ghost in a little frame, using ...
190 views

LaTeX Table Generator

Write a function or program which, given a number of lines and columns, generates a corresponding tabular environment for LaTeX with no data in it. Table format and tabular Environment Here is an ...
460 views

Introduction You are probably familiar with the "puts on sunglasses" emoticon-meme: (•_•) ( •_•)>⌐■-■ (⌐■_■) In this challenge, your task is to take the first line as input, and output the last ...
148 views

Output the given English pronoun table

Output the provided table of English pronouns exactly, in as few bytes as possible. Code rules The code will take no input The table is tab-delimited Each line begins with a single tab \t if there ...
130 views

Convert to ASCII Agrippa Numbers

Challenge Given a natural number, output it in the ASCII form of Agrippa's number system. Description I like odd alphabets and numeral systems. My favorite numeral system is one given by Heinrich ...
3k views

Output all the white or black squares of a chessboard

Introduction This is how a chessboard looks like. You can see that a1 is a dark square. However, b1 is a light square. The Task The challenge is, given dark, light or both, output all the dark,...
780 views

Output the current time in ascii art

Challenge Your task is to output the time (in 12 hour time) in ascii art. All characters that will be used are as follows: ___ __ ___ ____ _ _ _____ __ ______ / _ \ /_ | ...
665 views

How many words of power did I shout?

In Skyrim, the player character can use powerful magic shouts (Thu'ums) to achieve their goals. Every shout consists of three words, however, the player can use the first one or two words to achieve ...
2k views

Convert English to a number without built-ins or libraries

This challenge is similar to this other, however I made a restriction (see bold text below) that I think would made it much diffent and (I hope) fun either. The Challenge Write a program or a ...
707 views

Print cos(2π/17) exactly

One way to construct a regular heptadecagon starts with drawing a horizontal line of length 1 from the center to a vertex. Then the distance along that line from the center to the second vertex is cos(...
3k views

Go generate some Java

Your boss wants you to write code like this: public static boolean isPowerOfTen(long input) { return input == 1L || input == 10L || input == 100L || input == 1000L || input == 10000L |...
4k views

Generate 100 Java Tuple classes

Write a script that writes to standard output, or your language's equivalent, 100 lines of (valid) Java code that begins with: class Tuple1 {public Object _0;} class Tuple2 {public Object _0,_1;} ...