Search This Blog

Sunday, January 19, 2025

Exercise - It's all in the mind

 It was another grey, cold, uninspiring morning. Nothing attracted me to head outside, but that was okay; I had a little project. We had a long leisurely breakfast while reading the overnight news and consuming more coffee than we should have. Once we were ready to start the day, I headed for my study and Diane slowly progressed to her sewing room.

I had an email from cousin Tim. We have a family lunch scheduled for May, and he wants to ensure he is ready for it by providing the table layout. That, in its own right, is simple enough, but he also wants us to shuffle to new seats between each course. This is still simple enough. Where the challenge comes in is the set of rules that govern the seat allocations:

  • try to maintain a male/female sequence around the table
  • keep one of the children close to one of three people because she only speaks French
  • keep one particular person away from each of three other people
  • try to keep people close to their partner

There lies the rub. I could think of no simple algorithm for this, but I could imagine how it could be coded in a computer program. I wrote some simple code to start a seat allocation without any constraints. Then, I started to write the code to apply the individual rules. I am about halfway through the project, so I will return to the challenge during the week.

This took most of the day, so I did not venture out for a walk. I excuse myself by saying that I got all of the exercise I needed through mental effort.

(In the past, I could have done this with some form of rules engine - but I no longer have access to such tools and must write them myself).


No comments: