/dpt/ - Daily Programming Thread

answer = What are you working on ( dpt );

Attached: 1559720712777.gif (280x280, 171K)

Other urls found in this thread:

youtu.be/LRHE8HmgNyk
learngitbranching.js.org/
youtu.be/BzphqTn1wPc
godbolt.org/z/yeYvCb
godbolt.org/z/VZZ-iH
norvig.com/big.txt
twitter.com/AnonBabble

low level Lisp when?

C++ is a very easy and simple language, as long as you don't use all the meme syntex

70 years ago

>What are you working on ( dpt );
As much as I hate web dev, I got really sick of not feeling comfortable with it. I don't intend to ever work with websites to any larger extent, but it feels crippling that I can't even make a half-decent webpage.
So I put down the Haskell book and started learning React.

Setting up the backend, JS dependencies, HTML DOM spaghetti are no biggies.
CSS is the real shit though.

Idiomatic C++ has the performance of C#/Java except with a more retarded styntax. Stick to the performance and 'fine-control' theme bro.

Reminder that """"""""Lisp"""""""" Machines did not run Lisp.

Somebody sent me a logo suggestion for my operating system. Thanks for the effort, logo guy :)
Today I'm working on some POSIX compliance which is more fun than it sounds.

Attached: D8Fwe92WwAAszpr.png (542x328, 14K)

idk, I started working on a website about a month ago. The backend made in elixir was done in a day or two, then came the frontend javascript part, and even if I have some experience with it, it was just fucking awful. It completely took all the fun out of the experience, productivity ground to a halt (adding even the simplest feature took me half a day), and there's just no way this very simple, one page website will ever get done if I keep working like that. And I hadn't even touched CSS at that point.

Hopefully I can learn this well enough in a few days to be able to actually do things without wanting to tear my hair out.

When I started making a game with no programming experience, I thought the programming itself would be the hardest and most time consuming part. But in reality it's asset construction. I'm now able to know what I need to do in the program just by looking at the block that I want to change, but no matter what I do it takes a long time to do music and art to support the actual program.

And now you know why asset stores available in bigger game engines exist. So you can just buy assets for your game. And if you don't buy the cheapest ones it's likely that nobody will even call you out on it.

Programming would probably still be the hardest part we didn't have such massive engines and libraries at our disposal.

Fucking delete this

Should've made a game where you can get by with shitty art and music.

Would you like to learn JavaScript with me, Anone?

Attached: cc118d4340dd8f518505348b637786b6.jpg (1000x1500, 116K)

Working through Little Lisper to understand functional paradigm

Just pay someone to do them for you.

Python

Trying to write this code in a non-retarded way

if a.foo > b.foo:
a
b
a
b
elif b.foo > a.foo:
b
a
b
a

Is this a good solution or am I missing something simpler?

l = [a, b]
n1, n2 = max(l, key=lambda o: o.foo), min(l, key=lambda o: o.foo)
n1
n2
n1
n2

cute wide

it's reasonable. surprised there aren't more simultaneous min max functions in languages

My blackpill was realizing music is the most important thing for a game to become popular, and I have a terrible ear

>yet another /dpt/ where a gamedev comes in to not talk about programming

I swear in the real world, this university shit never comes up.

I mean, it's interesting and all, but I just graduated and I'm building a model to propose to clients for a monthly rate for mobile payments to services, and I could have done this without £60k debt.

I agree, but without university I would not have my job though

#
>Shitty art
(Forgot image)
>Shitty music
youtu.be/LRHE8HmgNyk

It's not the 'quality' that is slowing me down, it's my lack of skill.
#
Perhaps later.
#
#
The level I'm operating at, it would be incredibly goofy to buy anything whatsoever.

Attached: Screenshot_20190606-072734.png (1080x1920, 194K)

I don't know if this is easier, but this is what I came up with if you care.
myTuple = ("a", "b")
a = 5
b = 3
next = 0 if a > b else 1
for i in range(0, 4):
print(myTuple[next])
next = 0 if (next == 1) else 1

my compiled binary file is smaller than the source code file
did i lose some information?

Attached: 11892348923.jpg (1920x1080, 252K)

for all I know there is a function just for that and I don't know about it

>mfw I'm not in university and just trying to program a game just for the fuck of it (and maybe once I learn ML and AI have an AI get good at it)

This would be ok, but I was just using "a" and "b" as placeholders, they're actually both objects (instances) and I need to do shit to them in a certain order depending on attributes

>university shit
in what universe is that university-level programming

thinking about one exercise from csapp

your original example is fine and your "solution" is retarded

But what if a.foo == b.foo?

>This would be ok, but I was just using "a" and "b" as placeholders, they're actually both objects (instances) and I need to do shit to them in a certain order depending on attributes

The general solution should work for objects as well, unless you're doing something super special magical.

idiot

I don't need to just print a, b, a, b, that was just to give an idea. It's a card game, and each turn the player who won the last hand starts. Rewriting the same instructions with switched names seems ugly.

a.foo and b.foo are booleans, one will be True while the other will be False. So basically I just want to check which one starts and go from there.

c++ users have brain damage!

c++ users have stds

Is this supposed to be a pun?

C++ is the most powerful programming language on Earth!

Attached: 1537931545076.jpg (1920x1080, 238K)

So they're booleans and one will always be false while one will always be true? You don't need to compare them then.
You could do something like
x = a.foo

for i in range(0, 4):
a if x else b
x = not x

