Students Activity 2

In this activity you are required to implement the following additions to the tic-tac-toe code you submitted in Students Activity 1:

  • Integrate the win detection code described in Phase 2 to identify the winning player.

  • You will enhance the game code by including Object Oriented Coding principals. To do this, you will create a Player class. Each player has the following attributes: nick- name, symbol, experience level (1, 2, 3 or 4), total games played, and points. The symbol will identify each player's symbol (X or 0), experience level should be one of the three values, where 1 is beginner, 2 is intermediate, 3 is advanced and 4 is expert. Points attribute would keep track of how many games this player won (1 point for each winning game).

In the Player class, add the necessary constructor to instantiate a player object, add the necessary getters and setters. In the class, add the method calculate_experience() that would calculate the player's experience level. The experience level is set to 1 if the player wins 3 consecutive games. The level will be 2 if the player wins 5 consecutive games. Level 3 is earned if the player wins 7 consecutive games and level 4 is 10 consecutive wins. The wins need to be consecutive, each time the player looses a game, the experience level goes back to beginner.The main part of the code should allow each player to create his own profile (i.e. create his own player object). Initially each player will start as a beginner player. The player is allowed to play as many times as he wants (either against another player or the computer player). Each time the player wins or looses a game, the calculate_experience() method will either promote the player to a higher level or demote the player to a lower level. After each game, the program should display the current players' experience levels.

Extra Credit:

For extra credit of 10 points, add a list of different players, allow the gamer to choose from the list of players which player he/she would like to play with. For example, when the game starts a list of all players' profiles are displayed:

1- Nick name: TicToe, experience level: 1, symbol: X, wins: 2

2- Nick name: theBestGamer, experience level: 3, symbol: 0, wins 8

3- Nick name: huskyPlayer, experience level: 2, symbol: X, wins 5

Select the player you'd like to play with by entering the player number.

For extra credit of 30 points, increase the complexity of Tic-Tac-Toe by implementing a 4x4 game board.

4 x 4 Tic-Tac-Toe​

Last updated

Was this helpful?