CPTR 124 Fundamentals of Programming

In this lab you will restructure your Tic-Tac-Toe game engine and GUI to so that your program becomes object oriented.

  1. Teams

    You may work with a partner for this lab. You and your partner should begin thinking about the problems and begin writing the code before lab time.

  2. Set up

    Copy your Tic-Tac-Toe game engine module and its associated graphical interface to a new folder. Do not modify your original code! You should be doing all your work on copies. If you are working with a partner, select either your code or your partner's code to modify.

  3. Game logic objectification

    Restructure the code in your tttlogic.py file so that it contains no global variables and no free functions. This requires you to wrap your existing global variables and functions within a class definition. All your global variables will become instance variables, and all your free functions will become methods.

    Important: Your changes should not involve modifying any logic, unless you discover latent bugs. Your code should end up working exactly as it did before. Do not throw away all the hard work you already have completed!

  4. Graphical interface adaptation

    Adapt your graphical interface to use your new, object-oriented game engine. This means your GUI no longer will call functions from the game engine module; instead, your GUI will create an instance of your game engine class and exercise its methods.

  5. Check out

    Your finished code will be evaluated for correctness and compliance. After the check off you should submit both your game engine and GUI modules to http://eclass.e.southern.edu.