What r u working on in 2016?
>>52169298
first for php
>>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
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
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?
>>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
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.
>>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
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
>>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
>>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.
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
>>52169868
it just werks
>>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.
>>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 linesstring 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
>>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.
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.
>>52170502
Something along the lines of thiswhile(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 combinationimport 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
>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().
>>52170955auto 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 todoubleAndAdd5 = (+ 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.
>>52170536
anyone?
>>52171110
Well, Haskell's been a thing 11 years before D, give D another 11 years and we'll talk.
>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?
>>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.
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
>>52171347
still wrong
>>52171355
Explain
>>52171328int 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
>>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
>>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
>>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?
>>52171348avg = (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
>>52171318static 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
>>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.
>>52171352
FINE, anon
just for you
>>52171643
are ghosts real desu?
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
>>521713211.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
>>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?
>>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
>>52171892
>mfw next OP will be a trap
new thread when ? :3
>>52171310memes
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.
>>52171912
>different tool for a different job
Why do people keep saying this?
Some things are legitimately bad, and others are objectively good.
Standard imperative and OOP languages have SO MUCH code bloat, it's not even funny.
>>52172167
What would be a better way to organize code in a large scale application.
>>52172167
imperative/OOP code is very readable
FP looks like shit
>>52172179
look at ocaml/f# syntax
it's more powerful than most imperative syntax
significantly less bloat (practically none)
could be guaranteed to give the same performance (you could transcompile most of this)
You can get the following:
type inference/deduction
automatic generalisation
assignment style function declarations
function composition operators
unit type semantics instead of void type semantics
easy algebraic data types
match expressions
Some OOP idioms like always use accessors need to be dropped completely
>>52172231
depends on the language and the usage
ocaml and F# both support syntax that's more reminiscent of OOP
OCaml vs Haskell?
>>52172251
Well, the syntax is nice and I've seen plenty of the fizzbuzz and stuff around here written in those languages. I don't care too much about raw performance, as I will design the program to be fast enough to fit performance requirements. I just wonder how you would structure it in a large scale application. In a C# application I know what kind of design patterns I want to apply, what names everything will get, which folders contain what. With functional languages I've never seen how this is done.
>>52172276
>diarrhea vs constipation
Tough one m8.
This is stupid, I already know...
But I want to learn how to hack into wifi networks.
Give me some tips mother fuckers...
>>52172285
aircrack-ng
Now back to /v/.
>>52172285
>...
>hack
>stupid
>wifi
>fuckers
>mother
>>52172285
back to /b/ kid
>>52172285
>Give me some tips mother fuckers...
use google you dumb nigger
>>52172280
You could do it however you want.
You could do it in a similar way to OO.
>>52172316
>You could do it however you want.
That answer that makes it seem like you don't know shit.
>You could do it in a similar way to OO.
Then why should I ever bother with functional languages.
>>52172341
What >>52172316 meant to say is
You still have namespaces or modules in functional languages to organise code.
In Ocaml (I think F# too) you even have objects you can use too.
Just do it like you would in an OOP language. Jesus, you are not some UML manager monkey, right?
> why should I even bother with functional languages
>>52172251 fucking told you
>>52172341
What the fuck are you talking about?
Code wise
You have modules, which are very similar to namespaces.
You can have functions in functions, functions in classes, etc.
You can do type extension (e.g. adding methods to types in retrospect)
File wise
For F# you have source files and script files (F# and Ocaml have REPL interpreters as well as being compiled), you don't have header files
>Why bother
... because of all the shit I just listed?
Do you use enums? Do you do this?
enum suit = { hearts, spades, diamonds, clubs };
switch (suit)
case hearts: ... break;
case spades: ... break;
...
That's nice, isn't it?
Imagine you could do that with unions (called sum types)
After C++ I want to become a Prahjeet. Should I learn java or c#? Mainly for 2d games, which is better: libgdx or monogame?
>>52169845
I have a feeling this isn't a shitpost and that is your genuine solution.
>>52172425
Most people I know, myself included, have had awful experiences with libgdx. For me, it's the way rooms work. You could change its code, but I wouldn't recommend it as a whole, it doesn't really have any noticeable pros other than multi-platform.
I don't know anything about monogame, but if you feel you'll ever delve into 3D, Unity is a must
>>52172442
[spoiler]
it is his genuine solution
[/spoiler]
WWoooaaahhHHH!! Holy fuck, did I get smashed last night. wtf thread have I woke up in?
You nerds minding pointing me to /soc/?
How painful is using some sdl2 bindings for Haskell to make games? Know any high level bindings?
>>52172638
>SDL
>Haskell
>+
>>52172447
>tfw you just want something genuine
I have a string like "Dec 31 18:20" or "Dec 31 2015"
Now the second one would just parse without time, that is okay.
But the first fails.
Now here my thoughts for a workaround
Try parsing the string, if it succeeded be done.
Otherwise add the current year to it and try parsing it again.
If it now fails, ignore the date completely.
If it succeeds check if the date is not in the future, otherwise subtract a year.
Here's my shitty C# code:// try to figure out timestamp
var timestampString = match.Groups["timestamp"].Value;
DateTime timestamp;
if (!DateTime.TryParse(timestampString, out timestamp))
{
// didn't work, so we try adding current year to it
if (DateTime.TryParse(timestampString + $" {DateTime.Now.Year}", out timestamp))
{
// it worked! now check if it isn't in the future, if so, use the last year...
if (DateTime.Now < timestamp)
{
// date is now in the future, so subtract a year.
timestamp = timestamp.AddYears(-1);
}
}
}
How do I make it prettier?
>>52172687
jesus, it's like reading regex except worse
Currently downloading all of /wg/ again cause I've nothing else to do. What project can I do in python? I can also develop for android
>>52172728
Deciphering regex is a cakewalk compared to reading APL.
>>52172285
>hack into wifi when 99% use WPA2
Whatever you're trying to do is pointless.
It'd be headlines for days if some /g/ kiddie could easily get in
>>52172742
Write a python-based neural network to automatically rate those images according to your tastes.
>>52169392
how to do so? if clause?
>>52172742
script source?
>>52170970
only in OPs
>>52172758
>What is aircrack-ng
>>52172280
The need for a lot of OO design patterns dissolve when using a language that supports functional concepts.
For example, command pattern and strategy pattern both disappear when your language supports lambdas and first class functions. As such those patterns are needed in Java, but not in C#.
Understanding design patterns is still useful though. Understanding when, how and why different kinds of logic should be coupled or decoupled.
>>52172760
anything more useful?
>>52172767from time import sleep
import urllib,requests,os,sys
def threadDl(board,thread):
thread=str(thread)
url="https://a.4cdn.org/"+board+"/thread/"+thread+".json"
try:
urlInfo=requests.get(url)
except:
print "Cannot open thread."
sys.exit()
if urlInfo.status_code!=requests.codes.ok:
print "Thread not found."
return
posts=urlInfo.json()["posts"]
subject=posts[0]["semantic_url"]
newDir=os.path.join(os.getcwd(),board,subject+" ("+thread+")")
total=sum(1 for keys in posts if "tim" in keys)
if total==0: print "0 images found."
if not os.path.exists(newDir): os.makedirs(newDir)
count=0
for keys in posts:
if "tim" in keys:
newFile=str(keys["tim"])+keys["ext"]
newLoc=os.path.join(newDir,newFile)
try:
if not os.path.isfile(newLoc):
urllib.urlretrieve("https://i.4cdn.org/"+board+"/"+newFile,
os.path.join(newDir,newFile))
except:
print "Image download interrupted."
total-=1
continue
count+=1
print "{} of {} images done - {}".format(count,total,newFile)
def boardDl(board):
url="https://a.4cdn.org/"+board+"/catalog.json"
pages=list(i for i in requests.get(url).json())
sleep(1)
threads=[]
for page in pages:
threads.extend(list([thread["no"],thread["semantic_url"]]
for thread in page["threads"]))
total=len(threads)
count=0
while threads:
currThread=threads.pop()
print "{} of {} threads done - {}".format(count,total,currThread[1])
threadDl(board,currThread[0])
print "\n"
count+=1
sleep(1)
print str(total)+" threads completed."
>>52172794
Patterns are trash. Literally invented by incompetent memesters who can't think for themselves.
Real programmers solve problems without resorting to cargo-cult solutions.
>>52172777
>requires bruting passwords
once again
>It'd be headlines for days if some /g/ kiddie could easily get in
>easily
I didn't say impossible.
I said pointless.
Playing with my calfu.
>>52172795
shit, replacesys.exit()
withreturn
And remove the sys import
As a guide, threadDl and boardDl take the shorthand of the board as string (so g, wg, fit, etc) and threadDl takes a thread number as int
You can search for a thread using my thread regex search code:import requests,re,webbrowser
def search(board,regex):
url="https://a.4cdn.org/"+board+"/catalog.json"
pages=list(i for i in requests.get(url).json())
subjects=[]
for page in pages:
subjects.extend(list([thread["semantic_url"],thread["no"]]
for thread in page["threads"]))
count=0
matched=[]
for subject in subjects:
if re.match(eval("r\".*"+regex+".*\""),subject[0]):
count+=1
matched.append(subject[1])
print str(count)+": "+str(subject[1])+": "+subject[0]
if len(matched)==0:
print "No matches found."
return
while 1:
openPage=raw_input("Enter page to open. -1 to exit: ")
if openPage=="-1": break
webbrowser.open("https://boards.4chan.org/"+board+
"/thread/"+str(matched[int(openPage)-1]))
Board is shorthand string again, regex is the regex expression, make sure to preppend it with r if your regex uses \
>>52172826
If there are other people connecting to the wifi, it's literally trivial to sniff packets. It takes minutes.
>>52172760
I would pay good money for someone to do that.
Not automatically rate though, that's stupid and doesn't benefit anyone else.
automatically recognizing the images is enough.
>>52172845
>manually collect maybe 100 pictures as training data
>the program finds other pictures that you might like, you can either accept or reject them, and it continues to refine its suggestions
Doesn't sound that useless to me.
>>52172800
Patterns are in fact very useful when dealing with a crippled language like Java. If for no other reason, then to help communicate design decisions with other people on your team.
>cargo-cult
You seem to have a habit of calling loads of things you don't like "cargo-cult" without following through to explain why you think they are bad. Cargo cultism is the phenomenon of people believing certain things to be useful, based on observing apparently connected cause and effect when they see other people do them. But they do so mistakenly because they do not understand the cause and effect well enough to understand they are not connected. An example would be the "bear patrol" in the simpsons.
But at least cargo cultists are basing what they think on actual factual observations, even though their reasoning is flawed. You seem to be saying things are bad based on nothing. That's worse than cargo cultism, that's just sheer ignorance.
>>52172444
i'll agree that libgdx is awful
for 2d games, try plain opengl with your own engine seriously. you'll easily port your code to android and iOS with native C++ and opengl. for 3d games, you could use an engine if you want to go that route or still use opengl.
>>52172845
I wonder what "good money" is to someone who would find a program like that useful...
>>52172864
>show pictures of porn stars
>accept/reject
>cherry picked best porn stars
>>52172879
>for 2d games, try plain opengl with your own engine seriously.
>>52171743
>>52171824
I'm back. I'm still getting on with my attempt at a pong clone. I haven't really done a lot with SFML or the actual game yet. Trying to set up a game state and general base for the game properly.
So far it's going well though. It's my first time really using c++ properly.
https://github.com/MegaToastt/Pang
If anyone's interested
>>52172845
Anything else you'd pay good money for? I wouldn't mind challenging myself, but the neural network meme is not my thing
>>52172864
There's just no way it can ever be trained to pick what I like.(me personally)
What I like one day may be completely different the next. It also depends on my mood and a bunch of other random factors. I also don't want to be only restricted to 5-star tier images only.
tl;dr
i'd rather handpick what I want.
>>52172886
10k+?
>>52172890
This was pretty much my thinking, except I'd use something like gelbooru and correlate the tags + user ratings as well, rather than just the image data.
>>52172904
it's not hard at all
you gain pretty much nothing by using an engine
if you use box2d for physics that's one thing
but for rendering and game logic? a game engine isn't going to help you much. it's called unity3d for a reason, the 2d support was just tacked on to it to meet demand.
Simple 4Chan file downloader for that one guy who asked (I'll add more stuff later):
http://pastebin.com/CLkxGTtN
>>52172871
Design patterns are literally programmers copying what other programmers do because it's what other programmers do. That's like the definition of cargo cultism. They're shit.
>>52172425
C# and monogame.
>>52172904
>tumblr
>>52172936
this
i'm all for using java but even in a team you shouldn't need to talk about named design patterns
>>52172936
It helps keeps programming and logic uniform, so that it's easier for you to debug someone else's shit.
it literally makes your job easier.
>>52172936
>Design patterns are literally programmers copying what other programmers do because it's what other programmers do.
That's exactly not what they are. They are patterns for solving lots of common problems in languages like Java. You don't use them because others use them, you use them because you understand why they are useful and what situations they are useful in. Command pattern is a good way of passing a function to an object in Java for example. A lots of these patterns become obvious if you've programmed enough, but it's useful for newbs to learn all of them, and the benefits of each one so they can start thinking about them when designing large code bases. I found learning them helped me understand the benefits of inheritance and interfaces vs composition, and how to use composition in more places more easily, and what the trade offs will be of doing so.
Design patterns is how code monkeys call "do not duplicate code".
>>52172954
This.
I don't think you even need to use them by name when working with good programmers. But when dealing with shit programmers it helps to have something you can recommend they read about.
In my last job I mentioned to a guy I worked with that some of the classes in our code base should be composed instead of inherited, as the inheritance often served no purpose and caused a lot of daily issues. I partly justified my point of view by saying "composition should be favoured over inheritance", to which he sharply responded "Anon.. that's just your opinion". To which I responded rather gingerly "actually it's a principle of OOP design..". After which he was rather quite. This is why I find it's important to know this shit.
Sadly this guy was my superior. I spend the next 6 months trying to avoid criticising stuff he did, since it was obvious he wasn't happy about it and invariably took things personally. Despite that I still got fired, and was given effectively no reason. Sucked, but obviously wasn't going to be happy there long term, so I guess it worked out for the better.
>>52173121
You sound as retarded as my supervisor. >>52173134
he frequently justified clusterfuck code bases he wrote because they made the code a little shorter and reduced repetition, even though it was all hugely interdependent and needlessly tightly couples, creating hundreds of hugs I spent my time try to fix.
He often spoke as it "don't duplicate code" was the only principle of programming he knew, and winged everything else.
>>52173164
>"don't duplicate code" was the only principle
That's the only principle, but if the dev sucks, the dev sucks.
>>52173134
Programming patterns is what we talk about constantly. Reason be: our dev shed is pretty shit. Most programming patterns are way too complicated for the problem they need to solve.
About dealing with shit programmers: I never tell them that their code is shit. Saves a lot of hassle senpai. They're too stubborn to believe you. I just make my code work and never try to touch their code.
>>52172908
>neural networks is a meme
Found the ricer webdev tier "coder". Did you also get rejected for not knowing how to fizzbuzz?
>>52173269
>Most programming patterns are way too complicated for the problem they need to solve.
Do go on
> I never tell them that their code is shit. Saves a lot of hassle senpai. They're too stubborn to believe you. I just make my code work and never try to touch their code.
Not so easy when you are working with people designing the codebase you are working with. Also that sounds like it's an utterly shit company. Best thing about the last company was it was broadly speaking a meritocracy. Anyone could put forward new ideas, or say current things are being done in a shit way and suggest something better. You'd just need to have a good way of defending it. Only problem was the guy I worked for was the only guy not like this really, and was infact extremely insecure. Was a pity.
>>52173200
>That's the only principle
https://en.wikipedia.org/wiki/Category:Programming_principles
>>52173134
>Despite that I still got fired
>over something like that
wow, maybe im not cut out to be a programmer for a team. guess i'll stick to my hobby programming ;(
>>52173369
How do you mean?
There's assholes in every job. Sometimes you get unlucky. I could have gotten on fine if I just kept my head down, but I really wasn't willing to completely do that the way I would have needed to. It was better to move on to a company I could get better experience in and enjoy what I do more. In the end it worked out for the best.
>>52173349
We do have daily code reviews in order to proper code, but they're a complete joke. Your suggestions are put onto the back log a.k.a. /dev/null and'll never be looked after. Even his superior doesn't care, because time is $$$.
I'll be looking for a more professional job once I get rid of the junior stigma.
>>52173413
Thankfully my other job was great, since the CEO actually coded most of major products himself, and the company was doing really well. It was also small enough that you could go into his office with a new idea. He was cool like that. Really great culture. Only problem was the one guy I worked for. Ah well.
>>52173413
>I'll be looking for a more professional job once I get rid of the junior stigma.
How much did you make at that job, probably 60k+?
fucking ungrateful
>>52173497
1700 a month after tax.
>>52173504
oh..wow
nevermind then
>>52173364
Any good principle in coding is a special case of "do not duplicate code". I dare you to cite me one that isn't.
>>52173528
separation of concerns.
>>52173593
That's not a good principle, That's something that can be done automatically with a program. You analyze the dependencies and sort the code according to dependencies.
>>52173605
It's separation of "concerns", not "dependencies". For example, in MVVM, you keep the code which is concerned with displaying your UI separate from the code that figures out what state the data the UI directly represents should be in. Your can't statically analyze that, that's up to the programmer.
>>52173734
I do not care about the separation of concerns you have in mind. They're irrelevant. I only care about the true separation which is dependencies separation.
>>52173764
>They're irrelevant in my mind
Okay, but there is good reason for having these kinds of separations in real world projects. That's why these principles exist.
>>52173798
No there isn't. They're arbitrary separation, hence irrelevant. I only analyze a code regarding dependencies, and that's why I'm a fucking good developer. I know what is essential and what isn't.
>>52173851
>and that's why I'm a fucking good developer