/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 1561842346027.jpg (1000x1088, 175K)

Other urls found in this thread:

en.wikipedia.org/wiki/Maze_generation_algorithm
youtube.com/watch?v=rop0W4QDOUI
redblobgames.com/pathfinding/a-star/introduction.html
javascript.info/
twitter.com/AnonBabble

Porting my Haskell program back over to C.
Tired of all these segfaults.

trying to figure out how to get my csgo rank from steam web apis
please no bully

How do I stop writing spaghetti code

stop using shitlangs which let you write shit code

Filter Generals on Jow Forums:
/dpt/i

Making a cpu for my own ISA in verilog for a FPGA I have spare in my desk

Hey Jow Forums, which is faster goto or whlie.
This code does nothing, is just an short example, kind of similar to a real C threaded renderer.

Attached: whileorgoto.png (685x816, 78K)

does serenity os user still here ? I know he's frequent on youtube but having his daily updates here first was fun

Attached: 1561948965949.png (239x372, 128K)

they will most likely be exactly the same

ends up compiling to the same thing

go and test it out lazy faggot

he usually posts once a day but he's a wagie.

compile to ASM and look at it

a friend challenged me to start a program that generates a random maze, then once you get that make another program that solves the maze

any tips or help?

en.wikipedia.org/wiki/Maze_generation_algorithm

I've found this, i get there's code at the bottom, just wondering if Jow Forums knows anything better

Theres a computerphile video for solving basic mazes for A*
If i recall correctly it gives you the algorithm but not the code so i think it would be a good challenge reference.

just found it, thanks man

youtube.com/watch?v=rop0W4QDOUI

Imagine shooting your cum inside her underage vagina

whose? I don't see a girl there

Implementing some methods in MATLAB, but my error is not O(f(h)) like it's supposed to.

Also just finished some benchmarks for a small cpp library, which tells me a few things I can do to better efficiency. I'm gonna ignore it though since I'm supposed to get other shit done

I feel so unmotivated. Struggled to find my numerical method mistake for hours. The cpp library, I don't care. My partner hasn't contributed much at all, so I should look fine in comparison. My superior doesn't seem to care much either.

