/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

pathofexile.gamepedia.com/Armour
pathofexile.gamepedia.com/Evasion
hastebin.com/iyisalaheg.cs
github.com/arximboldi/immer
github.com/SuperV1234/scelta
drdobbs.com/embedded-systems/object-oriented-programming-in-assembly/184408319
github.com/tomhrr/dale
twitter.com/AnonBabble

Games in idris as planning to safe guard my game from shitty devs

Back to basic with ANSI C?

depends, do any free implementations of C99 or C11 exist?

>m-m-muh dependent typing! muh correctness proofs!
Enjoy spending 4 months constructing a compiler-verifiable proof for your little Tetris clone. Simply useless.

Bumping my own question

I don't use a blog I use a private wiki to write down my thoughts and project details.
Why do you want a blog?

fuck sepples

tfw still no sepples replacement

>private wiki
this sounds like a really good idea

use C
dumb sepples poster

I use wikidpad. In case you were interested.

Hi, I am working on more shaders. Please notice me.

no generics
no ctfe

OpenGL is fun

TL:DR

I want there to be a 20% chance at base accuracy for this game to block for half damage, and then a 5% chance further to fully evade damage.


How do I have to set up my math/formula to do this? Never got past algebra in school, was lazy...

I have figured out that I need to compare the results in this manner

If Defense Roll is 16% higher Than Attack roll, Evade

If defense roll is 0%-15% higher than attack roll
block


But I haven't worked out exactly how to do that, and...

your stats start at 100 and go + 10 + 10 for bonuses, however that causes an issue with scaling, in that if you get say 80 attack roll vs +20 defense rolls, your chance to evade goes up dramatically.


So how do I work in diminishing returns for bonuses to attack/defense? So it's not a huge advantage to have higher accuracy/evasion?

like every 5 points is a 0.5% increase rather than a 1% increase per point
Surely someone gets what I'm stuck at right? I'm sure it only really makes sense to me. Thanks

I hate figuring out math

Why are you using Lua, out of curiosity?

Also, you can always take the easy route:

Generate a number between 1 and 100#
If (number generated < 20) {
if (number generated < 5) {
evade damage
} else {
half damage
}
} else {
full damage
}

>Why are you using Lua, out of curiosity?
Because Sup Forums told me nobody uses C++ for real work.

Because It's what I know and Love 2D uses lua

Dunno about that one, wasn't sure how to make the bonus to hit or defense matter in that case.

what will happen if non void function reach the end of code without reaching return but the compiler unable to catch it?

Is there any text-user interface IDE similar to the Free Pascal IDE, but for C language instead? I find it really comfy, but I do not know Pascal and not that interested learning it.
I know there's ancient TurboC, but I'm looking for something that could be run from Linux terminal.

Start executing some other part of memory until something goes terribly wrong. I don't think a compiler will ever miss that though.

kek.
C++ is not used by a lot of hobby programmers, it is used by professionals.
Why do you listen to professional advice on Sup Forums

Programming is stupid. I've tried it for years and could never grasp it and always had block after block of trying to do it. Just gave up

>X is stupid because Im too stupid for it!

What language did you try to learn?

no, I'm just messing around trying to generate weirdest gcc warning error,
and surprised that
int test(int in)
{
switch(in)
{
case 1:
return 1;
case 2:
return 2;
case 3:
return 3;
case 4:
return 4;
default: break;
}
}

int main()
{
test(5);
return 0;
}

can be compiled without any warning.

I'm not sure what you're after exactly here. I think you should maybe look at how other games do what they do.
pathofexile.gamepedia.com/Armour
pathofexile.gamepedia.com/Evasion
For instance have chances that depend on two stats, accuracy vs evasion and damage vs armor. They're explained for people who aren't really expected to know much math and just wish to understand the scaling properties loosely (as a general gaming audience would).
You can skew a normal distribution.
It's very hard to give you what you want without a good description which is hard for you to make because you don't know how to define exactly what you're looking for mathematically.
So I recommend looking at other games if you don't just want to learn math because they already have explored properties with simple descriptions. Usually.

-Wall
Should be on by default, but at least the option's there

>a.c:15:1: warning: control reaches end of non-void function [-Wreturn-type]

