[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 40
File: 1451430282295.gif (550 KB, 728x720) Image search: [Google]
1451430282295.gif
550 KB, 728x720
What r u working on in 2016?
>>
>>52169298
first for php
>>
File: 1451551029327.png (402 KB, 1024x768) Image search: [Google]
1451551029327.png
402 KB, 1024x768
>>52169298
1st for FizzBuzz of the Christ
>>
It's literally impossible to average two strings in C
>>
>>52169319
STOP
You're not even using real words anymore
>>
>>52169319
char* avg(char* a, char* b) { return (a/2) + (b/2) + (a%2 + b%2); }
>>
>>52169298
>What r u working on in 2016?
No idea, someone give me a big project to do in python. I'm also open to using it for android apps if there's anything you lads want for convenience on the go
>>
>>52169338
*(a%2 + b%2)/2
>>
>>52169343
Doing some Project Euler problems in D. Currently working on the one where you have to find the 13 adjacent digits in an 1000 digit number that have the highest product. I have working code but for some reason it's giving me the wrong answer. The infuriating part is that my code works in the 4 digit case but not the 13 digit one.
>>
>>52169343
Make an app that keeps track of your farts and how severe they were as rated by the user
Then graphs and analyzes them to see when your worst gas is
>>
File: Screenshot - 010116 - 19:11:51.png (9 KB, 283x135) Image search: [Google]
Screenshot - 010116 - 19:11:51.png
9 KB, 283x135
I done it
>>
>>52169338

Sure, let's just play russian roulette with our pointers. In fact, why stop with ordinary executables that can segfault? How about we make kernel extensions that temporarily switch off paging and writes garbage to 500 random physical memory addresses every 15 minutes and see what happens.
>>
>>52169368
I would recommend that the program can just detect when the user is inputting, rather then having to choose it from a list.
>>
>>52169367
That doesn't sound too bad, so it's like a typical audio app, but in my database I store fart sounds by user with ratings and such. I could also try to implement my own algorithm to see which farts are the "hottest" by seeing quickest rises over a period of time. I might also add a leaderboard to see who averages the highest fart scores, but it increases slightly the more farts you do, so if 1 guy had a glorious fart but it's the only one he's done, he won't hold the position for long

I'll see what I can do
>>
File: gobbldigook.gif (5 KB, 458x97) Image search: [Google]
gobbldigook.gif
5 KB, 458x97
What do you call a problem of trying to determine whose turn it is at any given time?

client{
string name, int pace = (7~15);
}

...

client clients[20];

...

while(true){
for each(client){ credit += pace};
if(credit >= cap){
credit = credit/3;
cout << "BONUS CHECK: " << client[i].name;
}
}
}


I know there's a word for this stuff like a dynamic queue or something.

I'm trying to avoid running through my for loop over and over until someone hits the cap. I'd much rather just skip directly to the next person expected and increment everyone else by the appropriate amount by the time his turn comes.

Ideas of what I should look into?
>>
File: yeaaah etc.jpg (18 KB, 320x369) Image search: [Google]
yeaaah etc.jpg
18 KB, 320x369
>>52169378
>How about we make kernel extensions that temporarily switch off paging and writes garbage to 500 random physical memory addresses every 15 minutes and see what happens.
I think that's called windows
>>
>>52169378
>Sure, let's just play russian roulette with our pointers.
this sounds like it might have some nifty applications
>>
File: Screenshot - 010116 - 19:20:45.png (15 KB, 567x339) Image search: [Google]
Screenshot - 010116 - 19:20:45.png
15 KB, 567x339
I've either found a flaw in roman numerals or my code
>>
>>52169298
Learning C++, learning data structures, learning SFML
>>
>>52169298
Same fucking game I was writing 4 months ago.

C# has been a dream, Unity3d, not so much.
>>
what c++ ide's do you guys use?
>>
>>52169497
>ide
they're too bloat senpai
just use atom and compile with the command line
>>
>>52169378
Why do you hate fun?
>>
>>52169497
VS for debugging
Emacs for editing
>>
>>52169497
code blocks

I am constantly told I should be using visual studio but all the setup confuses and frustrates me.

