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
30
votes
16answers
4k 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 ...
45
votes
78answers
13k views

Hack into a Lottery

You've recently made an account on a dodgy gambling site, where for a fee of 25 dollars, they will pay you back a random amount between 0 and 50 dollars. After getting around 5 dollars twice, you ...
52
votes
50answers
7k 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 ...
592
votes
291answers
220k 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 ...
18
votes
12answers
619 views

Almost Illegal Strings, Mark II (Cops)

Edit 2020-11-06: This challenge has been edited with new provisions to encourage participation. The edits have been bolded for emphasis. Welcome to a cops and robbers version of Find an Illegal ...
7
votes
9answers
345 views

Almost Illegal Strings, Mark II (Robbers)

This is the robbers' thread for 'Almost Illegal Strings'. See the cop's thread for information on participating. A section from the post is included here for convenience. The Robbers' Challenge Find ...
12
votes
14answers
1k views

Point-free look and say sequence

You are too make a program that take an integer as the input and outputs the first what ever that number was of the look and say sequence. For example: ...
238
votes
120answers
33k 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 "...
46
votes
139answers
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 ...
77
votes
184answers
19k 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 ...
52
votes
91answers
9k 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 ...
31
votes
85answers
8k 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 ...
54
votes
31answers
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: ...
92
votes
51answers
9k 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. ...
10
votes
2answers
3k views

Creating a function over multiple lines

I'm attempting to create a function over multiple lines. Parameters of the challenge: Function returns 'barbarian' Only 2 characters per line 40 lines maximum. I keep trying to use a fat arrow to ...
24
votes
21answers
3k 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 ...
118
votes
74answers
25k 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 ...
6
votes
21answers
2k views

Output all of printable ASCII using all of printable ASCII

Output all 95 bytes from 0x20 to 0x7E inclusive (printable ASCII including space), in any order, each at least once. The source ...
19
votes
28answers
2k views

A rainbow of identity functions

Closely related: How high can you count? Challenge In your programming language of choice, write as many different identity programs/functions as possible, under the following constraints: Each ...
163
votes
66answers
23k 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 ...
5
votes
4answers
263 views

More Codington Crescent

Who's up for a second attempt? If you've ever listened to the radio program "I'm sorry, I haven't a clue", then you've probably heard of the game called "Mornington Crescent". For ...
2
votes
13answers
891 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 ...
46
votes
5answers
2k views

Multiply with restricted operations

There's a 500 rep unofficial bounty for beating the current best answer. Goal Your goal is to multiply two numbers using only a very limited set of arithmetic operations and variable assignment. ...
90
votes
23answers
11k 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{...
33
votes
16answers
3k 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-...
-2
votes
20answers
582 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. ...
13
votes
2answers
609 views

Tips for restricted source in Haskell

I tested the waters on this sort of question with python, but now I get to the real question I want to ask. restricted-source challenges are uniquely rewarding in Haskell because of Haskell's strict ...
50
votes
31answers
7k views

Conway's Monster

This challenge is in honor of mathematician John Conway who passed away April 11, 2020 due to COVID-19. He was famous for coming up with the Game of Life cellular automaton and many other mathematical ...
26
votes
35answers
2k views

A prime test that's LITERALLY prime

Write a program that will test the primality of a specified number, and give the output as a Boolean value (True is prime). Your prime test can (but doesn't have to) be valid for the number 1. Here'...
59
votes
156answers
8k 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 ...
124
votes
58answers
17k 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 ...
47
votes
17answers
7k views

DON'T… do NOT lowercase UPPERCASE this!

Write a program that outputs its input unchanged. However: If all uppercase characters are removed from the program, it lowercases all uppercase letters. If all lowercase characters are removed from ...
7
votes
44answers
1k views

Add N numbers without using + or -

Given N integers, output the sum of those integers. Input You may take the integers in any reasonable format, including: stdin arguments an array or list Rules ...
23
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 ...
0
votes
12answers
535 views

Prime Challenge

CODE GOLF & Coding Challenges: In today's challenge, you'll be asked to print the following very special AND tricky AND satisfying Prime Number...! Are you golfers ready? ...
29
votes
27answers
5k views

Ah, why is there a bug in my program?

This challenge is inspired by @LuisMendo's MATL answer to my "binary multiples" challenge. Task Pick a code-golf challenge that is open and that has been posted before this one; let me call it the "...
7
votes
16answers
2k views

plz send teh codez!

Note to Moderators and editors: This post's title is for effect and should not be changed. The misspelling is intentional and part of the challenge. Backstory The (stereo)typical bad SO question ...
17
votes
40answers
3k views

The ASCII character countdown!

Since this is a answer-chaining challenge, you might want to sort answers by oldest. Your task is simple: Choose any printable ASCII character that's not chosen in the previous answers. And then, you ...
10
votes
9answers
720 views

Codington Crescent [duplicate]

Let's just see how this goes If you've ever listened to the radio program "I'm sorry, I haven't a clue", then you've probably heard of the game called "Mornington Crescent". For ...
69
votes
79answers
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 ...
20
votes
16answers
5k views

Determine if an integer is divisible by 3

Your goal is to determine if a number is divisible by 3 without using conditionals. The input will be an unsigned 8 bit number from 0 to 255. Creativity encouraged! You are ONLY allowed to use ...
12
votes
22answers
2k views

Sum in 2540 sums

This is my attempt to pair code-shuffleboard with code-golf. You need to write a full program or function that sums all codepoints of the input string. If there is no input, you can output any number,...
13
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: ...
38
votes
22answers
6k views

I don't even… I only odd!

Your task is simple: write a program that receives an integer as input and outputs it if it was odd, and does nothing otherwise (not halting is allowed). The challenge is, that you can only use odd ...
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-...
69
votes
81answers
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, ...
109
votes
67answers
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 ...
25
votes
65answers
5k 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 ...
16
votes
20answers
3k views

And and… and. And.?

Introduction: Inspired by the Puzzling-stackexchange post with the same name, which I've answered four years ago: Can you create a perfectly valid English sentence, which makes perfect sense, but ...
14
votes
9answers
5k views

Calculate the square root only using ++

Your task is to calculate the square root of a positive integer without using any mathematical operators to change the number, such as: Setting a variable (ex. squareRoot = 5) Addition (A+B) ...

1
2 3 4 5
7