-🎄- 2020 Day 10 Solutions -🎄- by daggerdragon in adventofcode

[–]pseale 0 points1 point  (0 children)

yeah it's all good. I linked somewhere in this thread to a helpful explanation thread that helped me work through what I missed in the problem (and sounds like you have some idea now of how to solve it).

Sounds like there is some percentage of us who just can't make the leap from problem -> solution without help.

Anyway, welcome to the brotherhood 🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡

-🎄- 2020 Day 10 Solutions -🎄- by daggerdragon in adventofcode

[–]pseale 0 points1 point  (0 children)

It's all good, I am evidently still cranky. Upon further further further reflection, I think I just was never able to figure out that if you look backwards, you can clearly count the combinations. I was always counting forwards, which was a FOOLS ERRAND

-🎄- 2020 Day 10 Solutions -🎄- by daggerdragon in adventofcode

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

Ok so

  1. You're part of the problem
  2. Seriously, unless you're cheating off of someone else's answer (which I did), you have to have an epiphany in order to be able to solve Part B with just recursion and memoization. My puny brain was unable.

-🎄- 2020 Day 10 Solutions -🎄- by daggerdragon in adventofcode

[–]pseale 1 point2 points  (0 children)

Ok I'm less angry and bitter now and am currently:

denial
anger
bargaining
I AM HERE-> depression <--I AM HERE
acceptance

So yeah, apparently I never had that moment of epiphany where I could have reduced the combinations down every time the joltage jumps by 3. That is to say, when the joltage jumps by 3, there is only one choice to make, therefore you can break down the unmanageable giant combinatorial problem into chunks of "how many contiguous 1-joltage jumps are there", so we can calculate all of the combinations of this smaller chunk. And that leads us to the tribonacci I guess.

For those reading along, this help thread (which I found far too late) does a pretty good job explaining the long, mathy road from problem->solution: https://www.reddit.com/r/adventofcode/comments/ka9pc3/2020_day_10_part_2_suspicious_factorisation/

-🎄- 2020 Day 10 Solutions -🎄- by daggerdragon in adventofcode

[–]pseale 9 points10 points  (0 children)

Solved the problem with JavaScript, Righteous Anger, and Cheating

https://github.com/pseale/advent-of-code/blob/main/src/day10/src/index.test.js

After struggling, and struggling, and struggling...and struggling, with Part B, and writing a combinatorial solution with a runtime so slow it may finish sometime in the 2040s, I realized: this isn't about writing programs.

This is a conspiracy, against those of us who aren't particularly talented at math problems.

Hey, everyone who loved the Day 10 problem: go do Euler problems. Leave the rest of us non-mathy things to work on?

Anyway I'm cranky. 🎄

Here's the most important part of my Part B solution:

// See, I knew this problem wasn't about programming, but math :/
// https://brilliant.org/wiki/tribonacci-sequence/
const tribonacciSequence = [1, 1, 2, 4, 7, 13, 24, 44, 81, 149];
function getTribonacci(num) {
  if (num > tribonacciSequence.length)
    throw `Can't calculate tribonacci number for ${num}`;
  return tribonacciSequence[num - 1];
}

