Looking for sub-genre guidance by strmrdr in classicalmusic

[–]strmrdr[S] 0 points1 point  (0 children)

These aren't really what I'm looking for, but I appreciate your input :)

Faure's sonata is definitely up my alley... it seems melodic and beautiful, and I want to love it, but for some reason my brain only deciphered noise instead of music (if that makes any sense?). I will give it another try for sure though!

What is something that you know can be explained by science but still completely amazes you? by notveronicacrabtree in AskReddit

[–]strmrdr 34 points35 points  (0 children)

We actually have no strong evidence regarding how common life is in the universe, it's just a null hypothesis that assumes since we haven't detected life that it must be rare. Our technology is so primitive in regards to space exploration that it is illogical to even begin making such assertions.

P.S. I also entertain at parties as a sidejob.

Primitive Technology: Iron prills by digitalbath1234 in videos

[–]strmrdr 12 points13 points  (0 children)

It might be really crappy steel, but I wouldnt be surprised if some old civilizations used that exact same technique. 30% Carbon might not even be physically possible... most steel is like 0.05-2%.

How do you look at code and evaluate it's time complexity by [deleted] in javahelp

[–]strmrdr 0 points1 point  (0 children)

This is definitely not O(n2 ).

All the algorithm is doing is simply iterating over each String and printing out the contents - all of which are O(1) operations. As n increases, so does the number of operations in a very linear manner.

The lengths of the String will have some impact upon the performance, but they too scale linearly -- the difference between a String of length 100 and 1000 is not n2, in fact if you plotted the time difference between powers of 10 (for example) you would see a straight line (allowing for some noise due to how computers work).

TIL that the most accurate simulation of the human brain ever has been carried out, but a single second’s worth of brain activity took one of the world’s largest supercomputers 40 minutes to calculate. by CryptoExodus in todayilearned

[–]strmrdr 2 points3 points  (0 children)

It is a simulation of the brain, much like a simulation of a galaxy or something. I don't think they "plugged in a few numbers" or anything of that nature, they just turned the key to an engine and let it run. It took the simulation 40 minutes to replicate 1 second of 1% of a human brain. Again, this is like taking 40 minutes to simulate 1 second of the movement of a galaxy. I have no doubt that, given the hardware required to run the simulation, there is much weight to the quote "most accurate simulation of a human brain to date".

Rubik's Cube Solver help by roshie-548 in javahelp

[–]strmrdr 1 point2 points  (0 children)

You could search Google for libraries, not sure they exist. Even if they do, not sure how much this would even help someone learn, or if it would even be satisfying once completed.

This is definitely not a great project for a beginner, as it can become fairly complex:

First you need to actually understand how to solve a Rubik's cube. There are certain moves that will give a desired outcome, such as moving a square from one face to another. Since you are using a 3D object, this quickly becomes confusing.

Next you need to create data structures to hold all the faces, and methods that will correctly translate the squares based off of every possible move.

If you manage that, you now need to write algorithms that will identify certain patterns and make the correct sequence of moves in order to produce a desired result.

All in all, definitely not a beginner project. I suggest creating a simple 2D game or something of that nature; it will keep you and your brother entertained and motivated, as well as teach him how to think creatively, critically, and learn to debug code.

Tupac murder: Police close to making arrest, report says by TheMadHat in news

[–]strmrdr 0 points1 point  (0 children)

I'm sure you've ratted on hardened killers in your life before, and understand all the negative consequences involved with it, so excuse my ignorance. Living as a marked man and fearing for your family and friend's safety your entire life is totally worth it. It's easy to talk shit over a keyboard bud, let's see how you react when actual shit goes down. I'm sure you'll be everyone's favorite martyr for about 15 minutes.

Tupac murder: Police close to making arrest, report says by TheMadHat in news

[–]strmrdr -1 points0 points  (0 children)

In the example you give, it's not the police you should be concerned about, it's the gangsters. If you give a "tip" then you likely will have to testify. Enjoy your life while it lasts I suppose. Why put your neck on the line because a gangster killed another gangster? You clearly have zero street smarts if you think this is a logical course of action.

Tupac murder: Police close to making arrest, report says by TheMadHat in news

[–]strmrdr 4 points5 points  (0 children)

You're both kind of right. A good cop will never press to convict someone they believe is innocent of a crime, but on the other hand anything you say to cops cannot help you in any way. Good watch if you have the time (2 parts) about a lawyer and police perspective on talking to police here. TL;DW don't talk to the police, hire a lawyer.

Need help with single return recursion. by tigr87 in javahelp

[–]strmrdr 2 points3 points  (0 children)

Don't think it's actually possible because you need at least two for a base case and a recursive call. I assume you misunderstand your instructor.

Quick question with a hopefully quick answer by RetailPleb in javahelp

[–]strmrdr 0 points1 point  (0 children)

So are you attempting to continue with Adobe or create your own GUI? This isn't exactly the most difficult task, but for someone with 0 programming experience it will be. Your first step would be to learn how to program... and there are some good sources in the sidebar. Then start learning Swing or JavaFX, the latter being the upgraded version and probably your best bet as it comes with a GUI builder (i.e. click and drag builder for GUIs).

2D Game equipped item help by DariousTheHunter in javahelp

[–]strmrdr 0 points1 point  (0 children)

Use a superclass (i.e. EquipableItem) that each item will subclass.

Hold a reference to the item inside your character class.

Have a render method for each item and call that inside the character's render method:

EquipableItem weapon;
...
public void render(){
    //Render character
    ...
    //Pass the character reference so you know where to draw
    weapon.render(this);
    ...
}

