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

Overengineering simple problem

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: 28
Thread images: 4

File: difficult.png (2KB, 233x107px) Image search: [Google]
difficult.png
2KB, 233x107px
Pic related.

Show me your software engineering skill and make it complex as much as you can.
>>
Like this?

void main()
{
char array[2048] = {0};
char *ptr = array;

*ptr += 10;
while(*ptr)
{
++ptr;
*ptr += 7;
++ptr;
*ptr += 10;
++ptr;
*ptr += 3;
++ptr;
++*ptr;
ptr -= 4;
--*ptr;
}

++ptr;
*ptr += 2;
putchar(*ptr);
++ptr;
++*ptr;
putchar(*ptr);
*ptr += 7;
putchar(*ptr);
putchar(*ptr);
*ptr += 3;
putchar(*ptr);
++ptr;
*ptr += 2;
putchar(*ptr);
ptr -= 2;
*ptr += 15;
putchar(*ptr);
++ptr;
putchar(*ptr);
*ptr += 3;
putchar(*ptr);
*ptr -= 6;
putchar(*ptr);
*ptr -= 8;
putchar(*ptr);
++ptr;
++*ptr;
putchar(*ptr);
++ptr;
putchar(*ptr);
}
>>
>>56451409
secured job/10
>>
File: flanders.jpg (17KB, 349x395px) Image search: [Google]
flanders.jpg
17KB, 349x395px
>>56451409
Yes, but to make it professional we need some external dependencies.
>>
>>56451409
main should return int
>>
>>56451409
That's literally just some const-folded brainfuck.
>>
>>56451491
#include <bf.h>
>>
fugged up indentation
function FizzBuzz(length, bool, map){
this.length = ++length;
this.bool = bool;
this.map = map;
};
FizzBuzz.prototype.fizzbuzz = function(){
console.log(
Array.apply(
null, new Array(this.length)).map(
Number.call, Number).map(
i => {
let c = '';
this.map.forEach(
(
a,
b
) => {
switch(this.bool){
case true:
((''+i).indexOf(b) != -1)&&(c += a);
default:
!(i%b)&&(c += a);
break;
}
}
); return (c)?c:i
}
).slice(
1
).join(
'\n'
)
)
}
var FizzBuzzer = new FizzBuzz(100, false, new Map([[3, 'Fizz'], [5, 'Buzz'], [7, 'Woof']]));
FizzBuzzer.fizzbuzz();
>>
>>56451491

oh you meant the enterprise version? Here you go, compile with "-static-libstdc++" flag on g++

#include <string>       
#include <iostream>
#include <sstream>


class HelloWorlder
{
private:
std::string helloWorldText;

public:
std::string getHelloWorldText()
{
return helloWorldText;
}

void setHelloWorldText(const std::stringstream* text) throw(int)
{
if(text->rdbuf()->in_avail())
{
helloWorldText = text->str();
}
else
{
throw -1;
}

}
};

int main ()
{
std::stringstream hello;
hello << "Hello world!";
HelloWorlder* helloWorldInEnglish = new HelloWorlder();

try
{
helloWorldInEnglish->setHelloWorldText(&hello);
std::stringstream answer;
answer << helloWorldInEnglish->getHelloWorldText();
std::cout << answer.str() << std::endl;
}
catch(int e)
{
std::cout << "Something went wrong, error code is " << e << std::endl;
}

delete helloWorldInEnglish;

return 0;
}
>>
>>56451320
<h1>Sorry, you are not allowed to see the message until you pay us 1.3 bitcoins. Press the button to purchase.</h1>
<input type="button" OnClick="fuckyou()">Click me, bitch.</input>
>>
import java.util.ArrayList;

