go back  12 - Build a Tic-tac-toe Game




This challenge write-up first appeared on PyBites.

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.

Details

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 ...)

Getting ready

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.

Archive

You can find all our code challenges so far here. If you have ideas for a future challenge or find any issues, please contact us or open a GH Issue.

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