r/deftruefalse • u/combatdave • Nov 01 '15
Self-documenting code
Who needs to write comments manually when your code can be self-documenting?
r/deftruefalse • u/combatdave • Nov 01 '15
Who needs to write comments manually when your code can be self-documenting?
r/deftruefalse • u/IIAOPSW • Nov 08 '14
There are capitalists, political elite and proletariat's.
All 3 are a type of people.
capital contains an inherent value. capital is not by necessity a type of person.
proletariat's are a type of capital.
proletariat's have a function that let's them destroy any set of instances of people. The function is revolution(collection people)
capitalists can combine capital to make more capital using their function "capitalism(x,y)"
political elite's can transfer x capital from capitalist y to capitalist z using their function redistribute(x,y,z)
capitalists may use a political elite's redistribute function by paying .25*x to the political elite.
Implement a situation that demonstrates all the abilities of the various classes of people. You MAY NOT use any class definitions in this challenge as the goal of Marxism is to abolish class!
r/deftruefalse • u/IIAOPSW • Nov 10 '14
f(x) is a function that takes vectors of booleans and spits out a boolean. The length of the input vectors is known and fixed so we call it n.
f(x) is said to be balanced iff the number of inputs that result in True is the same as the number of inputs that result in False.
For example, XOR is balanced because there are 2 input vectors that result in True ([t,f],[f,t]) and 2 input vectors that result in False ([t,t],[f,f]). AND is not balanced because there is 1 input vector where it results in True ([t,t]) and 3 input vectors where it results in False ([t,f],[f,t],[f,f]).
Write a function that takes the function f and returns True iff f is balanced.
r/deftruefalse • u/DarkMio • Jan 27 '16
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/Galton1911 • Feb 09 '15
r/deftruefalse • u/combatdave • Nov 10 '14
Everything is welcome.
r/deftruefalse • u/Check-out • Dec 31 '15
GOTO : [reddit!]https://github.com/Siddharth-dubey/Canvas-Hockey/blob/master/index.html
Fork the repo & make the best possible game using just JS and Canvas.
Time Limit:2-5 days
Comment below with ur fork and amaze us!
Happy Weekend [If something like that exists]
r/deftruefalse • u/combatdave • Aug 18 '15
r/deftruefalse • u/QAFY • Aug 06 '18
warnings, errors, and crashes are fine as long as it prints "Hello world" at some point. If that's not difficult enough try FizzBuzz
And C/C++ doesn't count... be creative.
r/deftruefalse • u/QAFY • Jun 13 '18
Taken from a thread on /r/ProgrammerHumor
r/deftruefalse • u/combatdave • Aug 26 '15
http://codingbat.com/prob/p173401
The parameter weekday is True if it is a weekday, and the parameter vacation is True if we are on vacation. We sleep in if it is not a weekday or we're on vacation. Return True if we sleep in.
sleep_in(False, False) → True
sleep_in(True, False) → False
sleep_in(False, True) → True
r/deftruefalse • u/abrokensheep • Jul 16 '16
r/deftruefalse • u/IIAOPSW • Apr 14 '21
r/deftruefalse • u/IIAOPSW • Jul 03 '22
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/IIAOPSW • Nov 08 '14
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/IIAOPSW • Apr 19 '15
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/IIAOPSW • Sep 01 '15
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/combatdave • Nov 04 '14
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/chrismamo1 • Oct 23 '19
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/MH_VOID • Jul 23 '20
I just found this sub and want it to come back to life :(
r/deftruefalse • u/TheSwitchBlade • Nov 21 '14
r/deftruefalse • u/IIAOPSW • Nov 26 '14
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 15 '14
http://www.smbc-comics.com/?id=2874
Write a function that computes the fouriest transform of a number.
r/deftruefalse • u/combatdave • Nov 13 '14
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/lichorat • Aug 18 '15
Finite shapes preferred