I just wanna create src files and link shit in the same folder.
>>
>>52169497
Sublime Text + CLI personally.
>>
File: Screenshot - 010116 - 19:27:30.png (38 KB, 592x675) Image search: [Google]
Screenshot - 010116 - 19:27:30.png
38 KB, 592x675
r8
>>
>>52169439
https://en.wikipedia.org/wiki/Roman_numerals#Vinculum
>>
>>52169520
Get out.
>>
Going to try and master binary operations. I suck at those and I've already come across two scenarios where I need them.
>>
FUCK IMPERATIVE LANGUAGES
FUCK OOP
>>
>>52169537
>come across two scenarios where I need them
I don't think trying to shave 0.00000000001% off computation time by substituting x^2n with x<<n really counts familie
>>
In 32 years (a power of 2), the year number will be 2048 (another power of 2).

>>52169497

None. I use Sublime Text, GCC, and GNU Make, and that's it.

>>52169513

If I hated fun, why would I suggest to make a driver to write to random memory addresses for the fuck of it?
>>
>>52169518
I use VS and compile from the command line.
It is pretty close to what you want?

Just make a file and then fire up devenv blaba.exe whenever you want to fire up the debugger

The only setup involves installing VS and firing up "vcvarsall.bat x64"
Of course i have to manually config the build.bat but that is not a big deal
>>
>>52169575

Don't you mean x * (2^n)? Also, most compilers will optimize multiplication and division by powers of 2 to bitshifts anyways...
>>
>>52169497
>c++ ide's
thought this was a general for professionals and memes
>>
File: 1406598712517.jpg (25 KB, 500x333) Image search: [Google]
1406598712517.jpg
25 KB, 500x333
How do web scrapers/crawlers search for URLs to crawl? Are there any APIs which allow for URLs with certain keywords to be easily found?
Trying to do this automatically with a search engine will just get your IP blacklisted or turn on captcha.
>>
>>52169410
A priority queue?

A scheduling problem?

>skimming a bunch of related problems on wikipedia
>>
>>52169298
cocks
>>
File: 1442531866617.gif (119 KB, 320x600) Image search: [Google]
1442531866617.gif
119 KB, 320x600
>>52169298
Not only was the last thread not on autosage, but you also didn't even include a link to the old thread.
I wish we could have one fucking /dpt/ that gets everything right.
>>
>>52169611
Not using one is a meme
Using one is professional
>>
>>52169604
>Don't you mean x * (2^n)?
FUCK
>Also, most compilers will optimize multiplication and division by powers of 2 to bitshifts anyways...
not with optimisations off, i.e. debug mode in most IDEs, but yeah

I'm still curious to hear the possible scenarios that anon wanted to use bitwise operations for
>>
>>52169364
Finally got it in case anyone's interested. I was stupid and didn't read the problem; it wanted the product, not the digits. My solution:

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;

string digits = /* 1000 digit number */

void main()
{
generate!(() =>
digits[0..13]
.map!(d => d.to!string.to!ulong)
.reduce!((a, b) => a * b))
.map!((res) { digits.popFront(); return res; })
.takeExactly(digits.length - (numDigits - 1))
.reduce!max
.writeln();
}
>>
>>52169685
>bloat
>professional
nice meme
>>
>>52169690
and they said functional programming was a meme
>>
File: watermelon.jpg (393 KB, 1600x1200) Image search: [Google]
watermelon.jpg
393 KB, 1600x1200
>>52169652
>>
>>52169690
Over Complicating Things 2016 Edition
>>
>>52169712
Yes, the iterative solution is shorter and simpler. I just wanted to try doing it in a different way than I would normally.
>>
>>52169410
dining philosopher's problem?
>>
>>52169690
8.5 memes / 10
>>
>>52169777
The iterative version is boring. I'm doing these problems to enjoy myself and get outside my comfort zone.
>>
File: 1D9QHUC.webm (2 MB, 540x360) Image search: [Google]
1D9QHUC.webm
2 MB, 540x360
Ask your beloved programming literate anything.
>>
>>52169789
>I'm doing these problems to..get outside my comfort zone.
Go outside then.
>>
>>52169520
full source plox
>>
>>52169736
No, nothing that complex.

