Python programming. Advanced

e-Learning group/community All Groups

View all challenges in the group Python programming. Advanced

Group challenge - Improve your Tic-tac-tou code using Object-Oriented Python

Completed: 0 (%0), Skipped: 0 (%0)
0
0

Next step is to modify our game created with Python to be able to share the logic of the game with other members/projects.

Our initial program , most probably, was created as one py file with using functions. Someone "experienced" could use classes.

Now we all will modify our program with using classes.

 

The task.

Modufy your Tic-tac-tou program to split the login and a user interface.

Create 2 classes as separate modules.

One is Tictaktou class. It has  logic of the game. It contains a state of a game, checks for a vinner etc. It doesn't print something. 

The second class is PCGamer. It contsins a logic of a computer player. It is used only in a mode "Human vs Computer". This class uses Tictaktou class to do moves.

And the 3-rd (main) script implements a user interface, an interface can be same as before (command line etc)