/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

en.wikipedia.org/wiki/Mastermind_(board_game)
docs.oracle.com/javase/7/docs/api/java/util/Random.html
en.wikipedia.org/wiki/Python_syntax_and_semantics
twitter.com/NSFWRedditImage

anime

C#

>What are you working on, Sup Forums?
I got too tired reading books and want to apply myself as I am learning. So basically looking for short programming problems

sum of all primes below 2 mil computed in less than a second

Cry more discretefags, dynamic typing is unironically the future

>anime

x86_64 kernel with userland and GUI.

School project for component-based software design, hoping I can get some advice here.

We have to make a mastermind game following the SOLID/GRASP principles perfectly. en.wikipedia.org/wiki/Mastermind_(board_game)

My teacher hinted to us to separate the solution area, the guess area and the hint area into their own classes. I understand putting the solution in one class and the gameboard itself in the other class but I dont get the point of having the hints in their own class?

The solution needs to be totally encapsulated and the method to check for a winning guess would be in there for that reason. But the same method that can check for the win can easily supply the hints as well. Would that be violating cohesivness?

I hope this makes sense

a-and what

Yes

...

I'm in a basic java class. I'm trying to do a word scramble game where you have to take a string from a file, scramble it and then have the user play a game where they swap indicies that they choose. I could probably get the indicies from the user easily and then do a loop that continues while the user doesn't have the right word, but my problem is that trying to scramble it is a pain in the ass. If anyone could help that would be much appreciated.

Do C# compilers for JVM exist?

>trying to scramble it is a pain in the ass
wtf just use the .Randomize() extension method

> too much anime on an anime website

Short answer: No.

>anime website

Not yet, but I'm writing one.

Do I have to import anything to use it, or can I just use it via the random object

Do you have a logo?

docs.oracle.com/javase/7/docs/api/java/util/Random.html

Nope. I will at some point and it will be some sort of anime image.

You have to switch languages to use that.

void whatever(MyClass& abc);
void whatever(MyClass &abc);
void whatever(MyClass abc&);

are these all the same thing?

wrong

Bad solution, but you could do something like (Index*RandomInt())%Length for the initial jumble and if that index is already set, just inc/decrement

1 and 2 should be added, I'm assuming?

wrong

no the correct answer's 142913828922

Actually you could also just reverse the problem. To jumble just choose two random unique indicies and swap. Do this Length*n times

is that possible without a look up table?

...

ye

converting JSON to SQL DDL

Euclidean Algorithm

Are you using DFELQ?

Well OP, recently I gave up Clojure to try Elixir. Coming from a Python background with a love of the power of lisp macros and a desire to avoid anything-java, seems like it might work out.

I'm going to distribute keks far and wide with the erlang vm.

jesus christ how horrifying

echo 142913828922

Is there a problem with that? You could maybe improve it by not allowing it on set slots before the whole string is set

>Coming from a Python background
Oh... I'm sorry to hear that, user...

Javascript, Jquery , General topology and Kolmogorov complexity

no enlighten me I suspect this is going to be great

i was kidding

some acronym i just made up

Are there other language virtual machines than .NET and JVM for compiled languages?

who cares?

>take proofs exam
>randomized questions
>end up writing 8 pages of simple proofs
>look over and the girl next to me is drawing lines between sets

erlang vm

Look up and implement knuth random shuffle

...

who wrote that?

him

>Meritocracy is racist.
IQ is racist too.

Elixir is bootiful anons

>usually compiled languages
fixed that for you.

It's dynamic garbage.

>tfw not in presence of an argument

Who are you quoting?

Please do not use an anime image next time. Thank you.

Static typing is garbage.

Impossibru.

Please do not make posts of this type in the future. Thank you.

i guess that's just your opinion man

Litterally can't find documentation on python's type rules

>proofs

WHERE IS PROOFS?

i think he meant an exam on proofs

en.wikipedia.org/wiki/Python_syntax_and_semantics

advice? :(

if ( some long condition
&& some long condition
&& some long condition) {
...
}

looks good to me, is this an ok convention?

if (
some long condition
&&
some long condition &&
some long condition
){
}

Not him, but what's the difference?

I am getting through a quick intro to Rust. I don't get one thing: why do some expressions require the semicolon, while others don't? Also, why is println called as a macro, and not as a simple function?

mine has a secret optimization

The semicolon in Rust turns an expression into a statement by replacing the value with (). If the return type of your function is () and the last expression is of type (), then you can either give it a semicolon or not.

println is a macro to handle a variable number of arguments.

you need to die your hair blue and get a septum piercing in order to become a true rust programmer

What's the best way to migrate a VS solution to a newer toolset just for myself when it's on a tracking branch in my local git repo? Ideally, I want to do it in a way that doesn't result in merge conflicts on the vcxproj files when I pull (so something besides the skip-worktree flag). Is a smudge/clean filter really the best way?

I've looked through this, but nothing actually says how a dynamic type is inferred. Maybe it isnt since it's interpreted

import types
dir(types)

...

the 1st and 2nd are
the 3rd no

then what is the third one called?

If i put object instances in queue in c#, how do i retrieve it and print it in console?

fuck me if i know

dequeue it

Syntax error

char** lines = (char**) malloc(5*sizeof(char*));

is this equivalent to char lines[5][5] ?

...

Oh STFU. It has some interesting ideas, that's all. I probably know more languages than you do.

>casting malloc

Kill yourself

No.

Most retards here know 1 or 2 languages so that isn't saying much.

So angry!

why would i kill myself, brainlet?

char** lines = (char**) malloc(5*5*sizeof(char));

is the equivalent.

if I have a method in a class.
I make another class and inherit from said class.
Can I overload it in the new class?

How does @Override work with overloaded methods

Try me. About 10. Mastered 5, average at 3, meh at 2.

Doesn't work

Look into dynamic method casting.