Just want to know who's turn it is for any given moment in the future.

Given a time_stamp, determine who is active/served/chosen/rewarded/etc at that moment. Clients have variable waits/paces/delays.

client = algorithm(time_stamp)


It's a queue/scheduler, but I don't know which one.
>>
>>52169815
You've got some pretty good memes yourself :^)
>>
>>52169811
post more dogs pls
>>
So... any programming new year's resolutions?
>>
>>52169816
Why would you want it?

http://pastebin.com/DauV2eNH
I hope you like nested switch statements
>>
>>52169844
To be feature complete.
>>
>>52169845
good lord
>>
>>52169844
Rewrite the linux kernel in MS-DOS
>>
File: Todd_howard.jpg (22 KB, 615x347) Image search: [Google]
Todd_howard.jpg
22 KB, 615x347
>>52169868
it just werks
>>
File: solution.png (14 KB, 851x330) Image search: [Google]
solution.png
14 KB, 851x330
>>52169878
Did you write it that way on purpose?
>>
>>52169878
But it doesn't because it fails to implement vinculums.
>>
>>52169878
not sure if red image or eyes are bleeding
>>
>>52169898
My excuse is that I'm tired because I didn't sleep last night

how would you write it?
>>
>>52169908
With a loop like a normal human being.
>>
File: Rock A.gif (839 KB, 500x360) Image search: [Google]
Rock A.gif
839 KB, 500x360
>>52169903
>vinculums
vincula*

I win you lose
>>
>>52169908
look at your main
case 1 and 2 are the same except for whether or not they use romanToArabic or arabicToRoman, and whether they say roman or arabic

look at romanToArabic
you are repeating a lot of the same code when the only thing that changes is the character and value
this should be done as a map

nested ifs - for loop w/ map
>>
Daily reminder that if your language of choice is not on this list you should probably give up and kill yourself:
- C++
- C#
- Lua
- Python
- Elixir
- Haskell
- Bash
- Clojure
- D
>>
>>52169920
Still haven't implemented them.
>>
>>52169811
What's your favourite g meme program other than fizzbuzz of the christ?
>>
Daily reminder that there are still posts to go in the old thread and it's not even on autosage you stupid fucks
>>
>>52169935
don't care about the main desu, I only really care about my romanToArabic
and arabicToRoman

C, X and I are very importantly different from M, D, L and V though in romanToArabic

The else structure in the ifs is important though, I was going to implement it with loops or without the nesting but then I would need loads of break;s, and that irked me just a bit more than a dozen nested if-elses
>>
>>52170037
you should care it's shit
>>
>>52170037
I'm gonna clean up your arabictoroman function.
>>
>>52170052
yeah but I know it's shit, so I could make it better if I spent another 5 minutes on it, but the goal of writing the program wasn't to write a well formatted main, it was to write something to convert between arabic and roman numerals

>>52170065
thanks Senpai
>>
>>52170078
it would've been faster to write it better
>>
>>52170108
you write it better then negro
>>
Real Thread
>>52164867
>>
>>52170065
>>52170078
Condensed to 11 lines
string arabicToRoman (int a) {
string out = "";
int mag[] = {1000,900,500,400,100,90,50,40,10,9,5,4,1};
char dig[13][3] = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
for(int i = 0;i<13;i++){
while(a>=mag[i]){
out+=dig[i];
a-=mag[i];
}
}
return out;
}
>>
>>52169939
u forgot c m8
>>
>>52170217
I mean to say 12 lines, I can't count.
>>
>>52170228
The for loop doesn't need braces
So 11 lines
>>
>>52170217
I like you
>>
File: bench.png (183 KB, 1050x750) Image search: [Google]
bench.png
183 KB, 1050x750
>>52169941
>>
>>52170255
>somebody put in the effort to make this
>>
>>52169652
Anyone?
>>
>>52170297
Pick a website
Grab all of its links
Repeat for each link
>>
>>52169690
Finished problem 9 in about the worst way possible as well. You need to find the product of 3 numbers such that a^2 + b^2 = c^2 and a < b < c. My solution:

