Code Golf: Creepy Relationships!

Mark Harwood
2 min readNov 6, 2023
Photo by Christian Lue on Unsplash

Been a while!

Just over a year since my last post, I never intended to leave it this long ???????? A lot has happened in that time but I’m back today with another short example of PowerShell wizardry.

Maybe that isn’t the correct term since I wrote the code… seems a bit boastful!

Anyway, I came across a Code Golf issue that I wanted to sink my teeth into ⛳

A lot of the Code Golf issues are too long, complex or just boring for me. Especially, with a full time day job and a family, it’s hard to find time. But I love PowerShell and love beating it into an ever shrinking golf hole when possible! ????

So I came across this issue, which was a super simple calculation really. The premise was creepy relationships. Basically, describing relationships with a large age gap as creepy…

Whilst I did fail to get the code down to Python or C# levels, I think I did pretty good at just 60 bytes. You can view my submission here, but I will explain it in this post too.

For all golfing submissions, I like to get the basic premise first to make sure I understand the issue and can solve it. This was it’s easier to debug later on. Also you feel like a wizard removing bytes and shortening the code.

--

--

Mark Harwood

IT Pro 👨‍💻 Dad 👀 Husband🔒 Check out my free blog or utilise my expertise on the web! https://mharwood.uk