Skip to main content

Questions tagged [restricted-source]

Imposes a restriction on the source code used to solve the challenge, for example, having no numbers in the source code.

Filter by
Sorted by
Tagged with
153 votes
84 answers
25k views

Fewest (distinct) characters for Turing Completeness

Summary: For any given language, what is the smallest amount of unique characters for your language to be Turing-Complete? Challenge: For any language of your choice, find the smallest subset of ...
Julian Lachniet's user avatar
138 votes
150 answers
44k views

Obfuscated Hello World

Create the shortest possible obfuscated program that displays the text "Hello World". In order to be considered an obfuscated program, it must meet at least two of the following requirements: Does ...
Kevin Brown-Silva's user avatar
630 votes
337 answers
242k views

Produce the number 2014 without any numbers in your source code

Note to challenge writers as per meta consensus: This question was well-received when it was posted, but challenges like this, asking answerers to Do X without using Y are likely to be poorly received....
Joe Z.'s user avatar
  • 35.1k
93 votes
23 answers
12k views

Programming a Pristine World

Let's define a pristine program as a program that does not have any errors itself but will error if you modify it by removing any contiguous substring of \$N\$ characters, where \$1 \le N < \text{...
Calvin's Hobbies's user avatar
42 votes
17 answers
6k views

Tips for restricted source in Python

Just like code-golf, restricted-source pushes one to exploit quirks and hidden features of the Python language. We already have a place to collect all these tips for code-golf, those for restricted-...
Wheat Wizard's user avatar
  • 99.6k
41 votes
9 answers
6k views

"Convenient palindrome" checker

If you've ever tried to write palindromic code before, you'd know how much brackets tend to get in your way. ()() is not a palindrome, even though it kinda looks ...
algorithmshark's user avatar
169 votes
73 answers
25k views

How high can you count?

Challenge: Your task is to write as many programs / functions / snippets as you can, where each one outputs / prints / returns an integer. The first program must output the integer ...
Stewie Griffin's user avatar
123 votes
95 answers
23k views

ASCII's 95 Characters...95 Movie Quotes

Update: The winner has been decided, but the challenge is not over! Finally, nearly 3 months after the question first started, someone has remained the last answerer for more than a week! ...
Calvin's Hobbies's user avatar
38 votes
19 answers
6k views

Calculate 500 digits of pi

Write a program to calculate the first 500 digits of pi, meeting the rules below: It must be less than 500 characters in length. It cannot include "pi", "math.pi" or similar pi constants, nor may it ...
Thomas O's user avatar
  • 3,368
32 votes
47 answers
7k views

Implement hyperexponentiation/tetration without the use of '^' [closed]

The Challenge Implement tetration (aka Power Tower or Hyperexponentiation) with the least amount of characters. The Conditions Don't use the 'power' operator or its equivalents (such as ...
MrZander's user avatar
  • 942
272 votes
147 answers
37k views

Without using numbers, get the highest salary you can. But don't exaggerate!

As I'm applying for some jobs whose job advert doesn't state the salary, I imagined a particularly evil interviewer that would give the candidate the possibility to decide their own salary ...by "...
Nicola Sap's user avatar
  • 3,694
106 votes
65 answers
12k views

Find an Illegal String

The challenge is to find a string of characters that cannot appear in any legal program in your programming language of choice. That includes comments, strings, or other "non-executable" parts. ...
nneonneo's user avatar
  • 12.3k
74 votes
155 answers
14k views

Print X without X (cop's thread)

This is the cop's thread of a cops-and-robbers challenge. You can view the robber's thread here A pretty common beginner style question is to print some string, but there's a catch! You need to do it ...
Wheat Wizard's user avatar
  • 99.6k
67 votes
20 answers
7k views

Just repeat yourself

Write a program that outputs Do not repeat yourself! Your program code must respect the following constraints : its length must be an even number each ...
Arnaud's user avatar
  • 8,533
22 votes
25 answers
10k views

Look and say sequence [duplicate]

The look and say sequence is a basic form of run length encoding. The sequence starts with the number 1 and each additional number encodes the number of digits that are repeated before each digit ...
Thomas O's user avatar
  • 3,368
11 votes
44 answers
2k views

Hello ASCII World!

Construct a full program which outputs Hello, World!. The score of your submission will be equal to the sum of all of the ASCII values of the distinct characters. ...
dingledooper's user avatar
  • 22.8k
7 votes
17 answers
4k views

Multiply without multiply [closed]

Write the fastest (best big-O) and smallest multiplication algorithm for positive integers, without using multiplication operators. You are only allowed addition, subtraction, logical functions (AND, ...
Thomas O's user avatar
  • 3,368
45 votes
142 answers
12k views

Print X without X (robber's thread)

This is the robber's thread of a cops-and-robbers challenge. You can view the cop's thread here A pretty common beginner style question is to print some string, but, there's a catch!, you need to do ...
Wheat Wizard's user avatar
  • 99.6k
23 votes
40 answers
3k views

Palindromic palindrome generator

Create a program, that converts input string to a palindrome starting with the input string. The program itself must be a palindrome. For example input: neverod, ...
tmp's user avatar
  • 481
19 votes
21 answers
2k views

Length of String Using Set Theory

From Wikipedia Set-theoretic definition of natural numbers The set N of natural numbers is defined as the smallest set containing 0 and closed under the successor function S defined by S(n) = n ∪ ...
jing3142's user avatar
  • 365
86 votes
225 answers
23k views

The Letter A without A

Your task is to display the letter "A" alone, without anything else, except any form of trailing newlines if you cannot avoid them, doing so in a program and/or snippet. Code that returns (instead of ...
Buffer Over Read's user avatar
75 votes
193 answers
9k views

Output your Score!

Challenge: The concept is simple enough: write a full program to output its own code golf score! Output should only be the byte count of your program and a trailing ...
X1M4L's user avatar
  • 1,836
74 votes
173 answers
17k views

Print 0 to 100 without 1-9 characters

Print integers 0 to 100 (inclusive) without using characters 123456789 in your code. Separator of numbers can be comma or white space (by default <blank>, <...
user avatar
73 votes
84 answers
6k views

No strings (or numbers) attached

If you like this, consider participating in: The Official Dyalog APL 2016 Year Game The monthly Dyalog APL 2017 Code Golf Challenge Make 12 snippets/expressions, in the same language, that result in ...
Adám's user avatar
  • 30.9k
66 votes
11 answers
4k views

Only Even Bytes

The scenario Lately you have been noticing some strange behavior with your favorite text editor. At first it seemed that it was ignoring random characters in your code when writing to disk. After a ...
Wheat Wizard's user avatar
  • 99.6k
53 votes
53 answers
8k views

Print all ASCII alphanumeric characters without using them

Challenge Print the following characters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 The catch is that you may not use any one of them in ...
anna328p's user avatar
  • 6,404
47 votes
1 answer
1k views

Cyclic Levenquine

Background As most PPCG regulars will know, a quine is a program which outputs its own source code when run; and the Levenshtein distance between two strings is the minimum number of insertions, ...
user avatar
43 votes
17 answers
8k views

What's the shortest contiguous subset of ASCII you need to output the rest?

The printable ASCII characters (hex codes 20 to 7E) in order are: ...
Calvin's Hobbies's user avatar
38 votes
3 answers
5k views

Primality testing formula

Your goal is to determine whether a given number n is prime in the fewest bytes. But, your code must be a single Python 2 expression on numbers consisting of only ...
xnor's user avatar
  • 146k
30 votes
13 answers
7k views

Multiply two numbers without using any numbers

You are given as input two strings representing positive integers in base 10, such as "12345" and "42". Your task is to output a ...
N. Virgo's user avatar
  • 7,322
19 votes
13 answers
2k views

The Symbols vs. The Letters

The Symbols vs. The Letters The ASCII characters have been divided once again! Your sets are The Letters and The Symbols. The Letters ...
hmatt1's user avatar
  • 3,476
235 votes
30 answers
24k views

DISARM THE B.O.M.B.!

You have been hired for your tech knowledge as a Secret Agent's sidekick to ensure that the good guy can get his job done and the world can be saved. This is your last mission before retiring with a ...
Averroes's user avatar
  • 4,107
118 votes
76 answers
28k views

I'm a palindrome. Are you?

There have been a couple of previous attempts to ask this question, but neither conforms to modern standards on this site. Per discussion on Meta, I'm reposting it in a way that allows for fair ...
user avatar
90 votes
108 answers
15k views

Hello World 0.0!

source: Dilbert, September 8, 1992 I'm hoping to add a new twist on the classic "Hello World!" program. Code a program that outputs Hello World! without: String/...
zzzzBov's user avatar
  • 3,284
84 votes
42 answers
13k views

Non-discriminating Programming

We say a string is non-discriminating if each of the string's characters appears the same number of times and at least twice. Examples "aa!1 1 !a !1" is non-...
Laikoni's user avatar
  • 26.3k
81 votes
71 answers
16k views

Hello world! with limited character repetition

In a language of your choice, write a program that exactly outputs the characters Hello world! followed by a newline. The code: should not use any character more ...
Josh's user avatar
  • 2,781
58 votes
19 answers
5k views

Write the whole of the holed using the unholed

The ASCII characters from decimal code 33 to 126 are: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ...
Calvin's Hobbies's user avatar
55 votes
24 answers
6k views

Significant Whitespace

We define whitespace to be any of the three characters, tab (0x09), newline (0x0A) or space (0x20). For this challenge, you're to write two programs or functions in the same programming language, ...
Martin Ender's user avatar
54 votes
2 answers
4k views

JSF**k with only 5 symbols?

This is not a challenge but a question, I figured it was on topic because of Non-challenge questions that are related to solving programming puzzles or a particular type of challenge are also on ...
Jens Renders's user avatar
  • 1,588
33 votes
5 answers
2k views

Left Hand vs. Right Hand — Typists Challenge

Your task is to pit each side of the keyboard against each other and build two programs, in the same language, one using only keys on the left-hand side of a standard keyboard that outputs ...
Dom Hastings's user avatar
  • 24.3k
33 votes
72 answers
4k views

Restricted mini challenges Cop's Thread

Robber's thread Your task as cops is to select three things: A programming language An OEIS sequence A byte set You are then to secretly write a program in that language that computes the nth term ...
Wheat Wizard's user avatar
  • 99.6k
29 votes
69 answers
12k views

Check whether an integer is a power of 2 without using +,- operations [closed]

Write a program that checks if the integer is a power of 2. Sample input: 8 Sample output: Yes Sample input: ...
gthacoder's user avatar
  • 1,065
28 votes
27 answers
4k views

Minimal maximum byte for Turing Completeness

Summary We already have a challenge for the minimal number of characters for Turing completeness. But what about the minimal maximum byte? Challenge For a language of your choice, find a subset of ...
Sisyphus's user avatar
  • 14.9k
27 votes
19 answers
7k views

Shortest Sorted Hello World

Write a program that takes no input and prints Hello, World! to stdout or your language's closest alternative. The catch is that each line in your program must only ...
Calvin's Hobbies's user avatar
26 votes
11 answers
2k views

Official Dyalog APL 2016 Year Game

If you think this could be fun, but too much work, consider participating in this much smaller challenge. A bit of fun (and possibly frustration!) for 2016... Dyalog's "puzzle of the year". ...
Adám's user avatar
  • 30.9k
26 votes
7 answers
6k views

JSFuck Golf - Hello World

JSFuck is an esoteric language in which any Javascript statement can be accurately reproduced into another valid Javascript program that uses only the 6 characters ...
Joe Z.'s user avatar
  • 35.1k
11 votes
5 answers
962 views

Raise to the Power

Challenge Challenge is writing a program that takes a positive numbers a and a nonzero number b and outputs ...
flawr's user avatar
  • 43.9k
5 votes
49 answers
11k views

Find the absolute value of a number without built-in functions [closed]

The challenge is to take any real number as input and output or return the absolute value. You may not use any built-in functions other than those dealing with input and output/returning. This is code ...
Timtech's user avatar
  • 12.6k
3 votes
27 answers
2k views

Implement an integer parser

Implement an integer parser in the shortest code possible, with the following restrictions: The function or program can only take one argument: a string (or equivalent). Assume it to be signed and ...
Claudia's user avatar
  • 1,690
2 votes
8 answers
447 views

Exponentiation of natural numbers using only primitive integer operations [duplicate]

The challenge Implement the C equivalent of the pow() function (exponentiation) for natural numbers, in a language of your choosing, using only addition, ...
Todd Lehman's user avatar
  • 1,819