import std.algorithm;
import std.range;
import std.typecons;
import std.stdio;

void main()
{
auto result = cartesianProduct(iota(1000), iota(1000), iota(1000))
.filter!(t => (t[0] < t[1] && t[1] < t[2])
&& (t[0]^^2 + t[1]^^2 == t[2]^^2))
.find!(t => t[0] + t[1] + t[2] == 1000)
.front;
writeln(result[0] * result[1] * result[2]);
}


How can I improve my answer?
>>
>>52170343
But is there a way to just search the web for the keywords I need, say, using some search engine API.

Are there any APIs like that which don't blacklist you for excessive traffic and repetitive queries?
>>
>>52170359
This is what I did:
1. Find all perfect squares under 1,000,000
2. Find the permutations of 2 of those such that the sum is in the set of perfect squares
3. Of those permutations, find the sum of their square roots and the square root of the 3rd perfect square
4. Return the 1 that totals 1000
>>
>>52170389
I doubt it
It's kind of a dick thing to do anyway
>>
>>52170397
Although a faster method would be:
1. Make a list A of 1 to 1000
2. Make a list B of 1^2 to 1000^2
3. Find the combinations of 2 numbers in B such that the result is also in B
4. Check to see if their respective square roots in A total 1000
5. Find their product
>>
Dudes i have a billion dollar idea and I need your help.

It's like Facebook just .... better
>>
Does c++ string::compare evaluate alphabetical order?

I assume it takes into account the ascii, and string length, and assuming length is equal, the smaller ascii value is considered less than.

Correct? Correct 'enough', but not specifically right?
>>
>>52170494
How do you make a social network without it becoming a liberal fuck fest?
>>
>>52170504
You don't.
>>
>>52170504
Make names/tags/identification optional and anonymous by default.
>>
File: Screenshot - 010116 - 21:12:41.png (33 KB, 728x155) Image search: [Google]
Screenshot - 010116 - 21:12:41.png
33 KB, 728x155
>>52170502
>>
File: 1449686383391.png (702 KB, 1920x1200) Image search: [Google]
1449686383391.png
702 KB, 1920x1200
how would i add threads to this?

http://pastebin.com/TTaMs2nV
>>
>>52170535
What makes a letter greater/lesser is what I'm asking.

I'm assuming it's the ascii value of the letter.
>>
>>52170494
ok
>>
>>52170502
Something along the lines of this
while(string1 == string2 && string1 && string2)
string1++
string2++
return string1 - string2;
>>
>>52170552
cast a char to an int and see what happens

c++ is a lot easier if you either grind through the basics of what variables are when represented in binary, or you learn how to experiment
>>
>>52170552
>Compares this string to str. First, calculates the number of characters to compare, as if by size_type rlen = std::min(size(), str.size()). Then compares by calling Traits::compare(data(), str.data(), rlen). For standard strings this function performs character-by-character lexicographical comparison. If the result is zero (the strings are equal so far), then their sizes are compared as follows

>static int compare( const char_type* s1, const char_type* s2, std::size_t count );
>Compares the first count characters of the character strings s1 and s2. The comparison is done lexicographically.
>If count is zero, strings are considered equal.

https://en.wikipedia.org/wiki/Lexicographical_order
http://en.cppreference.com/w/cpp/algorithm/lexicographical_compare
>>
daily reminder that D is shit
>no operators for function composition
>no built in currying
>no easy function combination
>>
>>52170772
>no algebraic type syntax
>no pattern matching
>small library
>no top quality ide
>>
What the fuck happened to dpt?
Where the fuck is everyone?
>>
>>52170845
Burgers and ausfags are asleep.
This time of day it is ruled by sane europeans.
>>
>>52170860
>burgers
no need to be so rude, only 2 in 1 americans are overweight
>>
>>52170882
>2 in 1
>kek
>>
>>52170891
desu that's the third time i've told that joke, but i happen to really like it
>>
>>52170882
>>52170894
Even funnier when you realize that fat people are 2 in 1.
>>
>>52170907
part of the punchline lol
>>
>yuros in charge of killing jokes by giving its full in-depth explanation
>>
>>52170772
>no easy function combination

import std.functional;

