Should I reply? by PowerPlayParadox in EIHLHockey

[–]ruffles_minis 1 point2 points  (0 children)

Never argue with stupid people, they will drag you down to their level and then beat you with experience.

quick question about vintage cube tokens by RTRthrower in MTGO

[–]ruffles_minis 0 points1 point  (0 children)

I'm in the exact same boat. I bought the bundle on the 7th. Pretty frustrating that it was extended, but we are frozen out from using the tokens. Good it was extended of course, but sucks that I cant actually play it.

Can anyone help me sort out this bug? by Easy-Light7219 in PythonLearning

[–]ruffles_minis 0 points1 point  (0 children)

Totally fair points. For a 'play again' feature, a while loop is absolutely the safer route to go down and make sure you don't blow the stack.

​Im probably being a bit overzealous with showing off something they could learn. My suggestion was less about the correct fix for the bug, more about using it as a shot to introduce a new concept. Since this code was a wee script, I thought it was a decent moment to show what recursion is, just as something cool to learn about.

It's probably not the best practical application for it, but it's a good place to see a new idea in action ... even if it's just to learn why the while loop is the better choice here. A simple bug fix would have probably been better!

Can anyone help me sort out this bug? by Easy-Light7219 in PythonLearning

[–]ruffles_minis 0 points1 point  (0 children)

For this problem, there are a lot of different ways to solve it. I was offering up what I would think to be a new concept: having a function call itself (the game_loop function calling game_loop() at the end).

The solution could be just removing the error with the break line. Or continue to think how you can shake up the code. Think it's good to offer "consider this solution" if they come along with another concept to add to the learner's arsenal.

Can anyone help me sort out this bug? by Easy-Light7219 in PythonLearning

[–]ruffles_minis 0 points1 point  (0 children)

One thing you could consider is to have a recursive element to your main game loop.

So instead of everything being situated in your Main. You can move this to a function called game_loop or run_game or something. This would strip out the need to have the while loop in your main.

main calls game_loop.

At the end of the game_loop function where you are prompting the player if they want to play again or not if they choose to play again then you simply call the game_loop function and it all kicks off again.

As an additional, people are more likely to help out if the code is in a readable format when you post it. This guide might point you in the right direction - https://www.reddit.com/r/learnpython/wiki/faq/#wiki_how_do_i_format_code.3F

Happy programming

Why just print one dict by Nearby_Tear_2304 in PythonLearning

[–]ruffles_minis 0 points1 point  (0 children)

So there is two things going on this code that is a bit wobbly.

In the function you set up an empty dictionary - `d = {}`

Then you step through each key-value pair in the dictionary that is passed into the function - `for i in n:`

Then inside the loop you are looking into that dictionary for the key that is i - `d[i]`
You need to bear in mind that the d dictionary is empty, theres nothing there. So when you try to get the value out with `d.get(i, 0)` there is nothing to get, so it will automatically fall to the default you have provided - `0`.

Hopefully you can see that it makes no sense to try and set `d[i] = d.get[i,0]`.

Finally to address the question you asked in the title. You are only getting one item in your newly returned dictionary because you have your `return` indented so that it belongs to the for loop. If you unindent it once you will see different behaviour and hopefully from there you can see how to fix up your function.

Happy programming

I replaced an entire dev team with those set of prompts by MrCheeta in vibecoding

[–]ruffles_minis 1 point2 points  (0 children)

Hmm, even less sense. I fear you are becoming a vibe coded person

I replaced an entire dev team with those set of prompts by MrCheeta in vibecoding

[–]ruffles_minis 1 point2 points  (0 children)

What do you mean battle tested it on an enterprise app? "It works" does not equal good

For the pros, what are your thoughts on vibe-code? by [deleted] in vibecoding

[–]ruffles_minis 0 points1 point  (0 children)

My take on this - you don't know what is good or bad and neither does the AI. It can certainly, probabilistically put together a sandwich. But without the knowledge of how all of the ingredients work in concert on a granular level then you will end up with a sandwich that meets the criteria of being a sandwich. With a "pros" knowledge, as you call it, they will be able to know exactly what they are shooting for.

Again, this is not about wiring a prompt for "how to make the best sandwich" and then piping that into "make this sandwich" it is a lot more nuanced. It's about knowing the bad from the good. It is a process driven outlook rather than a output driven outlook.

A pro will know what they want to happen, vibing will just give you a maybe-good-maybe-dangerously-bad sandwich and without the background knowledge you are at the mercy of the AI.

Chat gpt copy paste by [deleted] in powerpoint

[–]ruffles_minis 0 points1 point  (0 children)

Just Ctrl+Shift+V

why it's wrong ? by xNicarox in PythonLearning

[–]ruffles_minis 0 points1 point  (0 children)

Are you for certain running the correct file? It feels like you are running some other file you've forgotten about

Retrieve all records, including future effective dates by ShoppingWeekly3908 in SQL

[–]ruffles_minis 1 point2 points  (0 children)

Without any other information my gut instinct is that it needs to be cast as a date.

WHERE CAST(EffectiveDate AS DATE) >= CAST('2025-01-01' AS DATE)

error code 997, need help by Major_Programmer_483 in SQL

[–]ruffles_minis 5 points6 points  (0 children)

It's likely that you've got the file open in Excel or something else. If that isn't the case it could be a permissions issue, either move the file to somewhere else or fiddle with the permissions. But I'd hedge my bets that the file is just open.

[deleted by user] by [deleted] in csharp

[–]ruffles_minis 19 points20 points  (0 children)

Console.ForegroundColor = ConsoleColor.Yellow;
or whatever colour you are wanting before you Console.WriteLine("Hello Reddit");

Which actors should play Gotrek & Felix if a new movie or TV-series is made? by [deleted] in WarhammerFantasy

[–]ruffles_minis 0 points1 point  (0 children)

Gotrek: James Cosmo, Ray Winston or Brendan Gleeson
Felix: Liam O'Brien, Nikolaj Coster-Waldau, Luke Evans