|

Getting Stuck (with Python)

Last time I posted on this topic, I wrote that I was very close to getting into the section of the book Automate the Boring Stuff With Python by Al Sweigart where I would start programming the really interesting and USEFUL stuff, but first, I had to get through two exercises at the end of the book.

Okay, one of the two problems was a bit harder and involved importing a game program that the author wrote. The game was in the form of a multiplayer game where you write up bots and give the bots strategies for playing the game. I was able to import the “3rd party module” via pip but I was having problems getting the game to wrote, never mind writing up one of my bots.

So, I was stuck.

How do I get unstuck?

There is no single answer other than persistence.

Here’s a couple of things I did to move along towards a possible solution:

  • Moved the installed programs to the proper area where most Python programs reside – in other words, start with the easy stuff to get a sense of motion.
  • Scrubbed through the programs installed via pip to see how it was structured.
  • Went to his site for Automate the Boring Stuff With Python to see if there is any further information – and yep, there was but still not sufficient. Between the website and his book I gathered some ideas for at least playing the game, never mind creating bots.
  • Explored possibilities of approach for initiating the game.
  • Looked through the programs to see which single module was driving the game. Once I identified the driver, it got easier to figure out how to get the game started.
  • Each time I got stuck, I would take a break and do something else, preferably something a bit routine, to allow the subconscious mind to explore for solutions.
  • Sometimes, I let it rest overnight.
  • Once I figured out how to get the game started, it was time to progress to the more difficult problem: creating the bot with strategic playing instructions and getting it into play.
  • Same thing: scrubbed through the programs for hints, taking breaks to rest the mind, and letting the problem rest overnight.

For this particular problem, that was basically the approach taken to solve this. Normally I do a bit of Googling but for this problem, Googling wasn’t going to work.

It boils down to taking a lot of breaks and doing seemingly unproductive stuff to arrive at some possible approaches and then experimenting with those approaches to see if they work. During those breaks, you could take a walk or drive (driving works really well with me and I tell myself stories of how the day went and usually in the storytelling I came up with a new approach – they just pop into my internal storytelling), or take a shower. The breaks can’t involve another type of work such as spreadsheet work or reading because they engage your brain a little too much.

Anyway, now I’m ready to proceed onto the next chapter which I see, at first glance, still more instructions rather than an interesting project that I can use in real life. My expectations need to be lowered.

Similar Posts