Questions tagged [code-generation]

For challenges where answers are expected to generate code.

Filter by
Sorted by
Tagged with
6
votes
2answers
607 views

Generate all halting Smallfuck programs of length n

Your task is to write a program that, given a number n, returns a list of all valid, halting Smallfuck programs of length n, in any order. Actually, we're using a variation of Smallfuck called F2, ...
6
votes
2answers
555 views

Implement multiplication by a constant with addition and bit shifts

While looking at the ARM instruction set, you notice that the ADD instruction has the so-called "Flexible second operand", which can be abused for quick ...
5
votes
3answers
384 views

Quine permutation group [duplicate]

Write a program or function which, when run, outputs another program or function which is valid in the same language as the original program, and which itself will output another program or function ...
5
votes
1answer
364 views

Generate an expression yielding near-equidistributed result

Create a program (any language) which, given positive integer m, outputs a valid C expression that: Uses a single variable x ...
5
votes
2answers
550 views

Generate a self-extractor application

Create a program in any language, that takes an arbitrary binary input, and generates a valid C++11 program, which when compiled and run will print this binary input. So you could do this (on linux ...
4
votes
4answers
289 views

Program Sequence Generator

Your challenge is to implement a cyclic Program Sequence Generator (PSG) in a language of your choice. Given a language, L, a PSG in L is a program in L that outputs a PSG in L. Some properties of a ...
3
votes
3answers
746 views

Do not repeat yourself

Inspired by this challenge Given a number m, output a program that prints out the string Do not repeat yourself. Now for the ...
3
votes
9answers
822 views

Lazy brainfuck programmer [closed]

Background Joe is working on his new Brainfuck answer on Codegolf. The algorithm he's using to solve the challenge is a bit complicated, so Joe came up with idea of simplifying his Brainfuck notation ...
3
votes
1answer
316 views

Insert a simulated Ken Thompson virus into a program

A Ken Thompson virus is a virus that infects your compiler and other programs. Since it infects all your tools, you can not detect it without using tools from before the virus was introduced. Your ...
2
votes
7answers
864 views

Kolmogorov Complexity Meta Golfer

Mike Bufardeci (Pyth) - 175 bytes Leo (Retina) - 175 bytes devRicher (Lua) - 182 bytes Peter Taylor (CJam) - Waiting for clarification Lyth (C++11) - Waiting for clarification Edit: Several ...
2
votes
0answers
123 views

Predictor Generator [closed]

Write a program that when given a string \$S\$, it generates a program of the same language as itself. The generated program, when given a continuous substring of \$S\$, should predict the next ...
2
votes
2answers
317 views

Generate code in another language [duplicate]

Write a program in language A which outputs a program in language B where: Language A != Language B The output is itself a solution to this question. This is a popularity contest. If you want to ...
1
vote
1answer
281 views

Meta Obfuscate a String [closed]

There are numerous reasons for trying to obfuscate input. These include preventing decompiling, and being a nuiscance. With this in mind your challenge should your choose to accept it is to write a ...
1
vote
1answer
717 views

Escape control characters in a C string

C/C++ use double quotes "" for making string literals. If I want the double-quote itself, or certain other characters, to appear in the string, I have to escape ...
1
vote
1answer
111 views

Pythy Finite Ordinals [duplicate]

Write a program in any language that takes a single natural number n as input and generates a Pyth program that, in turn, produces, using nested lists, the nested set given by S(n), where: S(0) = ∅ ...
-3
votes
3answers
582 views

No Quine Built In? No Problem! [closed]

Are you tired of languages with built in quining techniques? Your challenge, should you choose to accept it, is to add a built-in quine feature to the language of your choice. Task Given some ...
-5
votes
2answers
506 views

Stop Internet Warming! [closed]

Task Write a program that will output another distinct program, and so on, while using as few distinct characters (and as few bytes) as possible. For example, program 1 should output program 2, and ...

1
2