int double(int n)
{
return n * 2;
}

int add5(int n)
{
return n + 5;
}

alias doubleAndAdd5 = compose!(add5, double);

assert(doubleAndAdd5(5) == 15);


???
>>
>>52170946
disgusting
>>
File: mems.jpg (30 KB, 482x136) Image search: [Google]
mems.jpg
30 KB, 482x136
>more memes in /g/ than in /v/
sort yourselves out
>>
>>52170552
It uses the compare function from the traits class. The default compares by the numeric value of the character treated as unsigned char (i.e. 8-bit characters are higher than 7-bit, even if char itself is signed).

If you want something else (e.g. case-insensitive or locale-aware comparison), you can use a custom traits class, or std::lexicographical_compare from algorithm with a custom comparator, or you can just use .c_str() and a C function like strcasecmp() or strcoll().
>>
>>52170955
auto compose(F1, F2)(F1 f1, F2 f2)
{
return (arg) => f1(f2(arg));
}


???
>>
>>52170946
>>52170984
still better than haskell
>>
>>52170946

1. that should be an operator
2. alias -> compiler bloat
3.
int add5(int n)
{
return n + 5;
}
// in F#
let double = (*) 2
let add5 = (+) 5
let doubleAndAdd5 = double >> add5
//or
let doubleAndAdd5v2 = (*) 2 >> (+) 5
>>
>>52170990
Seriously? You prefer that crap to
doubleAndAdd5 = (+ 5) . (* 2)

?
>>
>>52171008
>That should be an operator
Debatable, especially in a language that is not fully FP like D

>alias -> compiler bloat
Aliases are just another name for a symbol, so no
>>
>>52171020
Does Haskell have a reverse composition (pipe) operator?

>>52171029
>not fully FP
that's not an excuse not to have function composition operators

You have uniform function call syntax which is _very_ similar
a.times(2).add(5); (or whatever their ops are called)

Still lacking syntax for pattern matching and algebraic types. (let alone recursive or mutually recursive types)

And judging from Andrei's talk "Three Cool Things About D" (in which he assumed a certain recursive function that wasn't tail recursive wouldn't be optimised by the compiler), it doesn't have good optimisation for recursion.
>>
File: 1449836244895.gif (118 KB, 2130x1198) Image search: [Google]
1449836244895.gif
118 KB, 2130x1198
>>52170536
anyone?
>>
>>52171110
Well, Haskell's been a thing 11 years before D, give D another 11 years and we'll talk.
>>
File: pattern.png (54 KB, 1132x902) Image search: [Google]
pattern.png
54 KB, 1132x902
>writing raycaster
>works fine
>did some changes and something broke
>trying to redo the raycaster
pic related
I don't even know anymore
>>
>>52171147
literally no excuse for missing these features
>>
>>52171165
desu though the nice thing about D is you can statically import a file and process it then insert the processed file

you can write your own custom all-in-one transcompiler with D
>>
>>52171158
was it supposed to be the sun shining down on 2 buildings?

because if so, it looks beautiful
>>
What is the /g/ computer science PhD consensus on Java?
>>
File: raycast.png (250 KB, 1277x1017) Image search: [Google]
raycast.png
250 KB, 1277x1017
>>52171209
It was supposed to be pic related with white wall color and no floor or ceiling.
>>
>>52171235
Java is useful for high performance neural networks.
>>
>>52171251
Faster than C?
>>
>>52171240
damn that sucks, you should keep the sun shining down on 2 buildings
>>
>>52171256
Even faster than ASM.
>>
>>52171264
Are there any citations or sources for this?
>>
>>52171273
>sources
right here on /dpt/
>>
>>52171273
gu.llible.org/ac-1890038/high-performance-computing-java-c-c-python
>>
>>52171256
How would you even write a neural network in C?
You literally can't average two ints in C.
>>
>>52171235
It feels like most of the high performance scientific libraries are always made with c++.
And when people want to use those libraries they use some scripting language like python.
>>
>>52171273
Sure.
                                                                                                                                                  my boypussy
