/dpt/ - Daily Programming Thread

What are you working on?

Other urls found in this thread:

github.com/id-software
betaarchive.com/forum/viewtopic.php?t=29804
moddb.com/games/shadow-warrior/downloads/source-code2
store.steampowered.com/app/375820/
twitter.com/NSFWRedditVideo

How do people program 'AI' as in grand strategy games, chess, puzzle games, etc? Where there is serious decision making at work?

Closest idea I can think of is assigning pros and cons to each decision and choosing the one with the highest number of pros-cons

Yes because the old thread was so hard to understand

In limbo between projects, sorta-kinda working on a simple C++ GUI lib to kill time

look at minmax, ab pruning, etc
if you're serious, look at norvig russel

>building Clang and LLVM
>2 hours later
>40% done

>gentoo

>c++

In chess it's done by generating a tree of every possible move where the levels in the tree alternate between players. This tree is made as big as possible. Then the state is chosen that leads to the best possible bottom state assuming that the other player always makes the best move. A state is scored based on which pieces are on the board, how close they are to the center, and other things. This is the old method. Modern methods are more complicated.

>Clang and LLVM

No, I'm on Windows.

install gentoo

I presume you could have LLVM built already and then just need to build Clang and link it with LLVM

So yes, I'm building Clang and LLVM.

That was the only other possibility, and I assumed you weren't that retarded. You proved me wrong

Anyone else read through released sourcecode of old games or software?

I'm just paging through some of the AVP2000 source. Shit's pretty fascinating actually.

just started learning c today

nothing, because I have no motivation after programming all day at work

Les denne boka

where do you get these?

Depends on the software. I found it like a week ago. Read it on wikipedia that the source was released ages ago, never knew.

This tickled me.

couple questions:

where's the /dpt/ telegram or irc?

and, where's the github for all the Sup Forums roll projects

I was working on the previous /dpt/ thread until SOMEONE deleted it

get shrekt norweeb

All the id software games before RAGE are available on github at github.com/id-software

Jurassic Park Trespasser can be found here betaarchive.com/forum/viewtopic.php?t=29804

Source for Shadow Warrior is here moddb.com/games/shadow-warrior/downloads/source-code2

Not the guy you replied to but just google around for games you're interested in, lots of classic games have their source out in the open by now.

If you can't even use a foreign language then you have no hope of mastering a programming language.

kek

this reminds me that changing audio pitch is fucked on some android devices, and there are other issues too, you have to mix everything yourself on the cpu

Why does it have to be your particular foreign language though?

Norwegian isn't my native language, though. (Nor is English.)

hvorfor må du snakke norsk da

It is a musical language.

(I don't want to upset the mods again, so I will use English.)

more or less musical than swedish? norwegian sounds more comical than musical to us swedes

...thas right

I prefer Norwegian, but maybe I am strange.

I don't understand.

since you are from norway:

i have this picture saved on my computer from norway, but i don't know where this is.

can you identify this city / town ?

Anyone have any experience using Xen PCI passthrough and VGA passthrough? I'm building a NAS/HTPC/Home Server, and decided to make them a single machine rather than three.

My plan is to use NixOS + Xen host, with three VMs: Windows 10 (htpc), FreeBSD (NAS), NixOS Linux (server). I'll use the PV networking drivers and VGA passthrough for the Windows VM, and PCI passthrough for each of the eight hard drives for the FreeBSD VM. The NixOS VM will be fully paravirtualized.

I'm expecting the VGA passthrough to be a pain in the ass, but I've found at least one example of it being done on a GTX 960 without hardware modding.

Are there any problems I'm not considering? The machine will be pretty beefy, with 32GB ECC memory + Xeon E3-1230 + GTX 960 + 4x4TB 4x8TB drives + 128GB SSD for the OSes.

>using whatever_type = map::size_type;

keeps giving me errors

>error C2061: syntax error: identifier 'size_type'
>see reference to class template instantiation 'WhateverClass' being compiled
>error C2238: unexpected token(s) preceding ';'

any idea why

wew me

using whatever_type = typename std::map::size_type;

sorry i'm swedish and i don't know that place, i just picked up some norwegian from pic related

>current year
>implying any language that isn't English matters

is this a game? did you wrote it in a game engine?

nice loop unrolling

*write

store.steampowered.com/app/375820/

ah, cheers mate

>what is Chinese
>what is Korean

A brand new angular 2 website to replace our old backend windows app :)

Do you even know how Chinese people type in chinese? They use our Romantic characters to sound out their retarded chinkoglyphs. They all learn English because knowing English is more important than knowing chink, we don't have to learn chink.

