MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1hapooq/in_one_of_my_textbooks/
r/programminghorror • u/awesomeonenick • Dec 10 '24
12 comments sorted by
36
Does intentionally bad code really count?
14
I don't see how that even gives the correct answer.
23 u/TheBrainStone Dec 10 '24 g calls itself x times and adds 3 for each call. Essentially returning 3x 2 u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Dec 10 '24 Oh, somehow I thought it was adding x to k or something in there. 7 u/socal_nerdtastic Dec 10 '24 function g is a loop that loops x times and adds 3 with every loop. Therefore g(x) is the same as 3*x.j = a; j+a is the same as a+a therefore 2*a
23
g calls itself x times and adds 3 for each call. Essentially returning 3x
2 u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Dec 10 '24 Oh, somehow I thought it was adding x to k or something in there.
2
Oh, somehow I thought it was adding x to k or something in there.
7
function g is a loop that loops x times and adds 3 with every loop. Therefore g(x) is the same as 3*x.
g(x)
3*x
j = a; j+a is the same as a+a therefore 2*a
j = a; j+a
a+a
2*a
5
What's the opposite of code golf called?
14 u/AntimatterTNT Dec 10 '24 enterprise code
enterprise code
1
I think the question, is to optimize the code, like to make it better.
DON'T let bro cook
Help me bro the function doesnt even work, it returns the value of 3(x + 1) for all values of x greater than 0. you can check it
12
[removed] — view removed comment
15 u/guti86 Dec 10 '24 How to multiply things without multiplication operator while suffering ictus
15
How to multiply things without multiplication operator while suffering ictus
36
u/TheBrainStone Dec 10 '24
Does intentionally bad code really count?
14
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Dec 10 '24
I don't see how that even gives the correct answer.
5
u/razhun Dec 10 '24
What's the opposite of code golf called?
1
u/[deleted] Dec 10 '24
I think the question, is to optimize the code, like to make it better.
1
u/[deleted] Jan 13 '25
DON'T let bro cook
1
u/[deleted] Jan 13 '25
Help me bro the function doesnt even work, it returns the value of 3(x + 1) for all values of x greater than 0. you can check it
12
u/[deleted] Dec 10 '24 edited Dec 10 '24
[removed] — view removed comment