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
-11
votes
5answers
567 views

A Perplexing Puzzle [closed]

The Challenge Create a program or function that takes no input, and outputs (or returns): I'm a programming paradox — no I'm not. Without using a character ...
28
votes
10answers
2k views

Heterograms, Palindromes, oh my!

(First challenge, please let me know if there are any problems with it.) A heterogram is a word where no letter of the alphabet occurs more than once, and a palindrome is a phrase that is the same ...
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 ...
33
votes
4answers
655 views

Splitting up ASCII

Given the 95 printable characters in ASCII plus newline, break it apart into two equal, 48 character groups (hereafter called group A and group B). Create a one-to-one mapping of your choice (you have ...
23
votes
23answers
1k views

Lookup without conditional statements

This challenge was inspired by programming an Arduino microcontroller. I have 6 LEDs and 6 buttons connected to various pins on the board. In the code, each button and LED is assigned an ID number (1-...
19
votes
6answers
1k views

Fibonacci in +!()[]script

Write a piece of JavaScript code that calls alert with an array containing the first 50 Fibonacci numbers in order. You may only use the following characters: ...
2
votes
8answers
416 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, ...
4
votes
0answers
645 views

C# program containing `? null :` that is still valid without `null` [closed]

I found an old post on Jon Skeet's blog that pointed out a puzzle from a tweet by Vladimir Reshetnikov: C# quiz: write a valid C# program containing a sequence of three tokens ...
40
votes
23answers
7k views

Holy Hole In A Donut, Batman!

Some characters are more holy than others. Using as few unholy letters as possible, display the statement above. Challenge Write a full program to print ...
-7
votes
4answers
591 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 >). ...
-11
votes
1answer
4k views

Output your username without using any of the characters in your username! [duplicate]

This is a little meta... I need you to golf some code that takes no input whatsoever but outputs your username. That may seem easy enough, but you are code restricted. For example, if my username was ...
-3
votes
3answers
555 views

Isn't It Ironic? A Little Too Ironic?

I made a joke the other day and sent it to some friends. One replied back "I love the irony!" and I looked at it and realized there was some irony in it. But that wasn't the irony she saw - the irony ...
31
votes
6answers
3k views

Write A Program That Outputs Its Mirror Level

There are 95 printable ASCII characters: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ In the ...
15
votes
6answers
723 views

Print strings without sharing characters

Edit: Allowed to reuse whitespaces. Your task is to write n programs (or functions, or bodies of functions without using parameters or the function names) in the same language. The kth program ...
34
votes
56answers
6k views

Capitalize first letter of each word of input

This is a relatively quick one, but I'm sure you'll like it. Codegolf a program that will take input in the form of a sentence and then provide the output with the first letter capitalized in each ...
16
votes
6answers
441 views

Princely Prefix by a Program in Pattern

You should write a program or function which outputs or returns as much of Chapter I of The Little Prince as it can. Your program or function has to be an M-by-N block of code containing only ...
28
votes
3answers
3k views

Quick! Escape the black hole!

It is the year 87,539,319 and solitary space-walking is now commonplace, many people travel into space by themselves, propelled by nothing but a jetpack on their backs, programming their course with a ...
7
votes
4answers
917 views

Write an URL compressor

Today your goal is to invent URL compression. You must write two programs: a compressor and a decompressor. The compressor will be called with one URL on stdin and its output will be read on stdout. ...
16
votes
5answers
657 views

Unwise bit operations

I like to golf in dc, but I'm sometimes frustrated because dc doesn't have bitwise operations. Challenge Provide four named ...
-3
votes
5answers
1k views

Print the Longest Sentence

I've searched around, and cannot find a challenge too similar to this one--however, it would not surprise me if this is not the first of its kind. My apologies if I've overlooked something. The ...
27
votes
18answers
6k 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 ...
11
votes
4answers
803 views

Encoding an URL in brainfuck

Inspired by this question, your goal today is to encode an URL in brainfuck. My browser has been hacked! The location bar has been turned into a brainfuck interpreter. I need a program that turns an ...
2
votes
7answers
377 views

42 in Rod Logic

Write the shortest possible program which takes a numeric input and outputs the result of adding 42 to the input. f(x) -> x + 42 There's only one restriction. ...
11
votes
8answers
940 views

Generate a Brainf_ck program that outputs a string of given length

Your friend is trying to break into a vault that has a peculiar locking system: it requires a certain number of gentle knocks in a particular spot. Your friend discovered the number (which is in the ...
22
votes
27answers
2k 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, ...
41
votes
9answers
5k views

Write a Quine in Plain English

Write a quine that consists of real English words separated by single spaces. A "word" is defined as a string containing only lowercase and uppercase letters (...
9
votes
2answers
830 views

Finding Programs in the Primes

Let's assign the numbers 0 through 94 to the 95 printable ASCII characters: ...
23
votes
2answers
844 views

Help me procrastinate on my computer repairs!

This challenge is brought to you by real (and tragic) inspiration. Recently, the number row on my keyboard has been a bit sporadic. The keys 1-9 work sometimes--but ...
21
votes
9answers
3k views

Finding prime numbers without using “prime characters”

Your task, if you choose to accept it, is to write a program/function that accepts an integer N as input. The program/function should output/return a list of the first N prime numbers. But here's the ...
-3
votes
4answers
168 views

Extract URI parts without using libraries [closed]

Given a URI like: postgres://username:password@hostname:PORT/dbname Extract it all into an array data-structure, like so: ...
1
vote
1answer
205 views

Printing a “Hello World” one-liner in bourne shell without directly using white space char [closed]

I'm currently trying to solve a tricky/silly challenge and i've come to a dead end. The challenge is basically to form a one-liner /bin/sh compatible command line which essentially outputs "Hello ...
-2
votes
2answers
109 views

Print the content of /etc/passwd with constant creation limit [closed]

Rules/Objectives: The program must be executed using ./program-name without shell parameter/arguments. the program-name may not ...
-3
votes
5answers
166 views

Shortest code special string sort

Objective/Restrictions: May only be answered with programming language that has function syntax (or procedure, method, lambda, macro, statement grouping and labelling) . Create a function with at ...
4
votes
0answers
92 views

Resistent counter [duplicate]

You just have to ouput exactly all the numbers from 1 to 10 separated by spaces. Your programme should work all the times even if a random character is deleted before compiling/interpreting. This is ...
1
vote
1answer
90 views

Implement range function without using numbers in code [duplicate]

You have to create a function range, such that it takes two (integer) arguments a and b (<...
8
votes
36answers
4k views

Calculate the square of an integer with restrictions [closed]

The Puzzle You have to write a program or function p(n) that returns the square of what is entered into it and you may assume that the input is a non-negative integer. Put in simpler terms, return n2....
23
votes
14answers
2k views

Recycling for the New Year

A good resolution for 2015 is to live more sustainably. We'll start by recycling. Recycling code, that is! Your task is to print the number 2015 to STDOUT, with or ...
50
votes
65answers
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 ...
-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 ...
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, ...
21
votes
3answers
2k views

Distinguish between Masculine and Feminine Nouns in French within 100 characters

You are to write a very small program within 100 characters. Your program must distinguish between masculine and feminine french nouns. The output should be un if ...
1
vote
4answers
498 views

Use threes to count the threes!

Write a program or function that takes two numbers - x>3 and n>0 - as input, and finds all possible bases ...
24
votes
24answers
4k views

Shortest Minmod Function

The minmod function is a variant of the familiar min, which appears in slope-limiting high-resolution schemes for partial differential equations. Given a number of slopes, it picks out the flattest ...
30
votes
12answers
3k views

Say Hello to the Pioneers of Computer Science

Choose your favorite famous computer scientist or computer science pioneer who was born in 1942 or earlier (as 1943 marks the start of the creation of the 'first' computer). They should have a ...
1
vote
0answers
378 views

Implement multiplication without using any loops, branches or function calls [closed]

I came up with the following in GNU C r=0;m(a,b){x:goto*(int*[]){&&x,&&y}[r+=a&1?0:b,a>>=1,b<<=1,a<1];y:;} One could argue ...
20
votes
4answers
2k views

The Fatal Error Challenge

Objective Write a routine that accepts a string of printable ASCII characters, s, and returns a string containing the same characters as s, reordered so that no two-character substring appears more ...
7
votes
2answers
415 views

Calculate a pi-based sequence with a pi-based frequence

Introduction Pi is 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089... Let's treat each digit as an instruction as to how to ...
119
votes
95answers
21k 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! ...
30
votes
16answers
6k 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 ...
64
votes
61answers
9k views

Write lines in detention

Introduction Bad news guys - you got detention. Your English teacher doesn't understand this site and wants you to "stop doing math on your digital dohickeys, this is English class!" She sentenced ...