I think you forgot to return group.moderators at the end of get_user_list.
Also I notice that doing it this way can cause participant to be removed and then readded to the same group while the original code does not. Could this be a problem if this code is running a lot?
No, if the user is removed and then added to the same group it acts like nothing would happen.
If you are concerned about that edge case then I would add a guard clause before that checks if the groups are the same and exits out early. Which we should really be teaching new developers about and encourage them to use.
To be clear would nothing happen or would participant get added and removed so it's like nothing happened? Because if it's the latter then that seems pretty inefficient, especially if this code is running a lot.
you could also use group.__getattribute__(old_user_type.__getattribute__('lower').__call__().__add__("s")) which is even uglier (why does the hidden method have a longer name…)
Had to fix almost exactly this kind of code for a friend doing an idle game, but even worse. I couldn't imagine any situation where a run of the mill non-graphical idle game would run poorly, especially on a PC or decent phone like he had, so I offered to take a look.
Boy, did I understand after seeing what was essentially just a LOOONG series of nested if/else statements that sometimes nested into the double digits deep.
Fixed it for him with some really basic loops and lots of comments so he could understand what I was doing and continue working on it from a better foundation.
Got a message that he couldn't read it anymore. He continued on with that monstrosity version he sent me. Keeps me up at night imagining the cries for mercy his phone must be making by now.
Got a message that he couldn't read it anymore. He continued on with that monstrosity version he sent me. Keeps me up at night imagining the cries for mercy his phone must be making by now.
Isn't this sort of what happened with Yanderedev too when people came in and sorted through his code?
I have no idea, but it sounds plausible. Some people seem to arbitrarily decide they've learned enough after a handful of Unity tutorials, when any amount of difficulty starts to seep into the learning process.
I made an idle game (very small) as a little test thing. How I handled ticks was just having an object of tick functions, basically a key for the condition (like an upgrade) and then the function.
On the ticks, it would just run all the functions in there, and upgrades would change the function when you bought upgrades or conditions were met.
I would probably change to not be passing around the display values as the data values, personally. That you get "Moderator" for display purposes only.
75
u/[deleted] Apr 13 '22
Posting anything from YandereDev is cheating
17
u/alban228 Apr 13 '22
Is that real ? Isn't it run for EACH fucking Pearson each tick ?
254
u/Fletsky Apr 13 '22
Tell this guy he has to add two new roles.
185
u/TinyBreadBigMouth Apr 13 '22 edited Apr 14 '22
EDIT: Fixed thanks to /u/Comprehensive_Age506's comment.
80
u/shizzy0 Apr 13 '22
My god, this is painfully stupid.
68
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Apr 13 '22
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
33
u/4hpp1273 Apr 13 '22
It would be even worse if
elifdidn't exist21
u/CorruptedStudiosEnt Apr 14 '22
Had to fix almost exactly this kind of code for a friend doing an idle game, but even worse. I couldn't imagine any situation where a run of the mill non-graphical idle game would run poorly, especially on a PC or decent phone like he had, so I offered to take a look.
Boy, did I understand after seeing what was essentially just a LOOONG series of nested if/else statements that sometimes nested into the double digits deep.
Fixed it for him with some really basic loops and lots of comments so he could understand what I was doing and continue working on it from a better foundation.
Got a message that he couldn't read it anymore. He continued on with that monstrosity version he sent me. Keeps me up at night imagining the cries for mercy his phone must be making by now.
5
u/[deleted] Apr 13 '22
I should post some of my code here for free karma...
8
u/Hitman_0_0_7 Apr 13 '22
I feel if statements with statement with return are more readable than elifs.. If there are too many of them.
4
u/kristallnachte Apr 14 '22
Not sure if this language has the same behavior, but with a little adjustment in JS you could do
It seems like the removal and add just need to be, at MOST 2 switches of 3 cases
3
u/fuwafuwa7chi Apr 14 '22
The empty success response is just the cherry on top.
2
u/Alberiman Apr 14 '22
Just use a freaking enum Jesus christ
1
u/gngmntl Apr 14 '22
This is painful
1
u/SectorRich868 Apr 14 '22
Omg, what is this. I may be a bit amateur is coding and Python, but Jesus! Yan Dev, get yourself together dude!
1
u/Spynder shameless stealing content to r/YandereTechnique Apr 14 '22
r/YandereTechnique
1
u/ksiadz22 Apr 14 '22
What concerns me the most is how far from the left this code is.
1
u/oli-capybara Apr 20 '22
Imagine trying to write unit tests for this... D;
1
u/kawabunga666 Apr 26 '22
a herd of elifants
1
u/bigbobclemson May 07 '22
Needs less math