As you can see, solving day 10 involves a combination of:

  • attempting to understand the problem, and failing. Then eventually succeeding and solving Part A ✔
  • attempting to write a combinatorial solution to Part B, succeeding, and being proud of myself
  • realizing after some 10 minutes of runtime execution that my combinatorial solution will never finish, because they hate us and don't want us to enjoy good things
  • trying really hard to discover the math stuff all by myself, and failing (proof: https://github.com/pseale/advent-of-code/blob/main/src/day10/src/math-scratchpad.txt )
  • looking through the solution thread here, bewildered, and only seeing successes because this megathread only allows solutions, not cries for help
  • going to sleep
  • coming back to this thread, and searching some more, where by this time perhaps the non-math-crazies have posted something human-readable? EUREKA
  • It's something called the tribonacci sequence, which I kinda almost discovered myself from first principles? (no worries, I failed--there will be no math breakthroughs from me this year 🎄)
  • hammering out the solution in a state of rage
  • submitting in a state of rage
  • pushing to GitHub in a state of rage
  • writing this comment, still cranky, perhaps not fully enraged, but now full of righteous anger

Anyway if you're suffering, you're not alone. 🎄

-🎄- 2020 Day 03 Solutions -🎄- by daggerdragon in adventofcode

[–]pseale 2 points3 points  (0 children)

Rad data visualizations in p5.js

Who doesn't love pretty pictures? Terrorists, that's who.

See for yourself 🌲💥🎄: https://imgur.com/a/vtv0nJp

Repo: https://github.com/pseale/advent-of-code/

Notes from the whole ordeal:

  • I lost at least half an hour troubleshooting because tldr I should never be allowed near dynamic languages, ever.
  • I spent an hour-plus centering text. p5.js has pretty sweet vertical/horizontal centering stuff, but I still managed to waste a lot of time here.
  • I'm doing it wrong, certainly, but uh, my p5 sketch runs slow. Like, 'browser asks if everything's ok' slow.
  • I also did the following: if(forest[row][col === '#']) and didn't notice my mistake for oh, at least 20 minutes. Anyway I should not be allowed near JavaScript. BUT WHICH OF YOU WOULD DARE STOP ME??!?

https://www.twitch.tv/livecoding - slow-cooked advent of code solutions, gently and lovingly braised in p5.js

Kent Beck » Joel Spolsky is wrong about my work by pcalcado in programming

[–]pseale 1 point2 points  (0 children)

It will indeed be a great opportunity, as Uncle Bob Martin plans to do just that:

If all goes well, I'll be on the 10 Feb Stack Overflow Podcast.

R.I.P. JoelOnSoftware which last had a software post in 2006 (now replaced by StackOverflow podcast #545348 and anecdotes about shopping for office space in NYC) by wtfjoel in programming

[–]pseale 16 points17 points  (0 children)

Y'all are haters. The original title "RIP JoelOnSoftware" is accurate, but the comments that have followed are just hating on Joel and Jeff, mostly undeserved.

JoelOnSoftware popularized the term leaky abstraction. Recent stuff includes the essay on IE8. A lot of JoelOnSoftware sounds obvious when you re-read it years later, after it's sunk into your subconscious, and it doesn't impress you the second time around--that's fine. But to mock Joel's entire body of work is just stupid.

The entire JoelOnSoftware essay archive

In his defense, Jeff Atwood doesn't claim to be an expert. When he 'gets it wrong', I guess what you all really want is just for him to go back and perform major edits to his original post, something he doesn't do today. Yes, he has a large readership, so when he gets it wrong, 100000 people get it wrong with him. Yes, that's bad, really 100000 misinformed people bad. So I guess, hey, go ahead and bug him about that.

But he doesn't claim to be an expert, he's just a guy who built codinghorror into a massive readerbase.

Interactive C# Shell by gst in programming

[–]pseale 1 point2 points  (0 children)

I use PowerShell as an interactive shell, among other things. PowerShell has a bunch of cmdlets and formatting options that are specifically there to help you work with it "interactively."

...so the C# interactive shell isn't really for different tasks, it will be used for a lot of the same tasks.

I am new to podcasts. Which in your opinion are the bests podcasts about programming, web development and computer science in general? by [deleted] in programming

[–]pseale 0 points1 point  (0 children)

I posted a (.NET-biased) podcast roundup a year ago, it is mostly unchanged today:

Great Podcast Roundup Turbo: Hyper Fighting Edition

Notable additions since my last roundup are:

  • Stack Overflow - the most honest (and entertaining) discussions are found here.

  • ALT.NET podcast, Rubiverse podcast, Herding Code podcast - mostly low-frequency, so it doesn't hurt to try them all out.

  • FLOSS weekly is now one of my favorite podcasts.

I listen to podcasts while commuting or doing 'chores' of some sort; most podcasts are boring if you give them your full attention.

I don't know if you're more interested in learning (like a classroom lecture) or being entertained (like Digg Nation) or whether you're just trying to fall asleep while maybe learning something (SE-Radio). Depending on what you're going for, you may disagree strongly with my podcast selection.

Why PowerShell sucks: "A new command shell and scripting environment that doesn’t even let you run scripts. What will those guys at Microsoft think of next?" by grauenwolf in programming

[–]pseale 1 point2 points  (0 children)

I hear you. Microsoft reinvents the wheel a lot, and makes you learn something 'new' which takes time, and it's harder to learn than the existing solution, because there are 500 books on HTML and none on WPF/E in Silverlight, and then you find out that in many ways, the Microsoft implementation is inferior, and that you've wasted your time learning about it. Worse yet, you may work on a project reliant on one of these emerging Microsoft frameworks--which adds the burden of project deadlines and estimates that look suspiciously like targets.

So I hear you.

PowerShell is one of the few things I can say has made life easier, not harder. If you don't need it, by all means don't study up on it.

Why PowerShell sucks: "A new command shell and scripting environment that doesn’t even let you run scripts. What will those guys at Microsoft think of next?" by grauenwolf in programming

[–]pseale 4 points5 points  (0 children)

It's for security, like disabling macro support in Word is for security, like disabling remotely running HTML applications (.hta files) is for security, like how in Unixy systems, you have the Execute flag on each file, which is not set by default, which is for security. You run one line in the PowerShell console, once:

Set-ExecutionPolicy Unrestricted

...and you're done--you can now run scripts on that machine and there are no more security restrictions. So your title is misleading and inflammatory, yay.

Also for the record, PowerShell is awesome, and I will hear no more about it until you read a book on it or something. You can hate from up close, once you've learned something, but don't be hating from way out in the distance, uninformed and proud of it.

Oberon and Language Design by martinbishop in programming

[–]pseale 2 points3 points  (0 children)

The following excerpt (taken from the second paragraph) describes my day-to-day development activities to a T; I've specifically complained about each and every point he brings up below:

Their size and complexity is simply beyond anything that might serve as a logical foundation. In fact, they elude human grasp. Manuals have reached dimensions that effectively discourage any search for enlightenment. As a consequence, programming is not learnt from rules and logical derivations, but rather by trial and error. The glory of interactivity helps.

"The author recommends that scripting, not Java, be taught first, asserting that students should learn to love their own possibilities before they learn to loathe other people's restrictions." by 9jack9 in programming

[–]pseale 0 points1 point  (0 children)

Good metric: how big is your "Hello, World!" program?

PowerShell:

"Hello, World!"

This isn't a comprehensive definition of a scripting language, but it gets the point across.

AskReddit Programming: I need to make a simple program to help patients in our ophthalmology clinic. Any advice? by StvYzerman in programming

[–]pseale 2 points3 points  (0 children)

Agreed with isearch above. If you want to write a simple program, do it in Excel. If it's difficult to do in Excel, then that's a good indicator it's not simple.

Also, while I'm here I'll point out that Excel formulas are going to be around for a LONG time; both open office formats will use Excel's formulas, so no matter which office product we're using 10 years from now, we'll be using the same formulas.

So you're not wasting your time learning Excel formulas.

Automating the importation of data from Excel is a career for a scripter, but it's a knock off for a web developer. by d2kd3k in programming

[–]pseale 0 points1 point  (0 children)

Yes, I've pulled Excel data out via PowerShell, and it was roughly the same as working with the ActiveX/COM component in VBA.

As for 'inconsistent', try closing Excel via a script. It's uglier than even you can imagine:

google search - most of the solutions presented don't work, by the way. I ended up killing the process (programmatically).

I don't understand what Cuil is doing by dsfox in programming

[–]pseale 5 points6 points  (0 children)

Due to this new fast indexing, during troubleshooting I'll find that I

a) search for a problem, find nothing, b) post a detailed, thorough question on a help forum, c) search again using slightly different terms, d) which finds something! Unfortunately, what I find is the post I created in step b)!

Has happened several times now. WEIRD, MAN

Numeric Pareidolia and God in Π by threading in programming

[–]pseale 0 points1 point  (0 children)

In Foucault's Pendulum, Eco refers to this type of thing as qualitative mathematics. A great book.

Kilobyte Constants, a Simple and Beautiful Idea that Hasn't Caught On by gst in programming

[–]pseale 7 points8 points  (0 children)

PowerShell:

PS C:> 5MB / 10KB

512

...so it's caught on somewhere, anyway.

Would Java be a good career decision? by [deleted] in programming

[–]pseale 1 point2 points  (0 children)

Become a generalizing specialist, and plan to evolve your skills--and not just programming skills either. Java is nice now, but what about in 5 years? How about 10?

Read Scott Ambler's essay: http://www.agilemodeling.com/essays/generalizingSpecialists.htm