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
15
votes
13answers
1k views

Quoting Big Brother

Task: Have your program randomly choose one of the following two quotes at runtime and print that one quote, exactly as shown. 1: ...
125
votes
125answers
38k 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 ...
28
votes
10answers
3k views

Hello world! with NO repetition

In any programming language that existed before this question was asked, write a program (not a function) that outputs the characters Hello world! followed by a ...
72
votes
117answers
15k views

Print the alphabet without using each vowel

Inspiration: in 1939, a man named Ernest Vincent Wright wrote a novel called Gadsby without using the letter 'e'. Your task is to write a set of (up to 5) programs in any language (which has a text-...
53
votes
146answers
7k 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 ...
-9
votes
16answers
642 views

Count up from 0 to 2017 without numbers in your source

This question was profoundly inspired by Joe Z's question. But, with a twist... So, now that it's almost 2017, it's time for a code question involving the number 2017. Your task is to make a ...
72
votes
179answers
18k 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 ...
85
votes
46answers
8k 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. ...
11
votes
11answers
552 views

Restricted-source polyglot string

Your goal is to write a program that prints the string abc in two languages. However, while the full code will print abc in one ...
111
votes
51answers
15k 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 ...
-8
votes
28answers
576 views

Reversible program

Objective Write a program that outputs some printable ASCII characters. The trick is that if the program is reversed byte-by-byte, it must output the same thing in the reverse order, byte-by-byte, ...
12
votes
1answer
336 views

Is everything in order?

Challenge: Input: a string, consisting of only printable ASCII characters Output: a truthy/falsey value whether its characters are in alphabetical order (based on their UTF-8 unicode values), from ...
14
votes
8answers
2k views

My source is in order, is yours?

Your challenge is to write a program, function, etc. that calculates if the passed string is "in order". That means that the characters of the string have character codes that are in order from ...
55
votes
31answers
9k views

Output the text “Code Bowling”

Code-Bowling You've been hired by Brunswick Bowling to create a simple program to output the text Code Bowling on their monitors. This company is worth a pretty ...
45
votes
131answers
14k views

Output programming language name

Challenge: In the programming language of your choice, take no input and output your programming language's name. Fair enough, right? Restrictions: You can't use any character that is included in ...
22
votes
25answers
3k views

Even and Odd Numbers

Sandbox Adapted from exercise 4 of 100 little Keg exercises The ability to repeat chunks of code within a program is an important part of any programming language. Also just as important is the ...
158
votes
63answers
22k 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 ...
-9
votes
3answers
217 views

No-alphanumeric code exec

Introduction In most interpreted languages, there is an operation that will run code generated at runtime. It generally requires alphanumeric characters to refer to this operation. Write a program, ...
49
votes
66answers
10k views

Divide a number by 3 without using *, /, +, -, % operators

Quoting this question on SO (Spoiler alert!): This question has been asked in an Oracle interview. How would you divide a number by 3 without using *, /, +, -, %, operators? The number ...
584
votes
280answers
214k 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 ...
104
votes
66answers
26k 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 ...
50
votes
67answers
13k views

yes is 91 lines long

yes, from coreutils, is 91 lines long. Many of them are comments, but that is still WAY too long. Edit from September 2019: the source file grew over the past five ...
45
votes
23answers
4k views

A Chiral Puzzle

A shape is chiral if no amount of rotation can make it look like it's mirror image. In this puzzle we will be writing chiral computer programs. For this puzzle we will think of a program as a ...
229
votes
115answers
32k 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 "...
28
votes
4answers
4k views

How close are we, really?

Please note: this is a restricted-source challenge — see details below! Each natural number \$n\$ has 10 faces: its decimal representations in bases \$1\$ through to \$10\$. For example, the 10 faces ...
15
votes
3answers
2k views

How divisible are you?

You are to create a program which, when given a positive integer \$n\$, outputs a second program. This second program, when run, must take a second positive integer \$x\$ and output one of two ...
11
votes
23answers
1k views

Find the positive divisors!

Definition A number is positive if it is greater than zero. A number (A) is the divisor of another number (B) if ...
44
votes
63answers
8k views

The Real Slim Shady

Echo the following in as few bytes as possible: ...
25
votes
18answers
9k views

Print 1 to 1000 in C++ without semi-colons

Following this popular question, present your solution which prints the numbers 1 to 1000 (all of them, not the string "1 to 1000" verbatim or something funny) in C++ without using any semi-colons. ...
18
votes
32answers
5k views

Find the number of leading zeroes in a 64-bit integer

Problem: Find the number of leading zeroes in a 64-bit signed integer Rules: The input cannot be treated as string; it can be anything where math and bitwise operations drive the algorithm The ...
78
votes
101answers
13k 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/...
85
votes
20answers
6k views

Pristine and Unique Code Bowling

Your challenge is simple: write as long of a pristine program as possible in the language of your choice using only unique bytes. (The full definition of a pristine program, copied from that link, is ...
115
votes
73answers
24k views

Largest Number Printable

Your goal is to write a program that prints a number. The bigger the number, the more points you'll get. But be careful! Code length is both limited and heavily weighted in the scoring function. Your ...
0
votes
2answers
319 views

KILL ALIENS NOW! [closed]

The world has been invaded by aliens. They are everywhere killing people and taking over the world. You are hiding with your friend. They have one weakness - the high pitched sounds. You can't go ...
215
votes
23answers
21k 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 ...
12
votes
5answers
604 views

Avoid repeating letters between five simple programs

You're challenge is to write 5 different full programs for the 5 following tasks: Print Hello, World! Given an input with STDIN, output the factorial, you can ...
25
votes
11answers
3k 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 ...
66
votes
80answers
7k views

Three-Three-Three!

Write a program that produces an output such that: At least three distinct characters appear. The number of occurrences of each character is a multiple of 3. For example, ...
50
votes
30answers
11k views

Print the phrase “And she said, 'But that's his.'” using only the alphabet

Print the phrase And she said, 'But that's his.' using only the following characters: ...
-6
votes
2answers
331 views

This ain't it Chief

This is mostly for the memes. I regret existing. Rules Your code has to output, by either printing or showing in stdout, the phrase This ain't it Chief. in that ...
-7
votes
28answers
1k views

Produce the word 'codegolf' without using any of its characters in code [closed]

You need to produce the word codegolf Rules: None of the characters of the word codegolf (i.e. 'c', 'o', 'd', 'e', 'g', 'o', 'l' and 'f') in either case can ...
24
votes
59answers
4k views

Adding without using a + or - sign

There have been many "Do __ without __" challenges before, but I hope that this is one of the most challenging. The Challenge You are to write a program that takes two natural numbers (whole numbers ...
55
votes
24answers
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, ...
1
vote
11answers
760 views

Hello… eh, who?

Introduction You started to write a "Hello, World!" program, but after you wrote the part to print the hello, you forgot what your program should actually print. So now, you somehow managed it to ...
48
votes
66answers
6k views

Depalindromize this string!

Given a palindrome generated according to this challenge, depalindromize it. Test cases ...
70
votes
76answers
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 ...
75
votes
37answers
12k 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-...
29
votes
63answers
3k views

Palindrome Hello, World

Your task is to create a program that prints "Greetings, Planet!" exactly to the console. Seems simple enough, right? Well, here's the trick. The code must be a palindrome, meaning it reads from right ...
12
votes
13answers
2k views

Output the ŋarâþ crîþ alphabet song without using (m)any letters

Your goal is to write a program that takes no input and outputs the following text: ...
65
votes
20answers
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 ...