[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

ITT: post some of your shittiest code

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 40
Thread images: 4

File: 1407733565679.png (82KB, 694x801px) Image search: [Google]
1407733565679.png
82KB, 694x801px
ITT: post some of your shittiest code
>>
this is only the first part of it, the rest of it is just more of the same

import datetime
a=datetime.date.today()
b=(str(a))
c=(int(b[5:7]))
d=(int(b[8:10]))
e=datetime.date.today().isoweekday()
f=datetime.datetime.now().time()
g=(str(f))
h=(g[0:2])
i=(g[3:5])
j=(h+i)
k=(int(j))
l=(g[2:5])
m=(g[0:5])
n=(str(" "))
o=(str("AM"))
p=(str("PM"))
def time():
if k<=59:
print((str(12))+l+n+o)
elif k<=1159:
print(m+n+o)
elif k<=1259:
print(m+n+p)
elif k<=1359:
print((str(1))+l+n+p)
elif k<=1459:
print((str(2))+l+n+p)
elif k<=1559:
print((str(3))+l+n+p)
elif k<=1659:
print((str(4))+l+n+p)
elif k<=1759:
print((str(5))+l+n+p)
elif k<=1859:
print((str(6))+l+n+p)
elif k<=1959:
print((str(7))+l+n+p)
elif k<=2059:
print((str(8))+l+n+p)
elif k<=2159:
print((str(9))+l+n+p)
elif k<=2259:
print((str(10))+l+n+p)
else:
print((str(11))+l+n+p)
>>
>>56384933
For what purpose
>>
/g/ doesn't actually code lmao
>>
>>56385741
To shitpost
>>
1
2
3 4
>>
//get date +24 hours
Sleep(24h);
Echo date(H:m:s);
>>
There was that challenge during Christmas season a few years ago to write a program to draw a tree.

Well here's one of mine https://raw.githubusercontent.com/iamevn/fun/master/tree/tree.bit
>>
    theurl = "http://www.ipaddresslocation.org/ip-address-locator.php?lookup={0}".format(ip_address)
f = urllib.request.urlopen(theurl)
website = f.read()
def striphtml(data):
p = re.compile(r'^(.*)(?=IP Country Code:</i>)')
return p.sub('', data)
def striphtml2(data):
p = re.compile(r'(?=<i>IP Latitude:</i>).*')
return p.sub('', data)
def striphtml3(data):
p = re.compile(r'<.*?>')
return p.sub('', data)
def striphtml4(data):
return re.sub(r"\\nIP ", "\n•", data)
df = striphtml(str(website))
lo = striphtml2(str(df))
lol = striphtml3(str(lo))
result = striphtml4(str(lol))
print(result)

This was from a long time ago and since I've learned the error of my ways.
>>
>>56386337
what language is this
>>
>>56386360
BIT http://www.dangermouse.net/esoteric/bit.html
>>
>>56384933
Looking back, I have a line something like this:
return hex_to_binary(plaintext_to_hex(text)));
>>
>>56386311
lel, genius
>>
>>56384970
<code>
// PHP & JAVA & Perl & Python & C++...
return ( x >= y );
</code>
>>
All of my code is perfect relative to the system it'll be running on, just like I'm perfect relative to all the machines that the universe affords existence.

So there.
>>
>>56384933
Had couple interviews for internship (not even a job).
In one was asked to write something similar to FizzBuzz, was nervous and fucked it up.
mfw the companies do not want me even for free.
>>
>have to make a GUI in a game engine
>instead of creating a Button class I checked if the mouse cursor is within a certain area on the screen
>>
>>56386925
I had this same shit and during the interview I got mad at the disrespecting cunts so I made it print fuck you instead of fizzbuzz, lel I'm a comedic genius
>>
>>56386340
what exactly is wrong with it?
>>
>>56386294
NO
>>
start = int(input("from:"))
end = int(input("to:"))
yes = set(['y'])
no = set(['n'])
print ("Do you want numbers that are not Fizz/Buzz/Fizzbuzz to be printed? [y/n]")

choice = input().lower()
if choice in yes:
print ("")
print ("Doing fizzbuzz from", start, "to ", end)
print ("")
for count in range(start, end+1):
if (count % 5) == 0 and (count % 3) == 0:
print ("Fizzbuzz", count)
elif (count % 3) == 0:
print ("Fizz", count)
elif (count % 5) == 0:
print ("Buzz", count)
else:
print (count)

