[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]

the de-optimization olympics

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: 16
Thread images: 3

this is a thread where you compete to see who can complete a task in the most inefficient, roundabout way possible. You may use any language. The only rule is that your code must work and complete the task listed below.
>>
>>58976989

not here to do your homework

creative approach tho faggot
>>
>>58977003
Naw, I just saw some yanderedev code in a /v/ thread and I want to see just how complicated one can make a simple task.
Anyways, go to this website:
https://adriann.github.io/programming_problems.html
pick one of the tasks and type up an abomination
>>
I can't even imagine writing software in more lines of code than needed unless it's just weak ass shit like putting every line of code into a void function operating on global variables.

There's no fun in that.
Writing shit in as few characters as possible is much more exciting.
>>
http://joelgrus.com/2016/05/23/fizz-buzz-in-tensorflow/
>>
>>58976989
here is a general solution
import subprocess

def intToBytes(n):
b = bytearray()

while n != 0:
b = bytearray([n % 256]) + b
n = n / 256

return b

n = 1
DESIRED_OUTPUT = 'whatever'
while True:
b = intToBytes(n)

f = open('bin.exe', 'wb')
f.write(b)
f.close()

try:
out = subprocess.check_output(['bin.exe'])
if out == DESIRED_OUTPUT:
break
except:
pass

n += 1
>>
Something to really make you all think: https://en.wikipedia.org/wiki/Slowsort .
>>
set $a1, 0x88888888
set $a2, 0xF2345678
loop:
set $a3,*$a2
set $a2,$a3
jeq $a2,$a1,return_null
goto loop

return_null:
$f1,0x00000000

makeshift assembly where it reads whatever random information's in RAM at address $a2 and sets the new address to the random info until it equals 0xF8888888. then it returns 0
>>
>>58976989
Well you could create an algorithm that de-optimizes the given algorithm, and just make it repeatedly iterate over itself. There's no upper bound
>>
Random r = new Random();
int randomInt = r.nextInt(1000000) + 1;
DateFormat df = new SimpleDateFormat("dd/MM/yy HH:mm:ss");
Date dateobj = new Date();
String date = ((df.format(dateobj)));
char second = date.split(" ")[1].split(":")[2].charAt(1);
if(cond && randomInt == 7 && Character.getNumericValue(second) == 7)
return null;



How's that for efficiency you little shit?
>>
File: IMG_20170216_162819.jpg (3MB, 3480x4640px) Image search: [Google]
IMG_20170216_162819.jpg
3MB, 3480x4640px
>>
File: 213894172394.jpg (50KB, 300x300px) Image search: [Google]
213894172394.jpg
50KB, 300x300px
>>58976989
>java
>>
>>58976989

void *rv = &main;
int testing = 1;
int test_forever = 1; // do you want to test until true? If not, set to 0.
int program_length = 3;
int program_counter = 0;
uint8_t test = 0x2;
uint8_t return = 0x4;
uint8_t goto = 0x8;

uint8_t program[program_length];
program[0] = 0x21;
program[1] = 0x81;
program[2] = 0x40;

uint8_t *memory = malloc(sizeof(uint8_t) * program_length);

for(int i=0;i<program_length;i++) {
memory[i] = program[i];
}

do {
switch((memory[program_counter] & 0xF0)>>4) {
case 0x2:
if (memory[program_counter] & 0x0F) program_counter += 2;
break;
case 0x4:
testing = (memory[program_counter] & 0x0F);
rv = NULL;
break;
case 0x8:
program_counter = (memory[program_counter] & 0x0F);
break;
}
} while(testing && test_forever);

return rv;



I know this could be better, but that's not the point.
>>
>>58979941
fuck program[1] should be 0x80. I doubt that would compile anyway.
>>
lea (0).l,a0

FindZero:
move.b (a0)+,d1
cmp.b #0,d1
bne.s FindZero
ext.l d1
move.l d1,d0
>>
>>58980032
>(a0)+
move.b (a0),d1
add.b #1,a0

=)
Thread posts: 16
Thread images: 3


[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.