/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1529696769208.png (500x1027, 420K)

Other urls found in this thread:

nodontdie.com/peter-molyneux-2
polygon.com/2016/2/8/10936890/peter-molyneux-crunch
python.org/dev/peps/pep-0443/
medium.com/@brianwill/object-oriented-programming-a-personal-disaster-1b044c2383ab
twitter.com/SFWRedditGifs

isn't it about time for languages to realize that the native types of modern CPU are 64 bits, and the 32 bit ones are legacy? 16 bits aren't even supported at all anymore.

#define
single = float
float = double
half = int
int = long

Are there any must read books for someone who wants to master Python, like pic related in C++ or K&R in C?

Attached: 2F8F1E63-B19E-4475-96CB-CFF3723B3561.jpg (1224x1516, 359K)

python the hard way

>What are you working on, Jow Forums?
robot. Just 3d printing and assembling rn. Math is solved (atleast the basics).
Just wanting to upload a pic rn to brag on IRC

Attached: holycomfy.jpg (3000x2000, 460K)

Bad meme

that's what jews in academia do primarily, write long prestigious books full of colourful prose that doesn't mean anything. they then make sure to shoehorn citations in for all their friends long meaningless trite crap. a big fucking circlejerk meant to waste your time for shekels and prestige.

>at work
>just focus on writing code, having fun

>get home
>alone, feel extremely depressed and angry at the world, tons of racist, sexist, violent thoughts, can't even play videogames or watch anime

I just want to stay in the office forever

Attached: 1538036485167.jpg (700x393, 78K)

How can i learn to be smart coder like pic related?

Attached: DEF40FC0-1683-40D8-8CBF-5508F6C5F7D6.png (828x801, 134K)

>get com sci degree with 3.6 in major gpa
>jewtube recommends video saying not everyone should learn to code
I see how it is.

Just memorize popular stackoverflow answers.

Give one rational answer why this code is bad without cargo culting

>code in Haskell all day
>facebook ad for meeting asian milfs
They are getting better every day

You mean besides the fact that the developer could've made pic related 3 times shorter by just using a switch case?

They really aren’t.

t. Gnutella/Freenet "hacker"

Wtf now jewtube is recommending me programming videos made by literal kikes. Fuck off and take your judaism with you, jewgle.

I don't see ads.
I think there might be something wrong with your browser. Might want to check that out.

Not ad. Recommended section. I use Adblock.

Use System.Globalization instead off rolling your own scuffed solution. One could literally reduce this code to ~3 lines while making it a lot more efficient, safe and easy to refactor.
Alternatively:
Use a switch with an enum. A jump table is A LOT more efficient than doing a bunch of string comparisons and you also gain type safety.
Group similar cases to make it more readable and concise.

