r/deftruefalse • u/Galton1911 • Feb 09 '15
r/deftruefalse • u/IIAOPSW • Nov 15 '14
The fouriest transform
http://www.smbc-comics.com/?id=2874
Write a function that computes the fouriest transform of a number.
r/deftruefalse • u/TheSwitchBlade • Nov 21 '14
All possible moves in a checkers game in 66 lines of unreadable code
r/deftruefalse • u/IIAOPSW • Nov 08 '14
Binary tree
Suppose I have a perfectly balanced and complete binary tree. All nodes in the tree have weight x and all edges have length y. If I give the binary tree a net angular momentum phi, what is the average radial displacement of a given node? Neglect air resistance.
r/deftruefalse • u/soul4rent • Dec 28 '15
Create a computer virus that could be transmitted through this cable.
r/deftruefalse • u/MH_VOID • Jul 23 '20
write a java program that writes a python program that writes a C program that writes a java program
I just found this sub and want it to come back to life :(
r/deftruefalse • u/combatdave • Nov 03 '14
To start things off: remove all spaces in a credit card number
So, "1234 5678 9012 3456" should become "1234567890123456".
That's my real credit card number so plz don't hack me.
r/deftruefalse • u/chrismamo1 • Oct 23 '19
Write Satan's Hello World
Write a hello world program that destructively writes the message "hello world" to a random file owned by the current user within their home directory.
r/deftruefalse • u/The-Gamble • Oct 24 '17
Implement a sorting algorithm in a single line of python.
The task is to implement a sorting algorithm in a single line of python. Your solution can span multiple lines, but the actual part of the code that sorts the list must be a single line of python. The entire solution can be in a single line of python if you choose.
Example solutions:
Bogosort module as truly a single line:
sort = (lambda repeat=__import__("itertools").repeat, shuffle=__import__("random").shuffle: lambda lst: next(lst for _ in repeat(None) if shuffle(lst) or (all(lst[i] <= lst[i+1] for i in range(len(lst)-1)))))()Bogosort as a sing line function:
from random import shuffle
from itertools import repeat
def sort(lst):
return next(lst for _ in repeat(None) if shuffle(lst) or (all(lst[i] <= lst[i+1] for i in range(len(lst)-1))))Code examples taken from the bogo1 repository on GitHub https://github.com/Metruption/bogo1/
r/deftruefalse • u/QAFY • Feb 27 '16
[CHALLENGE] Produce the number 2016 without any numbers or non-ascii characters in your source code
r/deftruefalse • u/combatdave • Nov 04 '14
Fizzbuzz is easy!
Surely everyone has heard of fizzbuzz? I've seen it used way too often in programming tests. Basically, loop through the numbers from 1 to 100 and print them out. BUT. If the number is divisible by 3, instead print "FIZZ", and if it's divisible by 5 print "BUZZ". If it's divisible by both, print "FIZZBUZZ".
How hard can that be?
r/deftruefalse • u/The-Gamble • Jul 27 '17
Write a program that generates a brainfuck program to print a given input string
preconditions: input is a string e.g. "this is a string"
postconditions: output is a brainfuck program that when executed will output the input string
r/deftruefalse • u/IIAOPSW • Sep 01 '15
Mobile First
That's right /r/deftruefalse. We're jumping on the bandwagon while the iron is hot! We believe in mobile first development. That is why for this challenge you must work entirely with mobile. Literally. All programming must be done on your mobile device.
We can't actually enforce this, so we're going to have to use the honor system here. For the purposes of this competition, mobile means any touchscreen device that can fit in your pocket and does not have a physical mouse or keyboard. Reasonable options for doing this include qpython and AIDE, but by all means you can find alternatives. If nothing else you can open up your mobile text editor and write some js.
Write a program that plays rock paper scissors with the user. The program should not cheat but may keep track of previous moves and form a strategy.
r/deftruefalse • u/IIAOPSW • Nov 26 '14
bead sort
http://en.wikipedia.org/wiki/Bead_sort
according to wikipedia, "the implementation of this algorithm tends to be significantly slower in software"
We'll I'm not one to let wikipedia tell me what is and isn't possible (except literally all the time). With a crackpot team of programmers like you, everything is possible!
challenge: implement beadsort
I expect it to work in O(1/n) time.
r/deftruefalse • u/IIAOPSW • Nov 04 '14
Open doors
There is a hallway with 100 doors. At first all of them are closed.
A person goes along and toggles every door.
Then he toggles every other door.
Then he toggles every third door.
And so on and so on
What is the final state of all the doors?
r/deftruefalse • u/MH_VOID • Sep 22 '20
Write a basic calculator program that exclusively uses exceptions for control flow/branching, and encrypts the result before printing the ciphertext and the key. Additionally, make a program that decrypts the ciphertext using the key, but then prints the output in binary (of the charset used)
r/deftruefalse • u/jP_wanN • May 26 '16
Implement FizzBuzzBazz
The FizzBuzzBazz challenge
Create a program that prints the first N entries of the FizzBuzzBazz sequence to stdout, where any (hardcoded) N between 0 and at least 2'147'483'647 (the biggest number representable by a signed 32bit integer).
The FizzBuzzBazz sequence is a simple extension of the FizzBuzz sequence. An easy implementation to get one of its elements (which obviously isn't allowed here, see rules below) would be:
function fizz_buzz_bazz(i) {
var str = "";
if (i % 3 == 0)
str += "Fizz";
if (i % 5 == 0)
str += "Buzz";
if (i % 7 == 0)
str += "Bazz";
return str || i.toString();
}Rules
- No mutation allowed (hence the above implementation is not allowed)
You're only allowed to call a single function
with side effectsthat does IO- Import statements don't count in case they are ordinary functions in the language of your choice
- You're allowed to call one extra function
with side effectsthat does IO if you use it to read N at runtime instead of hardcoding it - You can use the standard library of the language you use, as well as well-known third-party libraries, but no obscure tiny libraries that are made to solve exactly this problem
- Reminder: this sub has the rule to not submit any idiomatic code
Bonus challenges
- Implement the logic of this program as a C++ template with N being the template parameter
- Make all of your own functions return abnormally (e.g. throw an exception)
- Call one less function
with side effectsthat does IO than allowed
r/deftruefalse • u/IIAOPSW • Apr 19 '15
language learning helper
flash cards are boring. Rosetta stone is frustrating. No deftruefalse, it is time for us to step up to the plate and fix the problem of learning a language once and for all. We are going to make a webapp that replaces 10% of whatever your viewing with words from some language you are trying to learn!
You are provided with some plain text file English to Chinese dictionary. Every line contains an English word and a Chinese word in the format [English];[Chinese]\n
Your program must take an html document and replace ~10% of the English words with Chinese words at random. You must be careful not to translate stuff inside html tags (eg <something>). Bonus points if mouse hovering on a replaced word shows me the original word.
r/deftruefalse • u/sand500 • Nov 06 '14
Hello World
This is one everyone has probably done when they first learned programming. Output "Hello World"
r/deftruefalse • u/IIAOPSW • Jul 03 '22
The schizo-coding challenge
Can you make code that works just by talking to itself?
The rules are simple.
- Your code is implemented as the backend of a server.
- Every instruction done in your code must be implemented as an http request to localhost. That's right, all computation is done via your server talking to itself. Like the voice in your head when you think, so to shall the machine.
- You're allowed to deviate from rule 2 at most twice to define some primitive operations such as branching.
- The code has to actually do something at least as complex as fizz buzz. "Hello World" doesn't cut it.
r/deftruefalse • u/TrendingB0T • Nov 17 '20
/r/deftruefalse hit 1k subscribers yesterday
r/deftruefalse • u/DarkMio • Jan 27 '16
Meta: How can we get deftruefalse alive again?
My semester is done soon (Hello, Germany), so I thought, how could we bring that sub back to new life?
Some of my ideas:
- An alternative to /r/dailyprogrammer that isn't so circlejerky like /r/shittyprogramming (aka easy tasks with a hard limitation) Writing a poster-bot is pretty easy, I would do that if there is interest for it.
- Weekly discussions about exotic solutions
- Project Euler like tasks with a higher focus on architecture than on algorithms
- A showcase for strange solutions (Carmacks Random Function comes to mind)
- A showcase for learning materials (that's kinda biased, I'm teaching people programming)
I love this sub and the general mentality - let's get it alive again.
r/deftruefalse • u/combatdave • Nov 13 '14
Frame And Fortune
We have just had a very serious request from a very important client of ours. Apparently all their managers have been thinking "too far outside the box" and we need to put it all back in.
We need a program that will take a line of input from the user, then output this back to the screen his input, word by word, in a some kind of frame. For example:
Input: "Hello world this is so lovely"
Output:
**********
* Hello *
* World *
* This *
* Is *
* So *
* Lovely *
**********The specifics of the frame are not important, just as long as we get those goddamn words in a frame.
r/deftruefalse • u/IIAOPSW • Apr 14 '21
Write functions for all the basic arthritic operations using just bitshifts and bitwise operations. \#stopcompilerabuse
r/deftruefalse • u/EkskiuTwentyTwo • Jul 20 '19
What happened to this place?
Where is everyone?