>>
>>52171294
>implying you can average two ints in java
>>
>>52171294
>You literally can't average two ints in C.
(a + b)/2
>>
>>52171321
Wrong.
>>
File: 8u.jpg (50 KB, 640x360) Image search: [Google]
8u.jpg
50 KB, 640x360
What's with all the built in spyware in Windows 10?

smdh
>>
>>52171321
i seriously hope
>>
>>52171337
It's now also built into Windows 7
>>
>>52171328
What if a and b are floating point numbers
>>
>>52171321
>integer overflow
>loss of precision
>>
File: you.png (58 KB, 447x436) Image search: [Google]
you.png
58 KB, 447x436
>>52169520
>>
>>52171347
still wrong
>>
>>52171355
Explain
>>
>>52171328
int c = a + b;
if(a > 0 && b > 0 && c < 0 ||
(a < 0 && b < 0 && c > 0)
warn_about_overflow();
return c / 2;
>>
>>52171358
overflow, underflow
>>
File: iuy.jpg (38 KB, 534x526) Image search: [Google]
iuy.jpg
38 KB, 534x526
>>52171344
But why? And why isn't it optional?
>>
>>52171337
>2016
>still not using the GNU plus Linux operating system
>>
>>52171373
>Using a shitty language that allows either
>>
>>52169844
Make a shitty game using C++ and SDL.
>>
>>52171374
The telemetry helps Microsoft's talented engineers to further improve the, deserved, world market leader in desktop operating systems.
>>
>>52171382
>using shitty language that doesn't allow overflow
It can be useful feature in some cases.
>>
>>52171382
that's why I don't use C ya nob
>>
File: 1315907201.92635185.jpg (105 KB, 1280x720) Image search: [Google]
1315907201.92635185.jpg
105 KB, 1280x720
>>52171388
I understand that, and I don't blame them, but there should be a fucking opt-out at least.
>>
int average (int a, int b)
{
return (a/2) + (b/2) + (a%2 + b%2)/2;
}
int safeAverage (int a, int b, bool* plusAHalf)
{
*plusAHalf = (a%2) != (b%2);
return (a/2) + (b/2) + (a%2 + b%2)/2;
}
>>
>>52171251
> Implying high performance neural networks are written in anything other than Cuda C and C++ with high level bindings

6/10 made me respond
>>
>>52171401
>there should be an opt-out from the NSA botnet
baka
>>
File: 1450205579092.png (83 KB, 694x801) Image search: [Google]
1450205579092.png
83 KB, 694x801
>>
>>52171374
The Microsoft team cannot fix bugs without knowing how the bugs are activated. Telemetry guarantees that the exact condition that leads to the bug are absolutely correct. As for why is it not optional, I don't know.
The vast majority of peopl
>>
In ASM, are CPU registers basically temporary variables you can use for stuff? And if so, what when you need more than there's registers? Do you then do some magic to store that into RAM and operate on that by pushing/popping from the RAM?
>>
>>52171348
avg = (int1 / 2)+(int2 / 2) +(int1 & int2 & 1);
>>
>>52171444
>Do you then do some magic to store that into RAM and operate on that by pushing/popping from the RAM?
Yes
>>
>>52171402
Are you not entertained?
>>
x++ += x++ + ++x;

Find a flaw.
>>
What does it mean when you say a programming language has "soul"?
>>
>>52171486
It's become self aware
>>
>>52171486
It's like saying a car has a soul. You know it's shit, yet you still love it.
>>
>>52171479
Undefined behavior.
>>
>>52171510
Compiles properly so I don't care.
>>
>>52171505
Examples?
>>
>>52171486
It means you're crazy
>>
>>52171318
static int average(int a, int b) {
return BigInteger.valueOf(a).add(BigInteger.valueOf(b)).divide(BigInteger.valueOf(2)).intValue();
}


:^)
>>
>>52169298
Solving P - NP
>>
>>52171486
what is a "soul"? can someone define "soul"?
>>
>>52171514
C
It's a joy to work in, but it mauls you when you make a mistake.
>>
>>52171402
it shouldn't be plusAHalf if a and b are for example -1 and 1
>>
>>52171517
I puked a little
>>
>>52171525
it is something that is named "your sister".

