Comment on: Forcing women into programming is a fucking mistake
0 18 May 2018 02:43 u/diodine in v/programmingComment on: Forcing women into programming is a fucking mistake
Horrible coding practices - ignoring the egyption brackets, heres a proper implementation (written by a man):
// proper object orientation of shit in https://kek.gg/i/63TqP-.jpg
// using more epic object orientation
// i have no idea if the lang in the image is c#, js, java, etc, so this isnt making full use of any feaures from those languages
// u could probably expand this by having a base class for both, yaddadada...
class Girl
{
private int age; // private cuz u dont know their age just by looks...exactly...
Girl(int _age)
{
age = _age;
}
public boolean willGoOutWithGuy(Guy guy)
{
return age >= 22 && isGuyUgly(guy);
}
private boolean isGuyUgly(Guy guy)
{
// can be expanded later
return guy.isUgly;
}
public boolean willGoOut(Guy guy)
{
return willGoOutWithGuy(guy) && guy.willGoOutWithGirl(this);
}
}
class Guy
{
public boolean isUgly; // public cuz u can obv see if they're ugly
// dont forget initializers daft hoe
Guy(bool _isUgly)
{
isUgly = _isUgly;
}
// guy will basically fck any girl (systemic sexism?? maybe he wants to fuck dudes????)
public boolean willGoOutWithGirl(Girl girl)
{
return true;
}
// check both
public boolean willGoOut(Girl girl)
{
return willGoOutWithGirl(girl) && girl.willGoOutWithGuy(this);
}
}
Comment on: (((active users)))
Readability reasons I guess.
Comment on: CIA Leaks - Process Hollowing. Starting a benign process with suspended threads, then replacing the address space with another executable before resuming the threads.
TBH, this really isn't that amazing. This has been seen in the wild and in fact, some completely benign software also puts code into another process's space without the process's knowledge (things like overlays)
Windows provides an API specifically to do this (NtWriteProcessMemory / NtAllocateVirtualMemory), while on Linux you'd have to use ptrace first to get a stub into the target process to then call mmap.
Comment on: Can video game hacks ever be stoped?
Or these developers could just procure dedicated servers instead and let the user base deal with bandwidth.
Comment on: Can video game hacks ever be stoped?
Because these AAA titles usually are peer-to-peer so they don't have to pay for servers and a huge amount of bandwidth.
Comment on: What is the best comment in source code that you have ever encountered?
One of my favorites, from Linux 1.0:
IBM designers who came up with it should be shot.
Comment on: Basics of AI?
Keep in mind that all living things are very simple:
Stimuli -> Response
Make your guy listen for events - such as a hook thats called whenever a sound is played or when something enters LoS. When you simplify it like such, making him react to these stimuli is easy.
As for making your AI intentionally dumb, that's also easy. If hes shooting a gun, just make his aim-angles bob around with something like sin(time()) x (1-difficulty_pct). For path finding, make him take intentionally long paths, or even better make him only know about certain nodes by visiting them (or having a buddy who has a radio on his model visit the area). If you have a bunch of guys in an area who need to go somewhere, make their willingness to take a certain path with their buddies random (to simulate them doubting their buddies) or make them split up (such as marking 2 bots as being "leaders" and each inferior bot having a high-willingness to follow them)
You should generally try to follow the whole "willingness" thing. Like, for example, certain bots might be 60% willing to run away from a fight, 20% willing to run right in, and 20% willing to stay where they are. Make certain stimuli effect these percentages - such as if he sees 3 opponents his willingness to run away goes up 10% and his willingness to stay or push go down based on what equipment he thinks his enemies have. Make it so if he hears or sees a grenade hit the ground his willingness to run away goes to 75%, his willingness to stay goes to 0%, and his willingness to push ahead goes to 25%. The chosen skill level might change how these percentages scale.
That's all I have to say. I'm not in this field so I can't say any of this is the best way to do it.
Comment on: A conservative city for programmers?
Also, we don't have Donald Trump!
You have Muhammad, Ahmed, and female genital mutilation.
Comment on: Does anybody here reverse engineer viruses?
I do. I generally don't spend too much time though being a hobbyist rather than a full time reverse engineer, but if the malware isn't overly complex I will look at it. PM me the files if you want.
Comment on: Programming tip: Stay away from throwing exceptions.
Most C++ compilers simply make a function call for exceptions (MSVC is something like CxxRaiseException) and thus optimization is not sacrificed (since the linker just sees it as a function call).
C on the other hand is in fact ruined by setjmp exceptions.
Comment on: Hate GitHub being taken over by gender politics? Don't worry, you're not alone.
std::mt19937 feelings(time(NULL));
The feelings are always random. lmao
I'm copying their style for comparison's sake.