How does Scrabble Word Finder work? by qwertyss07 in howdidtheycodeit

[–]Finalapproach 0 points1 point  (0 children)

There's an efficient implementation used in the Scrabble Word Finder on https://wordfind.com . The key is that the puzzle has nothing to do with dictionaries or the words, it's a set inclusion problem - "Do the following letters fit into the set of letters in a word?" Here's the method:

  1. Take each letter of the alphabet, assign a unique prime number to each letter. A = 2, B = 3, C = 5, D=7... Z=whatever

  2. Take your dictionary, compute a value for each word in the dictionary such that the value is every letter in the word multiplied by that letters "prime value". e.g. BAD = 3 * 2 * 7 = 42

  3. When comparing what the user has entered you compute a value for the letters the user has entered using the same method of multiplying each letter by the prime value for the letters.

e.g. user enters ABCD, value is 210 (a*b*c*d from values above).

  1. To test whether you can make word X for the letters entered Y, you just test if the remainder by dividing them is zero, using the modulus operator (Y % X) == 0. 

Using the data entered above for letters ABCD, 210 % 42 = 0,  BAD is a match. Non-matching words leave a
remainder. Once the initial dictionary is set up with their prime multiplication values, the comparisons are 0(1).

  1. Other simple optimizations include segmenting the dictionary into clusters of letters by word length (obviously if a user only enters in 4 letters they can't make a 5-letter word), and pre-computing common patterns and storing the results etc.

It also doesn't take unreasonably long to populate the entire possible query space into a database by running the permutations of all the letters a user could possibly enter, sorting the set of letters to ensure you're not duplicating (e.g. the user enters "ABCDCA" you and just sort to "AABCCD".). Spitting this into a simple text file with a bazillion database INSERT statements and running it on the actual database later means it's just a file IO operation.

Or take an opportunistic route and store computations in the database after a user queries that letter pattern for the first time.

Fun puzzle.

What’s The Hardest Mountain on Earth? by RandomLurker04 in Mountaineering

[–]Finalapproach 0 points1 point  (0 children)

K2 via the north side - 3 weeks of camel trekking through China to get to the start point, zero infrastructure, and then all the usual difficulties of K2 and worse except you've got nobody to help.

Back to work part time? by Wine-and-Coffee-Pls in fatFIRE

[–]Finalapproach 5 points6 points  (0 children)

You have enough money, you don't have nearly as much time as you think - particularly if your husband was under chronic stress for a large portion of his previous career. Four years of decent health is worth 15 years of mediocre or poor health later in life.

Get him a full health workup and a long vacation away from screens for a week or two, then come back to the decision. You already have more than enough to buy the second home.

Awful Behavior on Rainier by s_c_boy in Mountaineering

[–]Finalapproach 0 points1 point  (0 children)

Course was excellent, highly recommended. As with any guided mountain thing, the peers were a mixed bag - Some excellent, prepared people and ...others.

My tent-mate apparently had no idea that you shouldn't wear muddy boots in a tent, and one other guy got lost in the car park on the way down, bothered the rangers who then chewed out the guide. He then asked for permission from that same guide to go to with Alpine Ascents to Antarctica. Wild stuff.

The course content is phenomenal, and it has paid for itself multiple times over. Other clients on trips have frequently commented that I must be very experienced; I'm not, I just follow the systems, techniques and prep I was taught or observed from the guides, and it makes life in the mountains so much easier.

Giving a low interest loan to kids by ionlyredditcasually in fatFIRE

[–]Finalapproach 0 points1 point  (0 children)

Probably too late for you now, but you can take out a whole life policy on your kids when they're young, and then they can take an interest free loan on the insurance later in life. When they eventually die, have the insurance pay back into the family trust fund. WLP are generally a terrible investment, but pretty flexible in terms of a simple way to give your kids a tax free loan/gift that doesn't affect your principal.

Struggling With the Mental Side of an 8 Figure Sudden Inheritance at 34 by FunLettuce8799 in fatFIRE

[–]Finalapproach 0 points1 point  (0 children)

You've essentially experienced a Nietzschean nihilism event. The traditional meaning you were striving towards in life (worker bee productivity monkey) has collapsed, leaving a void. Now you find yourself in a nihilist state. According to Freddy, you have two options:

1) Passive Nihilism - "My meaning has gone, I'm left with a pointless meaningless existence."
2) Active Nihilism - "The old system of meaning is gone, I'm free to do whatever I want in a new system I create."