If you fuck her and she is blood. You gain red hair and a juicy pussy
>>
>>52171541
cool thanks
>>
>>52171517
average(1, 2) -> 1.5

>>52171534
-1 % 2 = 1
1 % 2 = 1
1 != 1 is false
no plusahalf
>>
>>52171525
https://en.wikipedia.org/wiki/Soul
>>
>>52171541
I find that mildly disturbing.
>>
>>52171444

Registers are basically the fastest memory you've got on your system, as fast as or faster than L1 cache. You don't have a lot of them though (typically 8-32 general purpose registers, each holding 32 or 64 bits of data), and some of them may be more or less dedicated to one purpose (i.e. the stack pointer). Furthermore, most arithmetic instructions operate on data in registers, and store the value in a register. Where more data is needed, RAM is accessed, typically through the stack. Accessing RAM isn't really magic though. It's typically done through a load/store operation, which can be among the most commonly used operations on a CPU.
>>
>>52171557
what makes you think the wiki is right?
>>
>>52171556
>>average(1, 2) -> 1.5
>what is integer arithmetic
https://en.wikipedia.org/wiki/Rounding#Rounding_to_integer

>-1 % 2 = 1
-1 % 2 = -1
>>
>>52171486
what kind of faggot says that
>>
>>52171578
me
>>
>>52171578
me
>>
File: mod2.png (22 KB, 1145x717) Image search: [Google]
mod2.png
22 KB, 1145x717
>>52171567

2 out of 3 programming languages say -1 % 2 = 1
>>
>>52171562
What makes you think you know the color purple is purple?

Why is your purple not red?

How do you know you're not dreaming?

It comes down to defined limits
>>
>>52171567
I know what rounding is.
I also know what an average is.
I had a safeAverage function, why didn't you?


I also didn't realise they used the weird version of %. Replace (a%2 + b%2)/2 with
((a&1) + (b&1))/2
>>
holy shit
https://github.com/CMMCD/Snorlax
>>
>>52171486
I programming language has soul if its creator has a soul
>>
>>52171618
>average two ints in C
>C

>>52171631
>((a&1) + (b&1))/2
not portable
>>
>>52171631
in retrospect
(a&b)&1
>>
>>52171644
It is portable.
The representation of 1 is the same as the representation of a and b.
>>
File: Screenshot - 010116 - 23:26:25.png (65 KB, 555x823) Image search: [Google]
Screenshot - 010116 - 23:26:25.png
65 KB, 555x823
>>52171352
FINE, anon

just for you
>>
>>52171643
are ghosts real desu?
>>
File: 1393438140456.jpg (179 KB, 1083x720) Image search: [Google]
1393438140456.jpg
179 KB, 1083x720
A Muslim slapped my gf's arse last night. I didn't do anything, she just giggled and we continued walking home.

Hold me, /dpt/.
>>
>>52171294
>>52171321
1.0 / ((1/(double) a + 1/b (double)) * 0.5)
>>
>>52171674
pathetic
are you swedish
>>
>>52171674
what anime is your gf?
>>
>>52171635
how does it even work? it doesn't spawn a new thread, it just sleeps on the current thread
>>
>>52171674
>I didn't do anything
I will not hold you, anon
you have only yourself to blame
>>
>>52171678
>double big enough
not portable
>>
>>52170389
Respect robots.txt
>>
>>52171674
>implying you have a gf
>>
>>52171674
There there, anon. Come and sit on my lap, maybe we can talk you through this.

Now, some say that the best form of therapy is moving on. To assist you in this endeavor, I'm going to ask you some questions, and I want you to answer them as honestly as possible. Ok? All right, here's the first one.

What is a ``FROB''?
>>
>>52171699
robots.txt keeps normies out
>>
>>52171635
really shit

nobody will beat sleep sort and quantum sort
>>
>>52171687
>put your link to your github on your job application
>Recruiters sees that you have implemented O(1) sorting algorithm, he can't program and doesn't understand what it means but sees you have used big words and written some code so he gives you extra +
>>
>>52171656
so all the shitters that have been saying (i&1) != (i % 2 != 0) have been wrong all this time