make this.Witnessed a list like ["Insanity", "Blood", "Weapon"]. then do something like
if (this.witnessed.contains("Insanity") {
}
seems like Insanity > Weapon > Blood > Lewd in terms of what the GameOverCause and subtitle label update becomes.

or just make it a struct of bools

It looks like it would be easier to make a map from sets of things witnessed to outcomes.

Addendum: But if it already works then it's good enough.

What is the most self-respecting way to get into web development

Please post serious responses this time

>I just want to stay in the office forever
get a job in video games

Attached: graph-06[1].png (646x413, 22K)

this still looks like a dildo and pointing this out will make you butthurt as usual

Attached: Screen-Shot-2019-04-28-at-12.48.11-PM-1024x662[1].png (1024x662, 242K)

Just like quit nigga

How cucked can you be

It's not like game development skills aren't transferable (or is it, hmm)

An enum type is probably better, but the code shows that this.Witnessed is a string. The basic idea I had is you check through a list of possible reactions and use the one with the highest priority if more than one could apply. I imagined something like this:
struct EventResponse
{
String eventName;
String teacherReaction;
int priority;
};

EventResponse possibleResponses[] =
{
{ "Weapon", "Teacher Weapon reaction", 4 },
{ "Blood", "Teacher Blood reaction", 3 },
{ "Insanity", "Teacher Insanity reaction", 10 },
{ "Lewd", "Teacher Lewd reaction", 2 },
{ "Trespassing", "Teacher Trespassing reaction", 1 }
};


int prevPri = -1;

EventResponse finalResponse;

for( auto r : possibleResponses ) {
if( this.Witnessed.contains(r.eventName) ){
if( r.priority > prevPri ){
prevPri = r.priority;
finalResponse = r;
}
}
}

this.Subtitle.UpdateLabel(finalResponse.teacherReaction, 1, (float)6);
this.GameOverCause = finalResponse.eventName;
// etc

it's not about the money it's about the joy of making something meaningful.

this whole anti-crunch meme is just boomers getting up in the years being mad that they're too old to work high intensive jobs and that they might be replaced by younger more talented people.

fluent python

>MK9
The dude was probably crunching to animate bouncing tits or some shit. Can't imagine it to be rewarding in any way. Also
>being cucked enough to defend corporations squeezing the life out of their employees
Only in the US folks

What did you expect? It's like asking what the most self-respecting way to prostitute yourself is.
Your best option is to be a back end slut and just do some light front end shit. Otherwise, you could also just learn react native because the transition to react is seamless but you're still technically not just a webshit.

(You ;-)

Crunch isn't for everyone. And they still want the joy of making something meaningful.
Involuntary crunch is the problem. Maybe their interests have shifted to their kids or something. Maybe they don't quite realize that.

Probably to make your own projects and get hired based on them.
I say that works generally in any field.
Can be difficult.

There is literally no reason for it to be a string, considering that it's obviously just an identifier for the actual string which is going to be some external resource.

You could use sets for keys.
{#{"Weapon" "Blood" "Insanity"} ...
#{"Weapon" "Blood"} ...
#{"Weapon" "Insanity"} ...
#{"Blood" "Insanity"} ...
#{"Weapon"} ...
#{"Blood"} ...
#{"Insanity"} ...
#{"Lewd"} ...
#{"Trespassing"} ...}

Kapow! You've been slacking, user! Get back to learning JavaScript!

Attached: 480e4ee6fb4e76437df28b707846f7ff.jpg (736x1104, 73K)

thanks user. see you tomorrow

Attached: 1521844891786.png (941x887, 199K)

The brain requires sleep.

Why would I learn Javascript? I don't write web programs.

Witnessed should be a bitmap and there should be a dedicated bitmap-to-string function
Order of bits in the bitmap should reflect the priority of the case e.g.
>00001 - insanity
>00010 - weapon
>00100 - blood
>01000 - lewd
>10000 - trespassing
Can combine them, teacher's reaction is whatever the rightmost 1 bit is, actually leftmost might be better because determining cause could be done with simple > comparisons e.g. if insanity is 10000, if (witnessed > 10000) then cause is insanity etc

Anything other than strings is fine because of possibilities of arbitrary flag orders and typos, and using strings makes turning a single on a big ass ordeal

I don't know what the fuck the other responses are talking about btw I don't know C#

>JS is only for the web
retard detected

have sex

bend over

Molyneux is like 60 and he still defends crunch. He's maintained a youthful spirit and good health so he can keep on working long hours on crazy projects like he did when he was young.

nodontdie.com/peter-molyneux-2
polygon.com/2016/2/8/10936890/peter-molyneux-crunch

Attached: peter-molyneux.original[1].jpg (3138x1684, 208K)

Is there any clean way to emulate function overloading in Python? It tends to get REALLY messy really quick. My current solution that is the least ugly is to do it kind of like how C++ does it. For each overload I mangle it name, and then I have a single dispatcher function that matches sets of arguments to an overload. Is there a better way? Has someone already figured this out? Google hasn't been much help...

why bother mangling shit? just use a type-indexed dictionary that maps onto the implementation function

>dispatcher function
sounds slow, but then it's python we're talking about so whatever

python.org/dev/peps/pep-0443/

You can't manage using default values?

Besides the performances and syntactic issues, the structure is fundamentally fucked. Consider FizzBuzz. You could write FizzBuzz like this

for(int i = 0; i

ld hl, Muh_dick
ld bc, 0
ld de, Girl_in_OPs_image
ldir

i wanna kiss a girl REEEEEEEEEE

Outside of the web, other languages usually do a better job. There's no good reason to use Javascript where other options exist.

just take a set as an argument

just find a cute one on the street and go nuts

real_human_being.exe has encountered an error and must close

Attached: realhumanbean.png (864x752, 337K)

You don't think you're just contradicting yourself?
Why is this even a response to me?
Also he's an old design lead. Not a grunt. He's making an argument for it. Not participating.

>what's V8

bro shut the fuck up

JavaScript is a general purpose embeddable scripting language.

>Also he's an old design lead. Not a grunt.
It was the 90's, hands-off management didn't exist. he did just as much work as everyone else. That's one of the things he missed at microsoft when the team got massive, that's why he went indie.

nice

Sounds like you're talking about ecmascript

>it was the 90s
And you're linking 2016 articles.
I'm happy to ignore you though. You just had to ask.

So presumably, if an actor were to witness blood and trespassing, one would supersede the other, leading to inconsistent game logic. And that's not even taking into account that that whole if else block is nested in a if(!this.WitnessedCorpse) block. So WitnessedCorpse is a bool separate from the witnessed string that supersedes them all. Going back to out FizzBuzz example, we can clean it up like this

for(int i = 0; i

yes, I meant JavaScript

Should I learn Lisp if I hate Jews?

kek

Attached: 1548659368485.gif (500x500, 362K)

He's gone indie, which means he's back to being hands on. He wrote the terrain deformation system for godus.

default values != overloads.

Imagine a function defined in C++ like so...

to_ufixed(long long v, int left, int right, oflow_mode oflow=saturate, round_mode round=nearest)
template
to_ufixed(long long v, size_res_t size_res, oflow_mode oflow=saturate, round_mode round=nearest)
to_ufixed(double v, int left, int right, oflow_mode oflow=saturate, round_mode round=nearest)
template
to_ufixed(double v, size_res_t size_res, oflow_mode oflow=saturate, round_mode round=nearest)
to_ufixed(ufixed v, int left, int right, oflow_mode oflow=saturate, round_mode round=nearest)
template
to_ufixed(ufixed v, size_res_t size_res, oflow_mode oflow=saturate, round_mode round=nearest)
to_ufixed(sfixed v, int left, int right, oflow_mode oflow=saturate, round_mode round=nearest)
template
to_ufixed(sfixed v, size_res_t size_res, oflow_mode oflow=saturate, round_mode round=nearest)
to_ufixed(logic_vector v, int left, int right, oflow_mode oflow=saturate, round_mode round=nearest)
template
to_ufixed(logic_vector v, size_res_t size_res, oflow_mode oflow=saturate, round_mode round=nearest)
to_ufixed(Unsigned v, int left, int right, oflow_mode oflow=saturate, round_mode round=nearest)
template
to_ufixed(Unsigned v, size_res_t size_res, oflow_mode oflow=saturate, round_mode round=nearest)
to_ufixed(Signed v, int left, int right, oflow_mode oflow=saturate, round_mode round=nearest)
template
to_ufixed(Signed v, size_res_t size_res, oflow_mode oflow=saturate, round_mode round=nearest)
to_ufixed(Float v, int left, int right, oflow_mode oflow=saturate, round_mode round=nearest)
template
to_ufixed(Float v, size_res_t size_res, oflow_mode oflow=saturate, round_mode round=nearest)


And transliterating that to Python...

Do C programmers generally use linked lists instead of vectors? Implementing a vector for a type is at least 20 lines while a linked list is just adding one line to the struct. This seems like an issue because in this case the most practical way to do something is the least efficient.

Attached: DEAB9008-FAB9-478F-B114-93B999EA1D39.png (509x493, 260K)

c++ vectors have nothing to do with vectors

is this l-lewd?

medium.com/@brianwill/object-oriented-programming-a-personal-disaster-1b044c2383ab

>expecting c fags to be able to into data structures
They usually just use big enough arrays.

yeah ur OS is only using big arrays goy

Disagree. OOP is as unwieldy as you want to make it.

seek psychiatric help

a language with a disambiguator in the compiler
variable names with spaces
side by side implicit operators (e.g. a b = a * b)
variable names that are the same as function names which are the same as operators and keywords

Attached: madness sets in.jpg (340x191, 24K)

>This seems like an issue because in this case the most practical way to do something is the least efficient.
You now understand why zero overhead abstractions are important and why C is not a language for performance.

()

OOP (separate stateful objects all sending messages to each other) makes more sense in a concurrent programming guise where every part of the application is a concurrently running task and messages are passed between the tasks asynchronously. See Go.

Amazing that people are so buttmad about OOP they now hate abstraction

Have you tried one of the Python libraries for defining multimethods?

still horrible. job queues are widely used for a reason.

No, my question was if there were any.

job queues != concurrent programming. I don't et your point.

google 'python multimethod'

literally this lol

aight Ill look into it. Didn't know pyfags called it "multimethod"

please do not POO in your code

I didn't either until I learned multimethods from elsewhere

The message passing Actor model is different than OO the traditional model because it assumes each object operates in it's own independent memory space. This is what Erlang and Elixir do, but not Java or Go.
Channels in Go are not designed more message passing, but for synchronization. Efficient Go code makes heavy use of shared memory and is the opposite of message passing.

make me

Attached: oop is a faggot.png (955x74, 11K)

>functional programmers are liars
wtf i hate fp now

>Efficient Go
I'd rather it inefficient and easily maintainable.