4X4 tic-tac-toe game- final project

Hi everybody, so like you could have guesseed, I finished my first project as part of the CS career path.
Have no idea if it’s good or bad, since I did it all by myself without any instructions- which I am happy to say.

It’s small, has lots of non-pythonic code, and a loooot of room for improvement, but it’s done.

It’s a super-simplistic tic-tac-toe program, for 4X4, implemented at the terminal.
The user gets to choose the easy vs. difficult versions: the first is just random selection of a move while the latter is a kind of very simplistic algorithm I came up with that says:

  1. First priority is not to lose, so if the oponent is 1 move away from victory- we’ll block the,.
  2. If not- we’ll add our X or O to the line/col/oblique that has the most of our sign.

I had some dillemas of which data structures to use and whether there are more efficient ways to implement the conditions, but overall, it was nice to see that in the ‘difficult’ version I am unable to beat the computer (always ends up with a draw).


Conclusions and what I’ve learnt:

  1. Carrying out the first program that I did from scratch without any help.
  2. Performing the full git ‘cycle’, so that this project is now in my github. That took some time but finally worked.
  3. Using the terminal, for the first time not only partially as an excercise, but rather as an intergral part of the project.
  4. The time.sleep() function + the fact that I need to do flush=True when printing to the terminal if I want the bits of text to be printed gradually and not one at a time.
  5. Using an IDE (VScode) and integrating it with the terminal. I’m still getting used to it (have worked on Jupyter notebook before and it’s a completely different experience). It is packed with so much real-time info that still confuses me a bit (I’m actively ignoring all the data that’s presetned once I open a parantheses) but it’s really nice to see how it helps with identation and with finding problems in the code. Is that legal??? :stuck_out_tongue:
  6. Overall, there seems to be so much to learn that I sometimes feel I will never get it. On the other hand, building such a program just several weeks ago would have seemed also not possible, so who knows…

That’s it for now.
If anyone has any feedback I’d be happy to hear (Looking again at the code it looks like a mess so be gentle :slight_smile: )