I wrote a program (designed to be compiled and run from command prompt) that reads from a file and replaces all instances of a string with a different string in a new file. So there are four parameters all together: source file, target file, original string, replacement string - in this order.
My problem is when I run the program, it makes the new file but refuses to write to it. I know the code to replace the text works because I modifed it to display what it replaced on screen. I will link my code to hastebin below
hastebin.com/iyisalaheg.cs

I am very glad these threads have never devolved into nigger skiddy talk/shit.

Thanks all for being legit.

Also, I hate Python's syntax.

The base value to hit is 100%, so you hit 100% of the time

However there is a 20% chance to block and a 5% chance to dodge that hit

I'm trying to figure out how to make that math work in code, and how to make it so that if you have a large bonus to your defense or attack, it's not a huge bonus, instead of +1 point = + 1%, more 5 points = 1%


I have some idea on what I need to do I just need to somehow put it together, or use a different method to get there

Hey guys, please help.
I'm new to programming, and have only practiced VB in my spare time since it helps with job applications (I know other languages might be better suited, say Cobol since majority of finance programs in my country still use it and it's also handy since I'm an accountant graduate)
Anyways, my current project is to apply vb for outlook, mainly for automation of emails' identification and move them to folders, I have encountered issues where it's not applying the macro to all emails selected and leaves out the first index in my array.

Any ideas how to solve this issue? Or ways to understand why the macro is not working?

Nevermind I figured it out

Why is cmake a cluster fuck on windows?

Is pretty much everything either a primitive or a pointer in c?

cmake is cluster fuck in every platform, it's mostly because it's used by sepplesfags who really like clusterfucks.

is this a Ruby helpdesk for beginners? :v)

structures

structs and unions dumbass

arrays

>Listening to Sup Forums at all.
Why listen to these jobless hippies.

Sup Forums warned me about "Sepples" shills coming to trick me. Sup Forums is always right.

A website for my client because I have a job.

Enjoy programming in Lua then.

What C++ projects are you working on, shill? Sup Forums said only NEETs program in C++.

Emacs

I'm sure you'll find tons of jobs for Lua, unline us NEET's.

Just as Sup Forums prophecied, the C++ shill is unable to show any examples of its non-fizzbuzz programs.

p-please, it's an easy one

>sepples can't into functional progra-
github.com/arximboldi/immer
github.com/SuperV1234/scelta

sepples needs to leave
Why is Bjarne still alive?

>assembly can't into object oriented progra-
drdobbs.com/embedded-systems/object-oriented-programming-in-assembly/184408319
Wow. Sepples and Java BTFO.

Danish healthcare

they need more refugees to bring the system down

>Rich Hickey developed Clojure because he wanted a modern Lisp for functional programming
>modern Lisp
Hickey can't into macros or what's his problem?

-mming

thoughts?

If those people would die, that would be good thing for the future of programming languages

but D is already dead

I was talking about those designers, not he languages.

Standardized language with C semantics in Lisp syntax when?
>no name mangling
>C ABI
>type inference
>lisp macros
>no gc

you can do fp in any language, but some languages make it far easier than others do. fp is just about referential transparency

>fp is just about referential transparency
wrong

I know you're triggered that your non-referentially transparent language isn't FP, but that's the way it is. You just have to accept it.

functional programming is about the manipulation of functions and programming around functions and especially higher order functions and various forms of function composition

referential transparency is part of pure programming

languages without referential transparency are dysfunctional

Did you ever even fucking google it?

Excuse me?

I'm making a multi-threaded sieve of Eratosthenes (algorithm for finding primes) implementation in Erlang. Erlang's lists are kind of inefficient for this kind of thing, so I use maps for buffers instead. The single-threaded one can count the number of primes up to 100,000,000 in 145 seconds, while the multi-threaded one can do it in 45 seconds on my 4C/8T CPU, using 8 threads. I don't know why it's not close to 8 times faster, if I had to guess, I'd say it's because 4 cores with hyperthreading isn't the same thing as 8 proper cores, and because of the the quirks of the intel dynamic overclocking tech.
Btw this is still orders of magnitude slower than the C implementation that can do it in 0.5 seconds using a single thread. Also, if anyone cares, I don't use a single huge buffer for storing primes, the size of the buffers is sqrt(N), so for 100,000,000, each buffer would contain 10,000 elements. The reason for this is that it works well, in my experience.