public class Main {
public static void main(String[] args) {
new Main().run();
}

public void run() {
SentenceEmitter emitter = new SentenceEmitter(' ', '!');
HelloWordEmitter helloWordEmitter = new HelloWordEmitter();
WorldWordEmitter worldWordEmitter = new WorldWordEmitter();
emitter.add(helloWordEmitter);
emitter.add(worldWordEmitter);
emitter.emit();
}

abstract class Emitter {
void emit(char ch) {
System.out.append(ch);
}
}

abstract class WordEmitter extends Emitter {
char[] chars;

void emitWord() {
for (char aChar : chars) {
emit(aChar);
}
}
}

class HelloWordEmitter extends WordEmitter {
final char[] HELLO_WORD = new char[]{'H', 'e', 'l', 'l', 'o'};

HelloWordEmitter() {
chars = HELLO_WORD;
}
}

class WorldWordEmitter extends WordEmitter {
final char[] HELLO_WORD = new char[]{'w', 'o', 'r', 'l', 'd'};

WorldWordEmitter() {
chars = HELLO_WORD;
}
}

class FlexibleCharEmitter extends Emitter {
char charToEmit;

FlexibleCharEmitter(char charToEmit) {
this.charToEmit = charToEmit;
}

void emitChar() {
emit(charToEmit);
}
}

class SentenceEmitter extends ArrayList<WordEmitter> {
FlexibleCharEmitter delimiterEmitter;
FlexibleCharEmitter finalPunctuationMarkEmitter;

SentenceEmitter(char delimiter, char finalPunctuationMark) {
this.delimiterEmitter = new FlexibleCharEmitter(delimiter);
this.finalPunctuationMarkEmitter = new FlexibleCharEmitter(finalPunctuationMark);
}

void emit() {
int i = 0;
for (WordEmitter wordEmitter : this) {
wordEmitter.emitWord();
if (i < size() - 1)
delimiterEmitter.emitChar();
i++;
}
finalPunctuationMarkEmitter.emitChar();
}
}
}
>>
>>56451320

Have some concurrency and pointless copying.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>

typedef struct arg arg;

struct arg {
size_t i;
char *s;
size_t t;
};

arg *init_arg(const char *c, size_t t) {
size_t l = 0;
while(c[l++]) {
}
arg *arg = malloc(sizeof(*arg));
arg->s = malloc(sizeof(*(arg->s)) * l + 1);
strcpy(arg->s, c);
arg->i = 0;
arg->t = t;
return arg;
}

void free_arg(arg *a) {
if(a) {
free(a->s);
free(a);
}
}

void *print_char(void *x) {
arg *a = (arg *)x;
if(a->i == a->t) {
free_arg(a);
return NULL;
}
printf("%c", a->s[a->i]);
pthread_t t;
arg *t_arg = init_arg(a->s, a->t);
t_arg->i = a->i + 1;
pthread_create(&t, NULL, print_char, t_arg);
pthread_join(t, NULL);
free_arg(a);
return NULL;
}

int main() {
const char tmp[] = "Hello, world!";
size_t s = sizeof(tmp) / sizeof(tmp[0]);
char *a = malloc(sizeof(*a) * (s + 1));
strcpy(a, tmp);
pthread_t x;
arg *t_arg = init_arg(a, s);
free(a);
pthread_create(&x, NULL, print_char, t_arg);
pthread_join(x, NULL);
printf("\n");
return 0;
}
>>
>>56451676
Needs some reflection and third party frameworks, just for added security.
>>
File: the_rape_face.png (73KB, 149x241px) Image search: [Google]
the_rape_face.png
73KB, 149x241px
>>56451738
>>
>>56451320
String s = ("say it to my face");
s = s.concat("not over the internet");
>>
>>56451320
che frocio che sei loris
>>
>>56451320
main(puts,printf){while(putchar(puts++[" Hello, world!\n"]));}
>>
>>56452313
#define S "Hello, world\n"
main(){exit(printf(S)==strlen(S)?0:1);}
>>
>>56451320
#include<stdlib.h>
intfoo(void){return0x55;}charass1(void){return'N';}charass2(void){return'b';}charass3(void){return'p';}charass4(void){return'o';}intbar(intx){int(*fooPtr)(void);x=nope(x);fooPtr=foo;returnfooPtr();}charhole(intq,intx){void(*func_ptr[4])={ass1,ass2,ass3,ass4};x=nope(x);char(*fooPtr)(void);fooPtr=func_ptr[q];returnfooPtr();}char*asshole(char*str,intx){char*p=str;intsize=0;x=nope(x);while(*p){*p++;size++;}char*array=calloc(size+1,sizeof(char));for(inti=0;i<size;++i){charc=str[i];unsignedcharb=(unsignedchar)(c^size-i);unsignedcharb2=(unsignedchar)((c>>8)^i);array[i]=(char)(b2<<8|b);}returnarray;}intnope(intx){inty=x*x;y=y/x;y=y*x;y=y/x;y=y*x;y=y/x;y=y+x;y=y-x;returny;}intmain(){intx=99;charthing[]={hole(0,nope(x))^bar(nope(x)),hole(1,nope(x))^bar(nope(x)),hole(2,nope(x))^bar(nope(x)),hole(3,nope(x))^bar(nope(x)),hole(3,nope(x))^bar(nope(x))};char*q=thing;intw=0;while(thing[w]!='\0'){thing[w]^=bar(x);thing[w]--;w++;}printf("%s\n",asshole(thing,x));return0;}


error too many lines. so fuck it, minified
>>
>>56452648
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
int foo(void){return 0x55;}
char ass1(void){return 'N';}
char ass2(void){return 'b';}
char ass3(void){return 'p';}
char ass4(void){return 'o';}
int bar(int x){int (*fooPtr)(void);x = nope(x);fooPtr = foo;return fooPtr();}
char hole(int q, int x){void (*func_ptr[4]) = {ass1, ass2, ass3, ass4};x = nope(x);char (*fooPtr)(void);fooPtr = func_ptr[q];return fooPtr();}
char *asshole( char *str, int x){char* p = str;int size = 0;x = nope(x);while(*p){*p++;size++;}char *array = calloc(size+1, sizeof(char));for (int i = 0; i < size; ++i){char c = str[i];unsigned char b = (unsigned char)(c ^ size - i);unsigned char b2 = (unsigned char)((c >> 8) ^ i);array[i] = (char)(b2 << 8 | b);} return array;}
int nope( int x){int y = x * x;y = y / x;y = y * x;y = y / x;y = y * x;y = y / x;y = y + x;y = y - x;return y;}
int main()
{int x = 99; char thing[] = { hole(0, nope(x))^bar(nope(x)),hole(1, nope(x))^bar(nope(x)),hole(2, nope(x))^bar(nope(x)),hole(3, nope(x))^bar(nope(x)),hole(3, nope(x))^bar(nope(x))};char* q = thing;int w = 0;
while(thing[w] != '\0'){thing[w]^=bar(x);thing[w]--;w++;}
printf("%s\n", asshole(thing, x));
return 0;}

slightly better, only prints hello, but its sitting around so anon can finish his homework.
>>
>>56451320
Everyone talks about how simple "Hello World" is, but I it took me months to get it to work. I am glad I started working on it during the summer before the class started, because they wanted us to do it in under an hour. One hour to do a months worth of work, I dropped the class after a few days as the introducing to programing was way too hard and I was accused of cheating, I guess I am just not good with that kind of stuff

When you stop and think about the sequencing of charge bit values in a dynamic system is actually very complex and also hardware specific. You have to have a firm grasp of binary and transistor array structures if you ever want to understand these things. Thankfully the library had lots of book on the subject in the Electrical Engineering section, which is confusing as one would think it would be with the Programing or other sections

The first few days was me just trying to think of a good way to reverse engineer the computer used for my testing, as I didn't have time to build a translator for all architecture types after realizing how big this task was. Then actually doing it. Once I had the identified every circuit in the unit and how they interacted I then started looking for a static pattern that would create the desired results. I eventually I found a sequence of electric impulses that would flip part of the graphics card memory to make the screen display the correct answer. But that was not good enough as it would only display for one cycle. So I found a second sequence that altered the refresh buffer so the screen wouldn't change for 5 seconds. Then put them together as a larger one. After which I started testing the binary sequence to find and assembly function that matched outputs, so I didn't have to type it out as much and we couldn't bring anything with us to the test

Apparently the test not only had to display the text on screen, which I did, but it had to document it to some secret file I didn't know about, I failed
>>
>>56452829
10/10
>>
>>56451320
: hello ." Hello World!";
hello
>>
File: image.jpg (204KB, 1920x1080px) Image search: [Google]
image.jpg
204KB, 1920x1080px
>>
>>56452829
Made me kek. Here's your (You)
>>
>>56451320
>overengineering
Keep it simple, stupid:

hello = require('hello-world')
hello.run()
>>
>>56451320
if (a < b && b > a)
>>
>>56451686

underrated
Thread posts: 28
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.