fuck... joke's on me
>>
So I want to get into making some games. I've went through the basics of SFML but I'm not sure about the 'right' practices in game development (Things like object manager classes and stuff?). I can get basic games done but I want to branch out into more complex things like a simple rpg, but I don't know how to do it cleanly
>>
>>52171743
>>>/v/

If you want to make a /g/-tier game, do it in Inform 7. Work on that project and we'll help you. Anything else, >>>/v/
>>
>>52171661
Bane?
>>
>>52171743
an rpg is the cliche "in way over your head" beginner game dev choice of project

start with simple opengl graphics rendering and turn it into an arcade game
>>
so can /dpt actually programm anything besides meme stars and the average of unfucked ints?

show me your biggest project
>>
>>52171770
I made a text editor in c++ once

I tried making a calculator in c# but couldn't
>>
>>52171761
ah
>>
>>52171743
if you learn good OOP practice, games will come naturally
don't bother looking into 'how to make game' or anything like that, just learn proper OOP

final thing; never, ever mention OOP here - autists will spend multiple threads complaining and it's annoying as shit

also >>52171763 has the right idea
literally just make pong first, then write a platformer, then see where you want to go from there
>>
>>52171770
Audio analysis.
>>
>>52171763
>opengl graphics
Good games don't need 3D graphics and the best game get by with ASCII.
>>
>>52171791
>OOP
>game dev
normie plz
>>
>>52171803
>opengl
>necessarily 3D
nah m8
>>
>>52171791
are you advising to use inheritance?
>>
>>52169298
>>>/a/
>>
>>52171791
I don't have a lot of experience so I was trying to get good with OOP through games as I don't know what else to make really. I made a decent(functional) platformer in Python once without any help and made a tile editor, but that's probably the most complex thing I've done. I'll try to make some more simple stuff.

Should I stick to SFML or use straight opengl? I don't know if using only opengl would be too complex for me or not
>>
>>52171791
OOP is alright
"good OOP practice"
and OOP patterns are absolute shit in any decent language
>>
>>52171824
Start with SFML, if you want you can start going over to OpenGL later.
>>
>>52171824
C++:
imho doing 2d graphics in openGL is not that bad even compared to SFML 2d graphics

SFML makes system stuff a lot easier though
>>
>>52171763

I'll second this. Although the mechanics of an RPG may seem simple, the amount of work that goes into game design for one (namely story and asset creation) will far exceed the amount of work that goes into simply programming the game engine. By comparison, a scrolling shooter (a.k.a. "bullet hell") is actually fairly trivial.
>>
CONDUCTOR WE HAVE A PROBLEM
>>
>>52171824

Just use SFML. I hacked together a snake game in SFML in half a day.

https://github.com/expeditiousRubyist/Memesnake
>>
>>52171820
I'm advising to use what's necessary
i.e. don't gratuitously use inheritance 'just cuz', use inheritance where it's suitable
at the very least most game development frameworks / APIs require your main class to inherit some GameWindow class in the library so you can override OnRender, OnUpdate, OnLoad, etc. functions

OOP is a different tool for a different job. Most of this paradigm arguing is basically
>Screwdrivers suck, real mechanics only ever use hammers
>Brakes are useless, the most effective driving technique is exclusively using the accelerator
>Walking is pointless, I only ever hop on one leg
>>
CONDUCTOR WE HAVE A PROBLEM
>>
File: CONDUCTOR.gif (301 KB, 136x240) Image search: [Google]
CONDUCTOR.gif
301 KB, 136x240
>>52171892
>mfw next OP will be a trap
>>
new thread when ? :3
>>
>>52171310
                                                                                                                                                  memes
>>
CONDUCTOR WE HAVE A PROBLEM
>>
>>52169439
You never added the bars. You could do something like
1234567 = M^C^^X^^^IV^DLXVII
>>
>>52171922

When we actually hit the bump limit.
>>
>>52169507
>too bloat
>atom

You need more webscale m8
>>
>>52169497
Gedit
If i need to make something big i would use jetbrains clion.
I'm a student so free jetbrains stuff for me
>>
>>52169378
Even better, just trash the CR3 register so we page fault and crash when we return.
Thread replies: 255
Thread images: 40

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.