google "C with lisp syntax"
first result:
github.com/tomhrr/dale

>Standardized language
>type inference
>no reader macros

A browser based frontend client where the users can play a metagame for a 10 years old strategy game. You can conquer planets and shit by winning matches.

Usually when people talk shit, I just brush it off, but now, it's gone a little to far.
Assclown, you talk as you know me but in reality you don't know shit about me. I'm guessing you've never been in a situation involving a real live thug that was born and raised in the ghetto/hood(me). Yes i've turned my life to good, but i will throw all that out the window if you continue to talk shit about me. I've killed a few people back in my banging days and Just remember next time before you open your mouth, you better be praying that i'm in a good mood, or else you'll be in for a rude awakening when the thug in me unleashes

OK YOU FUQIN ANGERED AN EXPERT PROGRAMMER THIS IS PROG YOU ARE ALLOWED TO POST HERE ONLY IF YOU HAVE ACHIEVED SATORI PROGRAMMING IS ALL ABOUT ABSTRACT BULLSHITE THAT YOU WILL NEVER COMPREHEND I HAVE READ SICP IF ITS NOT DONE YOU HAVE TO BBCODE AND SCHEME ARE THE ULTIMATE LANGUAGES ALSO WELCOME TO PROG EVERY THREAD WILLA BE REPLIED TO NO EXCEPTION

>tfw naming Linux binaries .exe

unsigned long long int main(unsigned long long int argc, char**argv[])
{
unsigned long long int i;

for(i = 1; i != 0; i++)
{
printf("hello world"); /* prints unsigned long long int -1 times */
}

unsigned long long int exit_status;
exit_status = i;
return exit_status;
}

>works on my machine!

>tfw naming your son .exe

Quality pasta

Functional programming languages merely are attempts at implementing lambda calculi.

Reminder that it's "daylight saving time"
not "Daylight Savings Time".

Educate your friends

Want to change IDE to CLI based IDE.
Vim or Emacs?
as objective as possible pls

You'll suffer either way. What do you dislike in your current IDE?

10 minutes just to load the GUI, 3 minutes to open every file > 4 MB

Then you might prefer NeoVim.

forgot to mention. Currently using heavily modified Atom.
That's the reason why took long time to load

>Atom
At least use Visual Studio Code
But really, use Neovim

Why doesn't everyone just use Java?
>programming in C#
>want to simulate mouse movements and clicks
>well fuck, I need to use a function in a dll. Fuck my portability
>switch to Python
>same issue, mouse movements and anything is os module fuck my portability
>meanwhile in Java
>ultimate portability
>can make android apps with it
>massive standard library

inb4 it's slow
>99.9% of actual programming applications aren't speed critical

Well Sup Forums, has Java BTFOd into oblivion?

does chezscheme have a comprehensive library or would I be better off using guile?

Wrong

>2 hours later

You're better off using common lisp for anything other than learning

Who are you quoting

arrays are just pointers

People only hate on Java because of the meme or because it's ugly. Also they've never had a real job before

>99.9% of actual programming applications aren't speed critical

Yeah sure. Open a program in 2 seconds and 1 hour is the same right?
waiting 20 minutes just for a program to load a PNG is not a big deal right? Either way the file is loaded right?

Having a laser cutter doing nothing for 10 minutes or 10 seconds, just to give time for the processor to figure out the best movement for current scheme is only a mater of someone patience right?

Starting a rocket engine in flight 5 minutes late, because of the on board computer calculate a proper pressure required to be supplied to the combustion chamber surely will not do any harm right?

Having those USD2000 computer is a waste of money right? I'm pretty sure you can manage to do all it can do with USD100 computer second hand from 2005.

>Fuck my portability

Just check which system you're on and use the available native function lmao

Please answer I know today is Halloween.
It's already spooky enough in here.
Don't make it even scarier

>Learning C#
>The best I can do with loops is a triangle made of asterisks (only rows with odd numbers) or a right angle made of numbers
How do I learn loops properly instead of just copying example?