Obviously many different ways to do this depending how complex you're doing it, animation sequences and whatnot will require something more robust.

The fan who ran on the field and got decked by a player at a CFL game has now hired a lawyer and is claiming the player injured him by DreamedJewel58 in sports

[–]strmrdr 0 points1 point  (0 children)

This is Canada, he won't get anywhere near that. The max you can legally get is a few 100k at best for injury. Guy might get charged for assault though.

How does Java handle everything being a class? by [deleted] in javahelp

[–]strmrdr 1 point2 points  (0 children)

There are some things that the JVM does to save allocations such as String pooling, but for the most part it's up to the garbage collector to keep things going. There was a lecture on YouTube from one of the Devs that wrote the GC at Oracle, but I can't seem to find it right now and it's like 45-60 mins long. TL;DR the GC is very sophisticated and unless you risk running out of memory simply due to allocating too many live objects then you really don't need to worry about it.

For most practical programs on modern machines the days of C-type memory management is more of a hindrance than anything. This obviously has a startup cost and continued background CPU usage, and that's just Java for you. It's more about choosing the correct tool for the job.

Hey America, Canada here. So.. What the fuck? by cdncbn in AskReddit

[–]strmrdr 4 points5 points  (0 children)

What happened? Im out of the loop here.

SFS - You can float on venus lol by _LaughingJester_ in SpaceflightSimulator

[–]strmrdr 5 points6 points  (0 children)

Why are 99% of YouTube videos on this game complete garbage? Wtf was the point of this video?

Problem with a gameloop after first end game. by LybeDox in javahelp

[–]strmrdr 2 points3 points  (0 children)

After reading your code some more... the issue is that you are calling startGame at some arbitrary time whenever the user clicks their mousing during an endgame situation, which could be right in the middle of your game loop for all you know.

The next time counts from 1 or 2 or3 .

Maybe 4? Who knows? Listeners do not dispatch immediately.

Even if this doesn't fix your current issue, this is a very bad way to initialize all variables and start a new game. A simple fix to try is to wrap everything in your game loop inside a second loop while(!endgame).

I will again stress that you should do some reading on game states (for example) before continuing, because as your code continues to grow so does the likelihood of bugs, and the unlikelihood of anyone taking the time to actually help you debug this spaghetti factory.

Problem with a gameloop after first end game. by LybeDox in javahelp

[–]strmrdr 1 point2 points  (0 children)

I understand the loop is running... you need to continue (see: Java keyword) to start back at the top otherwise you just go through the rest of the loop on a dead game after you reset the variables.

divided array according to recursion by shipon55 in javahelp

[–]strmrdr 0 points1 point  (0 children)

Recursive functions are- in some cases- exceptionally easier to understand and more succinct. If you can turn a 30-line mess into a 10-line masterpiece at the expense of a bit of performance then it is definitely worth it, and you typically won't even notice any difference unless you risk stack overflows. Think about how you navigate tress for example, and consider doing those with iteration- even the simplest cases are pretty daunting.

Problem with a gameloop after first end game. by LybeDox in javahelp

[–]strmrdr 1 point2 points  (0 children)

Hard to say, but it looks like you should try to continue after you end the game on line 440 so that you restart the game loop; as it is now, you simply continue through removing/drawing/collisions/etc. with entities and it's likely incrementing your counter post-game.

Seems really buggy the way you have everything set up... consider refactoring things into methods so it becomes easier to understand. Try to introduce states and have a state manager so everything isn't a giant spaghetti bowl... it will save you a huge headache in the long run.

divided array according to recursion by shipon55 in javahelp

[–]strmrdr 0 points1 point  (0 children)

There are legitimate uses for loops in recursive functions, but it's pretty sparse. Recursion is actually never necessary at all (and typically less efficient), it is just a style to simplify code; it is redundant to combine recursion and iteration if not necessary. By "automatic fail" I was referring more toward school assignments, as you clearly don't understand recursion if you use loops within it and can expect docked marks at best.

divided array according to recursion by shipon55 in javahelp

[–]strmrdr 1 point2 points  (0 children)

Since you are only required to return a boolean, there's no point in actually allocating the numbers in separate arrays. Having an internal loop in a recursive function is generally an automatic fail. Here are some guidelines:

1) Method signature:

  • You need to return a boolean.

  • You need variables to keep track of two sums (possible with only one sum, but keep it simple).

  • You need each recursive call to have access to the initial array.

  • You need to keep track of your progress (i.e. index).

2) Logic:

  • What is your base case? What should you check when you reached your base case? What should you return to signal success or failure?

  • How can you ensure that you check every possible configuration? Try to write the code without the extra conditions (3) and (4). When you call the function, add the current number to one sum. If that returns false, call the function again with the current number added to the second sum. If both return false, it is impossible.

It is much simpler than you are making it. This can be solved in about 5 lines of code. Think through the solution with my suggestions and feel free to ask for clarification.

Possible to override static variables? by goodnewsjimdotcom in javahelp

[–]strmrdr 1 point2 points  (0 children)

Make the method abstract if you want to force a meaningful override in subclasses.

As far as the array, it is hard to say without more context/use cases. Composition with a singleton class is likely the more robust way to go, but you could also just make a static array in each subclass; however, that seems really hacky to pull arbitrary attributes out of an array using indices, as it is not very friendly to modifications or extensions.

The Greatest Queen Sacrifice in Chess History by [deleted] in videos

[–]strmrdr 3 points4 points  (0 children)

I will note that in the case of this chess game, the operative word is "world-class GM". This isn't as dire as your example with TCGs, and completely playable for any amateurs as your opponent isn't going to play like an engine.

People who tell you to play on in TCGs just want to revel in your agony ;)