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 solutionimport 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?
>>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
=)