Questions tagged [open-ended-function]
For challenges where an exact output is not required but some property must still be fulfilled.
115 questions
10
votes
2
answers
214
views
Make a pretty cryptic crossword grid
Write a function/program that generates an aesthetically pleasing square cryptic crossword grid for a given size N. You do not need to include numbers.
The rules for aesthetically pleasing are:
The ...
6
votes
3
answers
570
views
Implement any rotation-invariant function on colored dodecahedrons
Each of a regular dodecahedron's 12 faces can be painted either red or blue. Your task is to implement a function \$f\$ that takes a painted dodecahedron (as 12 booleans, in whatever order and format ...
4
votes
3
answers
432
views
Operators modify in place, fix my expressions [closed]
I'm using a language "MutFk" where the basic operators like "+" and "*" actually modify the left hand side of the expression, and also return the modified version. For ...
13
votes
7
answers
851
views
Implement any 10-ary truth function with cyclic symmetry
Implement a function \$f\$ that takes 10 boolean inputs and returns a boolean.
The only requirement on \$f\$ is that it satisfies the identity
$$
f(x_1,x_2,x_3,x_4,x_5,x_6,x_7,x_8,x_9,x_{10})=f(x_2,...
33
votes
26
answers
8k
views
Print 4 billion if statements
Recently (okay, December 2023, I'm a little late) there's been a meme going around about a program checking if a 32-bit unsigned integer is even or odd using four billion if statements:
...
9
votes
10
answers
2k
views
Figure out which of your friends reveals confidential information to the media!
Exposition
You send secret information to 100 of your friends, and the next day you discover that the information has been published! Who could have revealed it?
To determine that, you number your ...
8
votes
12
answers
2k
views
Tic-tac-toe encode them all
I decided to create a complete guide to the great game of tic-tac-toe.
I expected it to be extremely popular, so to save on paper while printing it I decided to encode all possible game positions.
I ...
0
votes
4
answers
294
views
Implement a Monad
A monad is a type that wraps another type, that represents the available operations on the wrapped type. Monads have the following associated operations, where M is ...
9
votes
3
answers
258
views
Convert to Chomsky normal form
Let a context-free language be specified by its production rules and start symbol, e.g.
S -> AbB | C
C -> b | c
B -> AA | AC
A -> a | ε
Here and in the ...
11
votes
4
answers
2k
views
Output a 1-2-3-5-7... sequence
Follow-up of my previous challenge, inspired by @emanresu A's question, and proven possible by @att (Mathematica solution linked)
For the purposes of this challenge, a 1-2-3-5-7... sequence is an ...
22
votes
15
answers
2k
views
Output a 1-2-3 sequence
For the purposes of this challenge, a 1-2-3 sequence is an infinite sequence of increasing positive integers such that for any positive integer \$n\$, exactly one of \$n, 2n,\$ and \$3n\$ appears in ...
12
votes
7
answers
2k
views
Horsey sightseeing
A knight's tour is a sequence of moves of a knight on a chessboard such that the knight visits every square only once. For those who are not aware of how knights in chess work, knights are capable of ...
20
votes
9
answers
1k
views
Output an infinitely proportional sequence
In this challenge, an infinitely proportional sequence is defined as a infinite sequence of positive integers such that:
All positive integers are contained infinitely many times within the sequence.
...
17
votes
12
answers
1k
views
Encode the input to exclude a given character (part 1)
Your task is to write 2 functions/programs. They may share code.
The first function must, given a string and a character, output a new string that does not contain that character.
The second function ...
7
votes
0
answers
231
views
Give the best Chaitin incompleteness bound
This was originally a pure mathematics question, but I think I've got the best chance for an answer here.
The Challenge
For concreteness, consider Peano Arithmetic (PA). For some language L of your ...