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
39
votes
14answers
5k views

Programming with a Sporadic Shift Key

There's something wrong with your keyboard. The Shift key has a mind of its own. Every time you type a character you have no idea whether it will come out shifted or not (though it is 50-50). Besides ...
23
votes
8answers
2k views

Prolific Perfect Pangram Programs Pertaining to Printable ASCII

Updates: Time limit removed. You must be able to describe output - see new rule. A pangram is a sentence that uses every letter in the alphabet at least once, such as: The quick brown fox jumps ...
8
votes
2answers
910 views

¿Yo Quiero jQuery?

The Setup You are given a simple web page with 11 elements: 10 input elements with IDs i1 thru ...
20
votes
11answers
1k views

Restricted Polyglot

Polyglots are programs that are valid in multiple programming languages simultaneously. Most such polyglots are written in such a way that certain constructs of one language are interpreted as ...
7
votes
4answers
4k views

Un-hash the Java Hash

Hash Un-hashing The basic goal of this challenge is to exploit the high probability of collision in the Java Hash function to create a list of plausible inputs that created an outputted hash. The ...
22
votes
14answers
3k views

Un-round fractions

When you convert a fraction to a decimal number and you want to store that number, you often have to round it, because you only want to use a certain amount of memory. Let's say you can only store 5 ...
12
votes
15answers
10k views

Compare two integers in C or C++ without comparison operators

Produce the shortest program which takes two signed integers as input (through stdin or as arguments) and displays 3 different outputs depending upon whether the first number is (1) greater than, (2) ...
44
votes
4answers
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. ...
17
votes
10answers
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 ...
-5
votes
4answers
1k views

Convert to uppercase and lowercase without branching and comparisons

Write two functions/programs which take an ASCII code of character (8-bit unsigned integer) and one of them converts char to uppercase and other to lowercase. That is, they must be equivalent to ...
6
votes
6answers
4k views

Solve quadratic equation using only 3 variables and arithmetic

Write function which solves equation of degree less than or equal to 2 (ax^2 + bx + c = 0). Input Function should get 3 parameters - floating point numbers which ...
42
votes
14answers
7k 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: ...
12
votes
5answers
835 views

Raise to the Power

Challenge Challenge is writing a program that takes a positive numbers a and a nonzero number b and outputs ...
13
votes
10answers
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: ...
44
votes
63answers
8k views

The Real Slim Shady

Echo the following in as few bytes as possible: ...
47
votes
14answers
7k views

Make a code square with your favorite word

Pick your favorite 6 letter common English word that has no repeated letters, such as wombat. Write a program in an N×N grid of characters without comments such ...
55
votes
15answers
4k views

Write the whole of the holed using the unholed

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

Convert numbers to symbols without string or char literals

Read infinitely from stdin, and convert every number to the corresponding symbol on a US qwerty keyboard. No string or character literals anywhere are permitted. E.g. if the input is ...
9
votes
3answers
749 views

Calculate to how many cubes one cube can be cut

Imagine some cube which we can cut into smaller cubes without remaining pieces. Find to how many cubes a cube can be cut. For example, a cube can be cut into 8, 27 (obviously 3rd powers of integers) ...
22
votes
14answers
2k views

Khinchin's constant to as many decimal places as possible in 64 bytes or less

Khinchin's constant is a curious mathematical constant that, according to Wolfram MathWold, is "notoriously difficult to calculate to high precision". Here it is to 100 digits: 2....
46
votes
50answers
7k views

Rock Around the Clock

In as few Unicode characters as possible, print the following (144 characters): ...
85
votes
132answers
44k views

Loop without 'looping' [closed]

A question similar to this has been asked a couple of years ago, but this one is even trickier. The challenge is simple. Write a program (in your language of choice) that repeatedly executes code ...
1
vote
2answers
2k views

Babylon.js - loop through a scene and apply a simple fragment shader to all of the objects

You have a library - a fully loaded 2014 Babylon.js. You have a fragment shader - let's call it sample.fragment.fx. You have a scene - loaded ahead of time, possibly from a .babylon JSON file. Your ...
3
votes
1answer
2k views

A Most Excellent Code Golf Adventure

You dudes, the Most Excellent Adventure is a home brew roleplaying game system based on the Bill & Ted Films, plays gnarly air guitar riff. In this game system, when you draw from your dice pool ...
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 ...
-3
votes
9answers
413 views

Restricted minumum

