Skip to content

Latest commit

 

History

History
75 lines (56 loc) · 2.55 KB

README.md

File metadata and controls

75 lines (56 loc) · 2.55 KB

TicTacToe (Morpion) Game in C++ With VTK Library

This is a simple TicTacToe game implemented in C++ using the Visualization Toolkit (VTK). The game is played on a 3x3 grid of squares, and players take turns marking their symbol (Red or Blue) in an attempt to win the game.

UCA

How to Play

  1. Objective: The goal is to have three of your symbols (either Red or Blue) in a row, either horizontally, vertically, or diagonally.

  2. Starting the Game: Run the C++ program, and a graphical window will appear with a 3x3 grid of squares.

  3. Game Interface:

    • The grid consists of 9 squares, each represented by a number:
      1 | 2 | 3
      ---------
      4 | 5 | 6
      ---------
      7 | 8 | 9
      
      Or
      7 | 8 | 9
      ---------
      4 | 5 | 6
      ---------
      1 | 2 | 3
      
      It Depends on your keyboard :)
    • Players will take turns marking their symbol in a square by pressing the corresponding number on the keyboard.
  4. Turns:

    • Player 1 starts with Red symbols.
    • Player 2 follows with Blue symbols.
    • Alternately, players press the number key (1-9) to mark their symbol in the respective square.
  5. Winning the Game:

    • The game automatically detects a winner after each move.
    • A player wins if they have three of their symbols in a row (horizontally, vertically, or diagonally).
    • The winning player is announced, and the game resets for the next round.
  6. Scores:

    • The scores of Red and Blue players are displayed on the top of the window.
    • The score is incremented for the winner of each round.
  7. Restarting the Game:

    • After a round is complete, a new game automatically starts.
    • The scores are updated, and the grid is cleared for the next round.
  8. Exiting the Game:

    • Close the graphical window to exit the game.

Controls

  • Press the number keys (1-9) on the keyboard to mark the corresponding square.

Score Display

  • Red Player Score: Displays the score of the Red player.
  • Blue Player Score: Displays the score of the Blue player.

Additional Information

  • The game window includes a title and a welcome message.
  • The graphical interface is implemented using VTK for visualization.

Enjoy playing TicTacToe with VTK! For Any information, Contact Me : [email protected]

UCA