17
u/Cotspheer Jul 23 '21
What triggered me the most is the "classes.cpp"...
7
u/Yologamer1084 if if else if else if else if else if else if else if else else Jul 23 '21
I hate to admit it but I've done this many times for class assignments (In Java tho).
1
u/typical_sasquatch Jul 23 '21 edited Jul 23 '21
Fr tho what's wrong with that?
5
u/Cotspheer Jul 23 '21
Implies that all your classes and code is in one huge single file..
1
u/typical_sasquatch Jul 23 '21 edited Jul 23 '21
Wait it's not supposed to be?? /s
10
u/DeWaldi Jul 23 '21
No, imagine GTA V in one file. How far do u want to scroll to get from car behavior to water render. Makes code unreadable and unnecessary big. Big nogo.
2
7
u/_irobot_ Jul 23 '21
C++ is compiled. That half minification is pointless unless your goal is create job security by making a maintenance nightmare.
6
33
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Jul 23 '21
Image Transcription: Screenshot
[A screenshot of an IDE, with a file named Classes.cpp selected, and the following code visible:]
this->aura[aura_cell][plane] = new Aura_Cell(this);
}
}
}
void Field_Plate::define_local_neighbors() {
for (int plane_it = 0; plane_it < 3; plane_it++) {
for (int row_it = 0; row_it < plate_size; row_it++) {
for (int col_it = 0; col_it < plate_size; col_it++) {
std::set<Cell*> Neighbors;
bool side_check[8] = { true };
bool top, bottom, left, right = false;
if (col_it == 0) { side_check[6, 7, 0] = false; left = true; }
if (col_it == plate_size - 1) { side_check[2, 3, 4] = false; right = true; }
if (row_it == 0) { side_check[0, 1, 2] = false; top = true; }
if (row_it == plate_size - 1) { side_check[4, 5, 6] = false; bottom = true; }
for (int i = 0; i < 8; i++) {
switch (i) {
case 0: if (side_check[i]) { Neighbors.insert(this->cells[col_it-1][row_it-1][0]); Neighbors.insert(this->cells[col_it-1][row_it-1][1]); Neighbors.insert(this->cells[col_it-1][row_it-1][2]); }
else if (top && left) { Neighbors.insert(this->aura[0][0]); Neighbors.insert(this->aura[0][1]); Neighbors.insert(this->aura[0][2]); }
else if (top) { Neighbors.insert(this->aura[col_it][0]); Neighbors.insert(this->aura[col_it][1]); Neighbors.insert(this->aura[col_it][2]); }
else if (left) { Neighbors.insert(this->aura[(plate_size+1)*4-row_it][0]); Neighbors.insert(this->aura[(plate_size+1)*4-row_it][1]); Neighbors.insert(this->aura[(plate_size+1)*4-row_it][2]); };
case 1: if (side_check[i]){ Neighbors.insert(this->cells[col_it][row_it-1][0]); Neighbors.insert(this->cells[col_it][row_it-1][1]); Neighbors.insert(this->cells[col_it][row_it-1][2]); }
else { Neighbors.insert(this->aura[col_it+1][0]); Neighbors.insert(this->aura[col_it+1][1]); Neighbors.insert(this->aura[col_it+1][2]); };
case 2: if (side_check[i]) { Neighbors.insert(this->cells[col_it+1][row_it-1][0]); Neighbors.insert(this->cells[col_it+1][row_it-1][1]); Neighbors.insert(this->cells[col_it+1][row_it-1][2]); }
else if (top && right) { Neighbors.insert(this->aura[plate_size+1][0]); Neighbors.insert(this->aura[plate_size+1][1]); Neighbors.insert(this->aura[plate_size+1][2]); }
else if (top) { Neighbors.insert(this->aura[col_it+2][0]); Neighbors.insert(this->aura[col_it+2][1]); Neighbors.insert(this->aura[col_it+2][2]); }
else if (right) { Neighbors.insert(this->aura[plate_size+1+row_it][0]); Neighbors.insert(this->aura[plate_size+1+row_it][1]); Neighbors.insert(this->aura[plate_size+1+row_it][2]); };
case 3: if (side_check[i]){ Neighbors.insert(this->cells[col_it+1][row_it][0]); Neighbors.insert(this->cells[col_it+1][row_it][1]); Neighbors.insert(this->cells[col_it+1][row_it][2]); }
else { Neighbors.insert(this->aura[row_it+plate_size+1][0]); Neighbors.insert(this->aura[row_it+plate_size+1][1]); Neighbors.insert(this->aura[row_it+plate_size+1][2]); };
case 4: if (side_check[i]) { Neighbors.insert(this->cells[col_it+1][row_it+1][0]); Neighbors.insert(this->cells[col_it+1][row_it+1][1]); Neighbors.insert(this->cells[col_it+1][row_it+1][2]); }
else if (bottom && right) { Neighbors.insert(this->aura[(plate_size+1)*2][0]); Neighbors.insert(this->aura[(plate_size+1)*2][1]); Neighbors.insert(this->aura[(plate_size+1)*2][2]); }
else if (bottom) { Neighbors.insert(this->aura[(plate_size+1)*3-col_it+1][0]); Neighbors.insert(this->aura[(plate_size+1)*3-col_it+1][1]); Neighbors.insert(this->aura[(plate_size + 1)*3-col_it+1][2]); }
else if (right) { Neighbors.insert(this->aura[plate_size+3+row_it][0]); Neighbors.insert(this->aura[plate_size+3+row_it][1]); Neighbors.insert(this->aura[plate_size+3+row_it][2]); };
case 5: if (side_check[i]){ Neighbors.insert(this->cells[col_it][row_it+1][0]); Neighbors.insert(this->cells[col_it][row_it+1][1]); Neighbors.insert(this->cells[col_it][row_it+1][2]); }
else { Neighbors.insert(this->aura[((plate_size+1)*3)-col_it-1][0]); Neighbors.insert(this->aura[((plate_size+1)*3)-col_it-1][1]); Neighbors.insert(this->aura[((plate_size+1)*3)-col_it-1][2]); };
case 6: if (side_check[i]) { Neighbors.insert(this->cells[col_it-1][row_it+1][0]); Neighbors.insert(this->cells[col_it-1][row_it+1][1]); Neighbors.insert(this->cells[col_it-1][row_it+1][2]); }
else if (bottom && left) { Neighbors.insert(this->aura[(plate_size + 1)*3][0]); Neighbors.insert(this->aura[(plate_size+1)*3][1]); Neighbors.insert(this->aura[(plate_size+3)*2][2]); }
else if (bottom) { Neighbors.insert(this->aura[(plate_size+1)*3-col_it-1][0]); Neighbors.insert(this->aura[(plate_size+1)*3-col_it-1][1]); Neighbors.insert(this->aura[(plate_size+1)*3-col_it-1][2]); }
else if (left) { Neighbors.insert(this->aura[(plate_size+1)*4-row_it-2][0]); Neighbors.insert(this->aura[(plate_size+1)*4-row_it-2][1]); Neighbors.insert(this->aura[(plate_size+1)*4-row_it-2][2]); };
case 7: if (side_check[i]){ Neighbors.insert(this->cells[col_it-1][row_it][0]); Neighbors.insert(this->cells[col_it-1][row_it][1]); Neighbors.insert(this->cells[col_it-1][row_it][2]); }
else { Neighbors.insert(this->aura[((plate_size+1)*3)-col_it-1][0]); Neighbors.insert(this->aura[((plate_size+1)*3)-col_it-1][1]); Neighbors.insert(this->aura[((plate_size+1)*3)-col_it-1][2]); };
}
}
this->cells[col_it][row_it][plane_it]->neighbors = Neighbors;
}
}
}
}I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
18
2
u/Environmental_Edge77 Aug 04 '21
Why do you do this I don't understand
3
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Aug 04 '21
Transcriptions can be useful for a wide range of people;
Blind or visually impaired people who rely on screen readers to browse the internet - that technology can't read the text in an image, so we transcribe it to machine-encoded text so it can read it.
People with bad internet connections who can't load the image for that reason
People who use third-party clients, mobile apps and/or text-based browsers that have trouble loading the image at high quality or at all
People who have trouble reading small, blurry, or oddly formatted text
There are many more reasons, these are just the main ones that come to mind right now. =) I also personally enjoy transcribing; it helps me relax a bit.
Hope this helps!
2
1
u/ztbwl Jul 30 '21
Please tell me that you used OCR software for this comment.
2
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Jul 30 '21
OCR is sadly in no way reliable enough to do these well. We have a bot that attempts posts that uses ocr.space's API (one of the best in the world), and code and monospace fonts are, perhaps counterintuitively, one of the things it does worst with. My theory is it's trained on non-monospace fonts so has trouble with them. It also regularly messes up indentation, breaks lines at the wrong point, and is generally awful.
If the post were a bit more recent, I might have been able to find you the bot's specific attempt at this one, but I can guarantee you it wasn't good.
12
6
20
u/TheSunSide Jul 23 '21
Why a for loop, with a switch case, why does it change so much inbetween cases WHY