There is nothing like a challenge to bring out the best in man. - Sean Connery
Hi Pythonistas, a new week, a new 'bite' of Python coding! After last week's conceptual challenge (generators), we'd like to challenge you this week to build Tic-tac-toe. Every time we do games (previously Word Values and Hangman) we learn a lot. Enjoy and we review solutions end of this week.
Build a command line app where you can play against a friend or the computer. We recommend the latter to do some AI: to intelligently respond to player's moves (see Strategy). Maybe you can add game levels to avoid the machine to be 'too smart' (see Google widget for example).
For the best UX it's probably easiest to number the board like the keyboard's number pad: 7-8-9, 4-5-6, 1-2-3. We provided a template with some guidance, but maybe you want to start from scratch (let us know what works best for you ...)
See our INSTALL doc how to fork our challenges repo to get cracking. If you want to share your solution do a PR and we will add it to our community branch. We will feature creative solutions and learning in our review post.
Last but not least: there is no best solution, only learning more and better Python. Good luck!
Keep Calm and Code in Python!
-- Bob and Julian
Do you want to get 250+ concise and applicable Python tips in an ebook that will cost you less than 10 bucks (future updates included), check it out here.
"The discussions are succinct yet thorough enough to give you a solid grasp of the particular problem. I just wish I would have had this book when I started learning Python." - Daniel H
"Bob and Julian are the masters at aggregating these small snippets of code that can really make certain aspects of coding easier." - Jesse B
"This is now my favourite first Python go-to reference." - Anthony L
"Do you ever go on one of those cooking websites for a recipe and have to scroll for what feels like an eternity to get to the ingredients and the 4 steps the recipe actually takes? This is the opposite of that." - Sergio S