It's up to you whether or not this solution is better I guess.

the most powerfully autistic

I would be concerned if it wasn't

music is orangepill

C++ users are stds

>Spaces around parentheses
I want to kill every single person who does this.

Makes it more readable

No, it doesn't.

Yes, it does.

No, it does not.

if(f()) g();
Why does this syntax make people angry?

Attached: 1550841367607.jpg (785x900, 91K)

Impure.

it's unreadable

Those aren't people, those are linters and formatters. Don't listen to the opinions of
such simple minded computer programs.

>stds
Supreme Talented Developers :^)

Exercises in code, in general. And, you'd probably be surprised how bad the BCS accredited degrees are.

here's how it should be done instead
>f() && g();

Every time my code reviewers would bitch about I would change it to , since that wasn't technically against coding guidelines

They stopped bitching after that

Time to actually learn git properly instead of just typing commands like a retarded monkey.
>tfw need brainlet visual aids to understand git
learngitbranching.js.org/

First I
$ git clone

Then I
$ cd

Finally I
$ flutter run

Now I have someone else's Flutter project running on my phone in debug mode.

How many extra steps would this require with something like React Native or Kotlin Android projects?

I remember being a git playing games on my dad's C64. It was a huge deal that we finally got pseudo-GUI file browsers abd didn't have to blindly look around in the dark
Now over 30 years later if you are not doing everything in command line you are treated like a fucking retard.
There is nothing wrong with using gui for managing git
Better than adding the wrong flag and all your branches being deleted

I agree. Usually I use magit, and I intent to continue using it, but my incompetence with git transfers to incompetence with magit, so now I am going to learn git properly, then I will continue on to magit.

>The Persistence of Vision Ray Tracer, or POV-Ray, is a ray tracing program which generates images from a text-based scene description

neat

Attached: import.png (800x600, 489K)

If you're already connected to ADB, it's just
react-native run-android

youtu.be/BzphqTn1wPc

So true...

So basically every ray tracing program ever?

>you just arent CriPPling hard enough
really makes u big think

doing ancient things in modern times

Attached: nes_asm.png (1852x1078, 157K)

It was more a play in the fact that some people pronounce std as stud in the cpp context
But I realized that this might not be common knowledge

If you think POV-Ray is cool, check out Houdini.

A modular text-based interface to a ray tracing system is neat because you can easily procedurally generate a scene in any language you want and pass it off to the program.

I've check out Houdini, their scripting system is awful.

>indenting your assembly

Attached: 1558628586661.jpg (206x226, 20K)

It's cute!

cringe and structural pilled
might as well go back to writing haskell DSLs for generating assembly

Get a haircut Bill.

you could output to a generic scene format like ascii fbx, collada, vrml, gltf etc. and render it in any software

hello, I'm somewhat new to programming and I want to write a bot for mmos using pic related, what someone suggested from a previous thread where I asked this same question. My question is how would I get this thing to send key and mouse inputs to the computer through the connector, is there some kind of aurdino library that I could call from that already has those functions?

Attached: pastedImage.png (1000x1000, 763K)

Why the hell would you put it on a microcontroller

Why do you say that?

Ever thought that "a bot" plus USB libraries won't fit in 32kB of memory?

okay so then they didn't know what the fuck they were talking about? Could I use a bigger microcontroller or something?

I don't think there aren't any. Microcontrollers are just that - very small controllers. They run 8-bit machines. Which have a maximum address space of 64kB. So try thinking of what was possible with 1980s computers.

Attached: 1559803279395.jpg (540x517, 50K)

I mean you could probably get it to simulate mouse and key events, like walk straight ahead for 2 seconds, punch twice, repeat. But not much of an "artificial intelligence" would fit in that memory.

Attached: 1559803365712.jpg (701x779, 122K)

non-constant constants

So, I must be doing something retarded, right? Surely C++ must be better than C.

Because I write the exact same program in C and C++, and the C version runs much faster.
Sure, the C++ version is considerably less code, but I'm not doing any weird optimisations in C.

I encourage anyone to speed up the C++ version.

C: godbolt.org/z/yeYvCb
C++: godbolt.org/z/VZZ-iH

quick note, WSL is not a factor here, C++ version still much slower on a native linux box
file put into stdin is norvig.com/big.txt

as a further sidenote, C version is much shorter output, and also compiles (on compiler explorer) in 250ms.
C++ takes 1000ms to compile, and the assembly is huge. not to imply large binary means it will be slower, of course.

Attached: code.png (1483x603, 48K)

are you copying the strings in one but not the other?

Music is just repeating Riffs/Melodies on Scales with little imperfections/flair's thrown in. Then add in Bridges and you're good. For rhythms, just look at music examples.

stop using std::cout

>they didn't know what the fuck they were talking about
You clearly don't either for believing them. Do you even know how bots work?

I'm sorry user but I think this project is beyond your current capabilities.

Those are not the exact same program you dummy.

#define VECTOR_TYPE char*
senpai...

why

what would ya use?

Is it bad practive to allocate more memory than is needed? And i am not asking about C, more i think about: populating list with a bunch None's, so it wont go out the range while later assigning or checking list[i]

Programming changed my consciousness. I remember back to the shit I used to think before I knew how to program and it's almost like I was a different person back then.

just allocate as you go/need

no it's often a good idea if it prevents you from making additional allocations in the future
the main cost is not how much you allocate, but how frequently

what do you mean

I'm learning how to use Angular and Spring rest together. full pajeets style. I need money