check out this article on A* (it's interactive and quite well-made):
redblobgames.com/pathfinding/a-star/introduction.html

please post an anime image next time, blank images look pretty shit in the catalog.

Kill yourself

explain why and i'll consider it

Attached: wtfnetbeans.png (316x191, 7K)

int t = 0, q = 0;

oh ok

Attached: Capture.png (960x450, 34K)

noice
i didn't notice it

Rich Hickey knows de way

hear his talks

Attached: edward.jpg (462x663, 37K)

posts like this make dpt a worse experience for everyone

How come? Is there no better alternative?

>muh no bully zone
grow up faggot

Attached: 1561826605940.jpg (907x724, 107K)

I just started programming I am learning JavaScript atm. I want to do game dev. What languange should I learn after? Is c++ considered the best for videogames? If so can you explain in laymen terms why?
>pic related mfw program something and it works

Attached: 1554588122207.gif (300x259, 1.68M)

C# for Unity

Why are Ctards so fucking stupid and don't know about compiler optimizations?

c++, c# for unity

Can you learn c++ without studying c?

yes

can you learn javascript without studying java?

this may be news to you but grownups generally don't tell each other to kill themselves

Only for you, and you should leave anyway.

Agreed.

I'm learning go! I hate it!

I just found out that -Wpointer-integer-compare won't be triggered if you're comparing a pointer to an enum that is 0, on both GCC and Clang

There is no "while" construct in machine code. It all gets translated to conditional jumps.

You're right. Grown-ups just economically and socially isolate people until they kill themselves, instead of just saying words.

?
When I try it, gcc doesn't recognize that option, but it warns against such comparisons with -Wall

My bad, that's actually what Clang calls it, not sure why it's different from GCC which calls it -Wpointer-compare
enum {
ZERO = 0,
ONE
};

int main(void)
{
int *p;
return p == ZERO;
}

>but it warns against such comparisons with -Wall
Only when you're comparing to non-zero.

oh my bad I tried a comparison to an enum variable.
It seems that it will not warn against any comparisons to an integer constant that evaluates to 0, except '\0'
int f(int* a) {
int k;
k = a == ONE; // warning
k = a == ZERO; // ok
k = a == 1; // warning
k = a == 0; // ok
k = a == (8 & 16); // ok
k = a == (0 * k); // warning
k = a == (int)0.1; // ok
k = a == '\0'; // special warning
return k;
}

I would guess that warnings for this case would generate false positives. Isn't NULL even allowed to just be defined as 0? or is it required to be (void*)0

>I would guess that warnings for this case would generate false positives.
You'd think that compilers would pick up whether you're comparing pointers to (void*)0 or just plain 0

6.3.2.3.3: An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant ...

6.6.6: An integer constant expressio shall have integer type and shall only have operands that are integer constants, enumeration constants, ...

Seems to me that defining NULL as ZERO would be perfectly legal, so I think that's why they don't warn about it.

the standard allows equality comparisons between pointers and null pointer constants, and 0 is a legal null pointer constant

I want to nakadashi akari!

learn Haskell instead
you're going to hell

you're going to heaven

I like Racket and Go, roast me

why are you a witch?

anime is fine
pedoshit is not
kill yourself

>blank images are pedoshit

Bit weird but here I go
I have a puppeteer program, in it theres 2 functions, one that scrapes the main page and filters for links, and a 2nd that goes to the filtered out links and grabs data from the individual pages
For some reason if I call the 2nd function it will scrape that individual page fine, but if I use the first to collect the links and then go to each one, it gives a 404 error when I try to navigate to the individual page, however, the page still loads and is parsed and data is returned same as if I skipped the first function and just called the 2nd
also for some reason my console logs in my page.evaluate in my 2nd function are printing multiple times if I call the 2nd from the 1st

Attached: sos.png (1069x322, 23K)

Trying to set up a python environment (which I know nothing about), so I can compile the deepnude app, lol.

It says that I need these packages: numpy, Pillow, setuptools, six, torch, torchvision, wheel

I've got everything but torch and torchvision (as can be seen through pip freeze).
But for some reason I keep getting errors when trying to install them.

pip install torch
Collecting torch
Using cached torch-0.1.2.post2.tar.gz
Requirement already satisfied: pyyaml in dev\cfehome\lib\site-packages (from torch) (5.1.1)
Building wheels for collected packages: torch
Building wheel for torch (setup.py) ... error
ERROR: Complete output from command 'cfehome\scripts\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'Temp\\pip-install-ny5j7gsy\\torch\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d

Am I making an obvious mistake or something?
(sorry, had to remove and shorten some of the paths because it got marked as spam)

Monogame/OpenTk/SDL2/SFML or just unity if you are lazy and want to actually finish the game using only the simplest of programming constructs like if and loops.

javascript.info/ don't use anything else to learn JS
Everything else is outdated or just flat out wrong, especially the paid ones.

Lisp is the most powerful programming language.

define powerful

I usually have my editor open on my left screen, but it's suboptimal because the left side of the left screen, i.e where most of the code resides, is a bit too far to the left for comfort when I'm sitting at my desk. So now I will test to have it open on my right screen instead. If you think about it, it makes sense. I want most stuff centered and since, once again, code is on the left side of the screen, having the editor open on the right should be the best.

number of parentheses

>prepping for interview
>get stuck on some easy LC questions
>solve some hard LC questions that I've never seen before immediately

Attached: 132531211772.jpg (900x675, 83K)

never gonna make it

LC? is that a new kind of burger they didn't cover in your CS course?

install gentoo

Every programming language is really just a variant of Lisp.

Learn different code structures to use as reference (aka design patterns)

Learn functional programming.

I'm not kidding. After 1 year of functional programming even my java code is *significantly* better. It's not even close.

Learn Lisp.

I'm not kidding. After 1 year of Lisp even my java code is *significantly* better. It's not even close.

Am I a joke to you?

Attached: fortran-front.jpg (800x1061, 75K)

haha fortrannies would be a funny /dpt/ joke
not gonna make it though

No, that would be the Haskell users.

Learn data oriented programming.

I'm not kidding. After 1 year of data oriented programming, even my java code is *significantly* better. It's not even close.

>Apple FORTRAN
What the fugg?

Is it possible to be good at programming and drawing? I've been trying to draw anime girls for hundreds of hours and I'm still shit

Attached: 1562155433163.jpg (1608x2188, 574K)

In C++ if I have a member attribute of a class that is a pointer to a type (in this case T* next), and I have a method in the class that assigns a value to that pointer, how would I go about doing that?

What is the different between:
void Class::setNext(T* next) {
this->next = next;
}

and

void Class::setNext(T& next) {
this->next = next;
}

Which is preferable?

the second would be
this.next = next

wait i mixed that up, it would be this->next = &next, OR the first this->next = *next, it depends what the FIELD next is
references and pointers are not interchangeable

C++ for engine dev/unreal
C# for unity

>gcc -S

I'm trying to remember Assembly. How to write assembly program that does nothing using AT&T syntax? I tried
.text

.globl _start

_start:
movq 0x3C, %rax
syscall

but I get segfault.

nop

why? and where?

xchg eax,eax

Nice patchy

no-ops by definition do nothing
put it in start

nop (no op) is an instruction that does nothing

so i need an instruction? i can't just call sys_exit?

ok, i put nop
.text

.globl _start

_start:
nop
movq 0x3C, %rax
syscall

it still segfaults.

ok i will come back later

Python3 newfag here.

Why can't I do :
print(list.sort()) # I get "none"

instead of :
list.sort()
print(list)

because sort() mutates the `list` and doesn't return a new sorted list (it has void return)

use sorted() nigger