if choice in no:
print ("")
print ("Doing fizzbuzz from", start, "to ", end)
print ("")
for count in range(start,end+1):
if (count % 5) == 0 and (count % 3) == 0:
print ("Fizzbuzz", count)
elif (count % 3) == 0:
print ("Fizz", count)
elif (count % 5) == 0:
print ("Buzz", count)
>>
>>56387957
>elif not choice: print(count)
>>
File: counterprogramr.png (116KB, 1024x768px) Image search: [Google]
counterprogramr.png
116KB, 1024x768px
>>
>>56387672
Classic
>>
loop        ;grob
{
PixelSearch,,y2, 520, y1-100, 590, y1, 0xDD4443, 0, fast RGB ;red
if !ErrorLevel
break
PixelSearch,,y2, 520, y1-100, 590, y1, 0x71F3FF, 0, fast RGB ;blue
if !ErrorLevel
break
y1-=100
if (y1 < 0 and detectRetry = 0)
{
y1 := windowheight
detectRetry = 1
sleep 300
}
else if (y1 < 0 and detectRetry = 1)
{
chop := windowheight-50
return
}
}
y2+=100
loop ;fein
{
PixelSearch,,y3, 520, y2-30, 590, y2, 0xDD4443, 0, fast RGB ;red
if !ErrorLevel
break
PixelSearch,,y3, 520, y2-30, 590, y2, 0x71F3FF, 0, fast RGB ;blue
if !ErrorLevel
break
y2-=30
if (y2 < 0)
{
chop := windowheight-50
return
}
}
y3+=30
loop ;sehr fein
{
PixelSearch,,y4, 520, y3-5, 590, y3, 0xDD4443, 0, fast RGB ;red
if !ErrorLevel
break
PixelSearch,,y4, 520, y3-5, 590, y3, 0x71F3FF, 0, fast RGB ;blue
if !ErrorLevel
break
y3-=5
if (y3 < 0)
{
chop := windowheight-50
return
}
}
if y4 < 45
chop = 0
else
chop := windowheight-y4-17
return
>>
>>56388075
Story:
Pixelsearch would give the coordinates of the first pixel found with the specified hex color.
Problem is, that it searches from left to right and from top to bottom.
I had to search from bottom to top though to find the bottom result.
Since there was no working alternative, I tried just searching line by line from bottom to top but it was extremely slow. So I did it like this which still works almost instantly and does search from bottom to top.
>>
File: 1471477689849.png (311KB, 652x669px) Image search: [Google]
1471477689849.png
311KB, 652x669px
https://www.udemy.com/sara-learns-to-code-making-an-app-from-scratch/
>>
>>56388446
Has no one showed them a for / while loop?
Hell, the for loop wouldn;t necessarily even need a body.
>>
>>56388446
I think mostly guys buy this course.
>>
>>56388639
go do it if you're so smart?
that's an interview question btw
most people get it wrong

>>56388660
I know I will torrent the shit out of it the moment it comes out
>>
>>56384933
I would post some code from the Tinder app if I could.
>turn off high accuracy GPS mode
>app spams you with requests to turn it back on
>it will even bring the app from background back into focus to request turning it back on
>turn off wifi for a moment
>app spams you with requests to turn on wifi network detection while wifi is disabled
I even emailed them about it saying that high accuracy isn't even required because the app doesn't need your pinpoint location, it's not like a mapping app, within a kilometer makes no fucking difference, and that spamming requests is bad design and they just emailed back saying that high accuracy mode was required.

I don't doubt that it is required because they get paid by Google/Facebook to enforce it.
>>
>>56388686
>go do it
int somefunction (int base, int mult) {
int result = 0;
while (mult > 0) {
result += base;
--mult;
}
return result;
}
>>
File: there.gif (136KB, 447x437px) Image search: [Google]
there.gif
136KB, 447x437px
>>56388734
nope, try again.
>>
>>56388686
Just put it on pornhub
>>
>>56388747
Your gif moves too fast and I'm not opening it in something else.

I also saw you post in the DPT a few weeks ago.
>>
>>56388762
>not speed reading
>>
for x in range(1, 101):
if x == 1:
print("1")
elif x == 2:
print("2")
elif x == 3:
print("Fizz")
elif x == 4:
print("4")
elif x == 5:
print("Buzz")
elif x == 6:
print("Fizz")
elif x == 7:
print("7")
elif x == 8:
print("8")
elif x == 9:
print("Fizz")
elif x == 10:
print("Buzz")
elif x == 11:
print("11")
elif x == 12:
print("Fizz")
elif x == 13:
print("13")
elif x == 14:
print("14")
elif x == 15:
print("FizzBuzz")
elif x == 16:
print("16")
elif x == 17:
print("17")
elif x == 18:
print("Fizz")
elif x == 19:
print("19")
elif x == 20:
print("Buzz")
elif x == 21:
print("Fizz")
elif x == 22:
print("22")
elif x == 23:
print("23")
elif x == 24:
print("Fizz")
elif x == 25:
print("Buzz")
elif x == 26:
print("26")
elif x == 27:
print("Fizz")
elif x == 28:
print("28")
elif x == 29:
print("29")
elif x == 30:
print("FizzBuzz")
elif x == 31:
print("31")
elif x == 32:
print("32")
elif x == 33:
print("Fizz")
elif x == 34:
print("34")
elif x == 35:
print("Buzz")
elif x == 36:
print("Fizz")
elif x == 37:
print("37")
elif x == 38:
print("38")
...
>>
>>56388777
My realtime visual memory buffer is poor. I can only speed read if my eyes are moving and the background is textured.
>>
>>56384933
When first learning programming (in C), I wanted to check user inputs. I did it like this.

if(input[0] == 'S' && input[1] == 't' && input[2] == 'r' && input[3] == 'i' && input[4] == 'n' && input[5] == 'g' && input[6] == '1') {}
else if(input[0] == 'S' && input[1] == 't' && input[2] == 'r' && input[3] == 'i' && input[4] == 'n' && input[5] == 'g' && input[6] == '2') {}
else if(input[0] == 'S' && input[1] == 't' && input[2] == 'r' && input[3] == 'i' && input[4] == 'n' && input[5] == 'g' && input[6] == '3') {}


Some of the strings I compared this way were pretty damn long.
>>
>>56388787
Should use a switch case.
Thread posts: 40
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.