Show more

And this seems appropriate as well:

"And the days that I keep my gratitude higher than my expectations
Well, I have really good days" Mother Blues ~ Ray Wylie Hubbard Listen!!

bit.ly/J2N05H

Python Solution: Not the best, but the best I could come up with since I already saw someone else's solution and didn't want to just copy it :( 

Works now, but more like the code I didn't want to copy :)

Show thread

Python Solution: Not the best, but the best I could come up with since I already saw someone else's solution and didn't want to just copy it :( 

Never Mind. That doesn't work.

Show thread

Python Solution: Not the best, but the best I could come up with since I already saw someone else's solution and didn't want to just copy it :( 

Show thread

Okay, here is a fun one. We've all seen Fibonacci sequences. But they are all played out. Let's look at a different sequence. They are called Hamming Numbers after Richard Hamming, who proposed the problem of finding computer algorithms for generating these numbers in ascending order.

For number H is equal to 2**i * 3**j * 2**k where i,k,k are all non negative.

For example
2**0 * 3**0 * 5**0 = 1
2**1 * 3**0 * 5**0 = 2
2**0 * 3**1 * 5**0 = 3
2**2 * 3**0 * 5**0 = 4
2**0 * 3**0 * 5**1 = 5
2**2 * 3**1 * 5**0 = 6
2**3 * 3**0 * 5**0 = 8

So hopefully that explains what the sequence looks like. Your challenge, if you choose to accept it is to generate the first 25 of them. An arbitrary nth one such as 1700th. And given a number X determine if it is or is not a valid hamming number.

Here is the wiki article on them:

en.wikipedia.org/wiki/Regular_


okay, here's a freebie!!

This problem was asked by Facebook.

Given a multiset of integers, return whether it can be partitioned into two subsets whose sums are the same.

For example, given the multiset {15, 5, 20, 10, 35, 15, 10}, it would return true, since we can split it up into {15, 5, 10, 15, 10} and {20, 35}, which both add up to 55.

Given the multiset {15, 5, 20, 10, 35}, it would return false, since we can't split it up into two subsets that add up to the same sum.

@Absinthe
Yep! Like I said, my implementation treats the board as functionally infinite as cells grow towards the borders

This was a fun one! Written in Ruby, I decided on treating the board size as infinite by expanding it whenever the first or last row or column has an alive cell.

The entry file is game_of_life.rb in the root directory, and for simplicity, it just runs the "small exploder" pattern instead of taking an argument for initial state.

git.allgood.dev/jump_spider/ga

*I* used to be the only spinster on fediverse. The first. By Jove, I’m taking the word back right now.

Anyone who wants to “identify as a spinster” must not be a nazi/terf.

Thanks for your attention.

Okay, here is a fun one. We've all seen Fibonacci sequences. But they are all played out. Let's look at a different sequence. They are called Hamming Numbers after Richard Hamming, who proposed the problem of finding computer algorithms for generating these numbers in ascending order.

For number H is equal to 2**i * 3**j * 2**k where i,k,k are all non negative.

For example
2**0 * 3**0 * 5**0 = 1
2**1 * 3**0 * 5**0 = 2
2**0 * 3**1 * 5**0 = 3
2**2 * 3**0 * 5**0 = 4
2**0 * 3**0 * 5**1 = 5
2**2 * 3**1 * 5**0 = 6
2**3 * 3**0 * 5**0 = 8

So hopefully that explains what the sequence looks like. Your challenge, if you choose to accept it is to generate the first 25 of them. An arbitrary nth one such as 1700th. And given a number X determine if it is or is not a valid hamming number.

Here is the wiki article on them:

en.wikipedia.org/wiki/Regular_

go solution 

@Absinthe Keeping in the tradition of choosing the worst possible languages for this time it's Go: gitlab.com/tymorl/warmups/blob . The algorithm is essentially the same as @khird proposed.

@Absinthe I'm very slowly working on a little clever one, and I'm going to use it to make me a new profile picture, just you wait...

@Absinthe couldn't resist this one:
git.sr.ht/~namark/snail/tree/m
I swear I tried to do it for square only but it seems to work for rectangles too.

In true c++ fashion it comes with a bunch of illegible library code, which I had to extend with a couple of extra abominable appendages to accommodate this toy.

#toyprogrammingchallenge #cpp

@Absinthe

#toyprogrammingchallenge

I wrote a Life in JavaScript a few years ago. I suppose I could interpret the challenge as building the smallest one I can, but I've done enough of them that one more isn't interesting at present. I suppose I should do it in Elm, but I'm having too much fun programming MIDI in Lisp right now.

https://billstclair.com/life

Okay, here is one before the weekend.

Conway's Game of Life. It is a simple concept. Set up some cool patterns and let it run on a good cycle. I just did it, using '*' and ' ' but feel free to do it graphically if you prefer. Here are the rules, and my code is in the same repo so let that be a spoiler warning:

git.qoto.org/Absinthe/life-con

@Absinthe Hello! I saw you write about programming puzzles (and that's why I followed you), I was wondering if you know Advent of Code, and if you do, how do you like it 🙂
adventofcode.com

Show more
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.