You need to find the sum of minimum values of two list (same size) of small numbers. In a C like language, that could be expressed as: ...
3
votes
5answers
498 views

Increment Bitwise

Make a function that increments a number using only bitwise, loops, and conditions. Rules: All entries must be as per the language spec defined below. Scoring is not of code length, but of the ...
4
votes
7answers
2k views

Not-endless Recursion without a base case [closed]

Write a recursive function/program, to calculate either the Factorial or the Fibonacci number of a given non-negative integer, without explicitly implementing the base case(s). Your program/function ...
2
votes
2answers
1k views

Find nth root of variable without using math operators/functions

Write a program which, given two positive integers n and x, will display the n-th root of x (which is also x1/n) in decimal to an accuracy of 0.00001. The program must output the resulting number in ...
6
votes
3answers
1k views

Negate a number

You are to accept, on standard input, one number. You will then output the negation of that number. Your code will do nothing else. You may accept various formats if you wish (like "one" or ("uno+2....
20
votes
1answer
1k views

Efficient error-free* encoding [closed]

The mission As is well known, the genetic material of all known creatures on Earth is encoded in DNA; using the four nucleotides adenine, thymine, cytosine, and guanine. (Commonly represented by ATGC)...
214
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 ...
3
votes
21answers
5k views

Print 123454321 without if statements and using only 2 variables [closed]

The challenge: Write a function, that delivers following output: "1 2 3 4 5 4 3 2 1". Kids stuff? Of course. But here's the point: You only can use: 1 for loop, 2 int variables. You must not use: IF ...
13
votes
8answers
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) ...
3
votes
6answers
2k views

print “Hello, world!” without using literals [closed]

Write a program that prints "Hello, world!" without using any kinds of literals. Don't use string literals, numeric literals, byte literals, char literals, etc. Default values are allowed in ...
4
votes
28answers
1k 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 ...
6
votes
5answers
308 views

Write biSp in point-free form using as few terms as possible

The Haskell function biSp has type signature ...
26
votes
12answers
5k views

Print the Golden Ratio

This was fun! However with only three digits, the fun was over way too soon. This challenge is similar, but we'll keep the fun going. The Challenge Print as many digits of the Golden Ratio φ as ...
39
votes
9answers
5k 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 ...
54
votes
7answers
7k views

Duct tape can fix Mother's Day

Based on the Duct tape can fix anything question, that was too broad, with very similar rules. Only this time the objective is very specific: The challenge Your mission is to make a program that ...
13
votes
1answer
2k views

Duct tape can fix anything [closed]

Overview This challenge was inspired by this StackOverflow Meta post. In it, @hakre says: I've seen a project really written by Stackoverflow (a noob copies together from SO here and SO there), ...
63
votes
20answers
8k views

Hash collision: “NO” means “YES”

This Code Golf was inspired by the recent Daily WTF article You Can't Handle the True!, which features a string comparison written as: ...
-4
votes
4answers
900 views

Print “Hello World” in Ascii Art … without its characters [closed]

Your mission is to write a program that prints "Hello World!". Simple? The text must be human readable and should not be "|-| € |_ |_ 0 // 0 |? |_ |) \./" or something like that. The program ...
-2
votes
9answers
560 views

I challenge you to generate the following sequence [closed]

I challenge you to generate the following sequence till 100 terms through any programming language in shortest characters possible. The sequence is like this :- ...
20
votes
21answers
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 ∪ ...
12
votes
7answers
4k views

Determine if a number is prime without using arithmetic [duplicate]

Write a program which determines if a given number is prime. The catch: No digits or arithmetical operators. This means: No digits from 0 to ...
2
votes
6answers
411 views

Format a US address

Your task is to format an address given in all lowercase to a friendlier format. Here's the catch, no regexes. Addresses will be given in the following format: ...
5
votes
1answer
826 views

Let us create a sonnet quine! [closed]

There are programs that will output its source code to standard output and do nothing else. They also access no external output. This type of program is known as a quine, and is a common code ...
15
votes
18answers
921 views

Alphanumeric balance

Write a program which gets a string as its input, and counts the number of alphanumeric and non-alphanumeric characters in it. It has to display its result like this: input: ...
16
votes
17answers
3k views

Calculate a tip

You and a friend walk into a bar. The bartender treats you well, so you decide to tip him. So you pull out your trusty pocket computer and write a quick program to calculate a tip for you since it has ...