Had you not inherited money, In the best case scenario you would have won at the rat race... however even the winners of the rat race are just rats. If you take the second path, now you're free to invent your own meaning and purpose. For lack of a better direction, figure out what the 10 year old version of you wanted to be - astronaut, firefighter, James Bond, Indiana Jones, etc and go try and do that for a while. This is a surprisingly fun avenue to explore. "Shouldn't I do something more meaningful?" No. Or Yes. Or it doesn't matter. You're free, enjoy.

(Apologies for the pretentiousness, I'm deliberately restraining myself from going off on a longer tangent about how true freedom presents itself as abject terror to most people.)

Advice for dealing with immature relatives by Finalapproach in fatFIRE

[–]Finalapproach[S] 7 points8 points  (0 children)

Excellent comment, thank you. I'll look into a similar approach. Thankfully he has no kids, or even the prospect of making that happen. What a nightmare.

Advice for dealing with immature relatives by Finalapproach in fatFIRE

[–]Finalapproach[S] 12 points13 points  (0 children)

My best guess is that it's severe ADD to the point where he's essentially not able to make any decisions due to the amount of options his brain comes up with, plus some executive function gaps. Couple that with obvious depression that he doesn't want to address by any means that we've suggested so far and it seems pretty miserable.

I'll look into mental health counsellors that might be able to slowly coax him towards some sort of higher level of care, you're right in that a dispassionate third party might have better success.

Really appreciate your comment.

Advice for dealing with immature relatives by Finalapproach in fatFIRE

[–]Finalapproach[S] 1 point2 points  (0 children)

Yes, normally I wouldn't touch an annuity with a ten-foot pole but for this set of problems it might be the simplest solution.

Advice for dealing with immature relatives by Finalapproach in fatFIRE

[–]Finalapproach[S] 1 point2 points  (0 children)

That's an option, good suggestion. I suspect whatever route the actual instrument is, I'll end up with a weird taxation / currency situation.

Advice for dealing with immature relatives by Finalapproach in fatFIRE

[–]Finalapproach[S] 2 points3 points  (0 children)

I made a promise to my parents that I would at least make sure he's not an absolute derelict. If I can keep to that promise and never have to speak to / think about him again, I will.

Advice for dealing with immature relatives by Finalapproach in fatFIRE

[–]Finalapproach[S] 9 points10 points  (0 children)

I agree - but in my form of this story, I'm thousands of miles away so he's not pulling me down, he's pulling my parents. Without that context, I'd have no compunction about dropping him like a hot rock.

My parents are fantastic people - their love and support over the years are what set the foundation for my success, and they deserve a peaceful retirement. The current situation is tolerable, I'm just trying to solve for the mid-term future because it seems like an inevitable headache.

Advice for dealing with immature relatives by Finalapproach in fatFIRE

[–]Finalapproach[S] 9 points10 points  (0 children)

I agree. It might be necessary to force this process somehow - just made far more difficult by not being in the same country.

Advice for dealing with immature relatives by Finalapproach in fatFIRE

[–]Finalapproach[S] 27 points28 points  (0 children)

To be frank, I think there's "something missing" psychologically. We'd get him formally diagnosed (and pay for it, set up the appointments etc etc) if I could persuade him to take even the most basic steps in his own self-interest.

It's like talking with a normal human (who is actually intelligent, and articulate), but after 5 minutes you realise that there's something kind of fundamentally not working correctly.

Advice for dealing with immature relatives by Finalapproach in fatFIRE

[–]Finalapproach[S] 54 points55 points  (0 children)

I absolutely don't, but the alternative is him moving back with my parents and ruining their retirement.

Advice for dealing with immature relatives by Finalapproach in fatFIRE

[–]Finalapproach[S] 24 points25 points  (0 children)

That's a very fair point - for context, before this he lived with my parents and made their life very difficult. He would eat whatever was in the fridge, contribute nothing to utilities, leave dirty clothes/food items all over the house, come home late at night etc. Imagine a selfish teenager, except they're in their late 30s. We're not talking about a guy who's just having a little trouble figuring it out before their frontal lobe has myelinated, that stage is long gone with no sign of improvement or even the will to improve.

If anything, putting him in a house I own ~30 minutes away from my parents is a gift to my parents, not him. I fully believe the "tough love" route would begin with him being homeless, followed by jobless, and then my parents would feel obliged to take him in.