Announcements:
You must work with a new partner this week, someone with whom you have not been a partner in the past.
After you have finished your quiz, if you have not already done so use this google form to enter your information and acknowledge that you have read the Academic Honesty policy on the course web site, and that you agree to abide by it.
After taking the quiz select the one computer you will use between the two of you as you take turns being the driver (typing) and navigator (watching / suggesting).
Quiz:
The quiz will be available during the first 5 minutes of lab:
Your lab TA will tell you the password you will need to get into the quiz for your section.
You may use either one of the lab machines or your own laptop. For the lab computers your account name and password are the same as your UIC netid and password.
From this week on, we switch to the blackboard for the quizzes. Please go to blackboard, choose this course, then click on 'Quizzes' on the left-hand side menu.
Lab Exercise:
You have been given part of the code (in main() and some function declarations) but will need to add code in several functions to implement the game of Tic-Tac-Toe. The starting point for this lab exercise can be found in section 4.31 of Zybooks.
Since we have not yet discussed parameter passing in C++ when using functions, just for this program we will use global variables, even though using global variables in your programs is strongly discouraged and usually will lead to point deductions.
The game starts by player 'X' selecting a move position. Players alternate on every move, until someone wins (with three in a row) or the board is filled and the game is a draw. Running the program should look like the following, where user input is shown below in bold:
Welcome to the TicTacToe game!
Take turns entering the position (1..9)
into which your piece will be placed.
Enter '0' (zero) to exit.
-------
| | | | 1 2 3
-------
| | | | 4 5 6
-------
| | | | 7 8 9
-------
1. Enter the move (1..9) for X: 1
-------
|X| | | 1 2 3
-------
| | | | 4 5 6
-------
| | | | 7 8 9
-------
2. Enter the move (1..9) for O: 3
-------
|X| |O| 1 2 3
-------
| | | | 4 5 6
-------
| | | | 7 8 9
-------
3. Enter the move (1..9) for X: 4
-------
|X| |O| 1 2 3
-------
|X| | | 4 5 6
-------
| | | | 7 8 9
-------
4. Enter the move (1..9) for O:
-------
|X| |O| 1 2 3
-------
|X| | | 4 5 6
-------
|O| | | 7 8 9
-------
5. Enter the move (1..9) for X: 5
-------
|X| |O| 1 2 3
-------
|X|X| | 4 5 6
-------
|O| | | 7 8 9
-------
6. Enter the move (1..9) for O: 6
-------
|X| |O| 1 2 3
-------
|X|X|O| 4 5 6
-------
|O| | | 7 8 9
-------
7. Enter the move (1..9) for X: 9
-------
|X| |O| 1 2 3
-------
|X|X|O| 4 5 6
-------
|O| |X| 7 8 9
-------
Congratulations player X. You WON!
Exiting program...
Do not edit the code in main(). The code in main() calls various functions. You must complete the code in these functions so that the game works properly.
Step 1: (1 Point)
Complete the function displayBoard(). It should use the board variables to display the board.
Step 2: (1 Point)
Complete the function makeMove() which allows the user to make a move. It should prompt for user input, read in the user input number, and change to appropriate board variable.
Step 3: (1 Extra credit Point)
Complete the checkBoard() function that checks for a win after every turn. A win can be three of the same kind on any row, column, or diagonal.