COM1001 – (Solution)

$ 29.99
Category:

Description

COMPUTER ENGINEERING DEPARTMENT
Computer Programming 1
Lab9
Assoc. Prof. Dr. Hacer YALIM KELEŞ
Corresponding Assistants: Yahya Doğan, Özge Mercanoğlu Sincan
In this lab, you are expected to create a TicTacToe game using the graphics.py module, which you can download from the course page. In Figure 1, we provide the design of the TicTacToe; you will try to create your user interface similar to the provided image. The metrics in the image are pixels. Your program should not get any run-time errors, under any circumstances. For this reason, you need to consider all possible conditions.

Figure 1: Simple TicTacToe GUI

Specification details:
1. The game is played on a grid that’s 3 squares by 3 squares.
2. You are X, the computer is O. Players take turns putting their marks in empty squares.
3. Firstly, you will start the game and put ‘X’ by clicking on the empty squares with the mouse. Then the computer randomly selects an empty square and puts an ‘O’. This goes on until the game is over.
4. The player who brings 3 letters together up, down, or diagonally first wins and the game is over (Figure 1a, Figure1b). When all 9 squares are full and if no player has 3 marks in a row, column or diagonal, the game ends in a draw (Figure 1c).
5. You have to check if the clicked square is empty. If player X clicks on a filled square (on X or
6. When someone wins the game, new moves will not be allowed, e.g., new clicks on remaining empty squares will be ignored.
7. The GUI name will be your student id. So you should write your id where it is written TicTacToe in Figure 1.
8. When someone wins the game or ends a draw, pressing ‘q’ closes the window.

Figure 2. Invalid move example: click on a filled square Testing: You do not need to use input and output files in this assignment.
> python3 Lab9.py
Submission:
1- Name your Python source file as <student_id>.py; replace <student_id> using your student id number.
2- Upload your python file using the interface provided in e-kampüs course page.
3- Do not upload any files, other than your source file.

Important:

Please ask, if you have any questions related to the Lab9 specifications, send an e-mail to Yahya Doğan (yahyadogan@ankara.edu.tr) or Özge Mercanoğlu Sincan (omercanoglu@ankara.edu.tr)

Have fun 🙂

Reviews

There are no reviews yet.

Be the first to review “COM1001 – (Solution)”

Your email address will not be published. Required fields are marked *