obviously i fucking cheated, because this shit only works for input data where all numbers

:)

Yes it's nice but I really suck at CSS, usually I never develop GUI, I develop the software kernel, doing some web is quite weird for me :)

How do you go about learning the STL? I want to get better at C++.

>Not learning Hebrew

OY

וויי

There's a difference between meme spouting teenagers and doing actual business.

The C++ cos() and sin() functions take radians, right? I'm writing:
cos((i * angle) / (180 * pi));
where 0

>he didn't learn chinese and russian
how will you fare when english, chinese, and russian get mixed together into one language from the happening that will be WW3.

360 Degrees = 2 Pi Radians
1 Degree = (Pi / 180) Radians
x Degrees = x * (Pi / 180) Radians

:)

But that's what his function already says:
x deg / (180 deg * pi) is the same as x deg * (pi/180)

>xπ/180
>the same as x/(180π)

I changed it to
float rot = i * angle;
cos(rot / 180 * pi);

And now it's giving me the right numbers.
Not quite sure why it works now, since I'm doing the exact same thing, aren't I?

I figured it out. It didn't like the parenthesis around the 180 / pi.

>180 / pi
180 * pi, whoops.

What are some good things to program that don't require knowledge of pointers or structs?

Been working through C Programming: A Modern Approach but want something to do besides the included projects.

>What are some good things to program that don't require knowledge of pointers or structs?
nothing.

just picked up android programming - the big nerd ranch guide. been doing web development for the past 2-3 years. i've made some income too doing sites for local businesses, and i want to branch into app dev once i graduate from uni with my CIS degree.

Algorithmically speaking, how is it possible for an application to totally shit on your computer's performance without using up all the CPU and memory?

I've got an i7 and 32GB of RAM, but when I have foobar2000 play some .TTAs over the network via SMB, foobar's GUI locks up and shits on my computer's performance. There's no indication of memory leakage and CPU usage is normal.

Learn to love the pointer and the struct because there is no escaping from them.
Learn another language if you don't like it.

when you have x / (180 * pi), you're dividing by pi (and by 180)

what you have x / 180 * pi it's like x * (pi / 180) which is what you want

literally N O T H I N G

happens over the course of a few hours by the way.

yes, by waiting, like if it has some retarded multi-threaded networking code

A helloworld I guess.

>just picked up android programming

from what sources are you learning?

it's not x * pi / 180 though, it's x * (pi/180)

Just to be clear, only asking beacuse I haven't learnt them yet, not because I don't want to use them.

those are the same

So should I get a more modern book to learn C11, or is K&R for ANSI C just as good as ever?

>because I haven't learnt them yet
Then learn them now.

said in my post, it's called "Android Programming - The Big Nerd Ranch Guide". i looked up popular books and that was one of the first recommendations.

i learned basic java in uni so im thinking i should be able to delve into this. we'll see.

if you have any recommendations i'm all ears.

>i'm all ears.
Ew get away from me you fucking mutant.

C Programming: A Modern Approach by K.N. King goes up through C99 and I'll shill it for as long as I live. You can do most things with ANSI C but K&R has some really outdated/poor practices at this point.

>outdated/poor practices
Such as?

What's the best language for quickly writing game tools/editors that interface with C libraries on Linux? Is it a scheme or some other lisp, or something else?

C++

Fuck I'm a retard, you're right

pass me the headset bro

I said quickly.

Next chapter is pointers, so getting there!

Did you reply to the wrong person? Because your reply has nothing to do with what I said. The Chinese have to learn basic English to even use the internet, because the only way they can type out their chinkoglyphs is to type them out phonetically with English characters and software recognizes them.

>"English characters"

Yes they specifically use English. The fact that the characters are shared between Germanic languages is irrelevant. You know just enough to make yourself look retarded.

led.sh
#!/usr/bin/env bash

num2led() {
printf '%s\n' "$*" \
| sed \
'
h
s/[14]/ /g
s/[0-9]/ _ /g
G
s/0/| | /g
y/24569/38228/
G
s/[068]/|_| /g
s/[147]/ | /g
s/2/|_ /g
s/[359]/ _| /g
'
}

num2led "$@"


usage: ./led.sh $(date +%H%M)

Care to explain what this does?

asshole now my system32 is gone

outputs the date, in a led format.

basically outputs a number in a led format

see pic related .

ps: its 00.26 AM here

I have a Button class that takes a function parameter as a callback. If I wanted certain buttons to call a function with an argument, would I have to create a new, separate ArgumentButton class? Please tell me there's an easier way.

Have all buttons take a void * argument in the callback.