Sunday, 19 December 2021

Calendar puzzle (ii)

In the end I went for the brute force approach, ie the not so elegant approach. It took me a while to write and debug the code but eventually I got there and found thousands and thousands of solutions (in fact I assume I found them all). Once I somewhat tidy the code up I will post it in github. Today I spent some time figuring out how to plot the calendar, learning about colour maps, grids, etc. As usual, python has you covered! People who have created and contributed to libraries such as numpy and matplotlib definitely deserve a lot of credit.

Since it makes no sense to publish here a daily puzzle I have created a twitter account for the Calendar, so that I can create a bot which tweets a solution every day (or if I feel even more adventurous and I have time, maybe posting a hint and then a few hours later the solution?). I read this great post from Miguel García and so far so good as I already managed to post something from a script after fumbling my way through Twitter´s Development Portal.

Not quite sure yet where to run the bot. One option would be to set up a raspberry pi, another one would be to explore pythonanywhere which I already used to host the tute app. We´ll see.

PS1: It will be in pythonanywhere, whose free tier allows to run one scheduled task per day (!), which is enough for this. It should run each day at 8am. Let´s see.

PS2: It works! :-) Code in a semi tidy state available in GitHub 

PS3 (October 2024): Bot now also available for Bluesky 





Solutions for today, who would have thought that there are so many ways to solve this puzzle?







No comments: