Showing posts with label puzzles. Show all posts
Showing posts with label puzzles. Show all posts

Tuesday, 29 September 2015

Tangram for Breakfast

True, you can use software to play Tangram, but it's not as satisfying as the real life hands-on version.

Amazon sells a splendid wooden version for £2.69:

It's the perfect way of (gently) waking your brain up in the morning -- coffee is good, but a Tangram puzzle + coffee is superior.  Also works great if you're stuck on a coding problem -- solve the tangram, and the solution to the other thingy just pops up in your mind a lot of the time.

Try some cats, or a paradox.


Friday, 11 July 2014

Shlemiel, the painter

A friend sent me this delightful joke which also doubles up as a puzzle, after I complained that the more I study, the longer my to-do list gets.

 (Go on, solve it, you know you want to.)

Personally, I think this was the best comment:

"You do realize, we're trying to sum up Stupidity as a Mathematical Equation."

But I also like the big collection of possible approaches --- those solutions have everything!

My solution is here, hidden as blue text on blue background:

Shlemiel can walk M meters per day, and his effort can be modelled as an Arithmetic series S_n  with the points S_x, S_y and S_z, therein, so we're looking for M = S_x,  2M = S_y and 3M = S_z and the values of x, y and z which give us the total distance reached on each day.

Rearranging S_n = n/2 (2p + d(n+1)) we get 2 S_n = dn^2 + dn +2pn = [(2S_n - 2pn) / d ] - n = n^2. 

(where p is the initial length and d is the distance) 

There is no closed form for finding n, but because n^2 is the biggest term, we can simply ignore the others and extract our values for x, y and z thus: 

x = floor(sqrt(M)), y = floor(sqrt(2M)) and finally, z = floor(sqrt(3M)).

On day one he paints a = x meters, the next day he manages b = (y - a) meters, and finally, c = (z - b) meters on the third. 

Update: there is of course always at least one error in every solution... and the above is no exception :) 

So...

x = floor(sqrt(2 M/d)), y = floor(sqrt(2*2M/d)) and finally, z = floor(sqrt(2*3M/d)).

Moral of the story: beware of working with convenient values.

Friday, 22 November 2013

Ruby Koans Meditation

Even if you never ever plan to code in Ruby, do check out the Neo Ruby Koans meditation.

It is the cutest, most fun programming course I've ever took.

But be sure to study the Tao of Programming first.


Thus spake the novice programmer:
``It is time for me to begin.''


Monday, 7 October 2013

Programming My Old Tom Cat

My cat of act has committed an act of cat and shredded neighbor's toddler.  (Not terribly so, but it's never good!)

He did something like that before I adopted him, which is why he was exiled, and having his tail broken 9 year ago by a toddler apparently was still fresh in his memory and he suffered intense nightmares for a week afterwards.

My neighbor has been supplied with a decent supersoaker so he can easily dispel my cat's territorial ambitions, and because ASBO kitteh is now grounded during the day, I also bought a food maze to keep him entertained.

At least this was the theory and I was convinced this is a great idea after watching this video:




It's not popular.  He worked it for a bit and then decided that he'll go on a nil-by-paw diet instead.  It's not that he can't see the crunchies, it's that he refuses to see them -- he wants his bowl back AND his cat door open, and has formed a union of one, picketing the kitchen, lobbying for that extra portion of wet food he feels entitled to in lieu of the unreachable crunchies.

I on the other hand have realised that the food maze saves food because the crunchies are not sitting in his drool in a bowl.  And whilst he is on cat strike, he at least is not serenading the cat door in protest because his feline right of free movement has been curtailed.

Also, he is a grumpy old man, and really does not like change, at all. 

So, what to do?  Treats.  He may not work for food (as that is surely beneath his catly dignity) and no-one would be so unkindly honest to call him thick... but treats... that's another matter.  Raw beef or ham is kitteh crack that causes instant IQ enhancement!

Stage 1: remove the ring on top, put a box for the cat to sit on, add crunchies to top layer.  Place cat in position, tease with catnip treat, place it on mound of cat food.  Leave your perplexed sphynx to meditate over the puzzle, tease with catnip bicci every ten minutes or until you hear feeding action.  Carry on a few days until this is his new bowl where he feeds and he understands that it contains food inside and that it falls through holes.

Stage 2:  Now that he has understood that his food lives in this annoying plastic tower, remove all the inner layers.  Add crunchies to bottom layer then tease all the way from the fridge to the maze with a delicious strip of ham until he is ready to riproarslaymassacre that morsel... and drop it in small pieces (taking your time) onto the crunchies on the bottom level.  Tease cat with a strip of ham through the paw holes, let him munch his winnings and repeat, then walk off, leaving his prize on the crunchies in the maze.  Steinitz took 2 weeks for this stage, and I started to suspect him of training me to feed him goodies... heh.  But no, I think he was just forgetting he could reach them.  Once he starts eating them up, you can go on to ...

Stage 3:  Replace middle layer.  Add crunchies and drop a few through the holes(the sound of success!) and some thinly slivered raw steak in small pieces.  Tease with a long strip of meat as in step 2.  If your cat has the goldfish nature, this can take quite a few sessions.  He just didn't make the connection that the crunchies land on the bottom layer before dropping through clean and got quite frustrated when he pawed at a goodie that didn't turn up immediately in the bowl.

Stage 4: Replace the top layer and the and top ring.  Fill feeder.

Your cat is now fully programmed to operate the food maze!

Update:  He now has started to use his paw to scoop his wet food in the same way that he fishes for crunchies.  Dare I teach him how to use knife and fork?  Maybe better to just stick to a spoon! :-D

Friday, 6 September 2013

Productive Procrastination

I rediscovered my old math grind bible -- Engineering Mathematics by K. Stroud.

It's not a math course as such, more like a collection of sure-fire 'how do I calculate ...' recipes and a decent amount of exercises for every topic with answers.


So, I'm working through this book instead of playing Sudoku every time need a short puzzle break --- of course it's still procrastination, but, it feels a lot more productive!