
Configure a tic tac toe game with artificial intelligence in Qt C++, supporting two-player and AI modes, with game side from 3 to 10 and easy or hard AI.
Follow this course structure as an incremental, step-by-step journey that builds on each video. Replicate what’s shown, understand the progression, and complete assignments to extend the Tic-Tac-Toe AI game.
Download and install Qt Creator for the Tic-Tac-Toe game with AI project, choosing your operating system, running the online installer, and completing the setup.
Create a tic tac toe with ai project in Q Decorator, set up a blank window, and learn how the widget base class and app loop render and run it.
Explore how the project file drives a Qt C++ build, lists modules such as core, gooey, and widget, and defines cpp 17 and auto-adds sources and headers.
Create a three-by-three tic tac toe board by arranging a 3x3 grid of push buttons in a grid layout on the window, and add them to the board list.
Implement a reset board function for tic-tac-toe by looping through all board buttons and clearing their text, enabling quick replay on 3x3 or 5x5 grids.
Define a two-value player enum (player one, player two), add a player attribute to the Tic-Tac-Toe widget, and implement simple getters and setters for the current player.
Map each tic tac toe button to its board index with a Q signal mapper, then connect clicks to a slot to identify the clicked button.
Implement and test the handle-click logic for tic-tac-toe in Qt C++, validating board indices, ensuring empty buttons, and updating X or O while switching the current player.
Decorate the tic tac toe board by refactoring the click handler, storing the symbol in a QString, and styling the clicked QPushButton with bold font, color, and a disabled state.
Create an enum to represent the winner in the tic tac toe game with AI, including player one, player two, draw, and no winner yet, to signal outcomes.
Implement the determine_winner function for tic-tac-toe, performing a horizontal check by deriving row and column from the clicked button, traversing forward and backward to confirm a win.
Complete the winner-detection logic by implementing the vertical check, swap turns when no winner, and disable the board on a win, with symbols refactored as constants.
Explore implementing the vertical winner check for tic-tac-toe in Qt C++. Calculate the move’s row and column, scan upward and downward for matching symbols, and determine the winner.
This video implements the backslash diagonal check to determine the tic-tac-toe winner in Qt C++, refactoring to a single diagonal length and checking upward and downward positions.
Implement the forward slash diagonal win check for tic-tac-toe by tracing diagonal moves upward and downward, updating new row and column, and counting matching symbols to declare a winner.
Implement draw detection in the tic-tac-toe Qt app by iterating all board cells, checking for empty spaces, and printing draw game when no winner remains.
Handle win or draw in the tic tac toe game by disabling the board, freezing for three seconds with a single shot timer, and signaling the end-of-game ui.
Implement end of game handling in a Qt C++ tic-tac-toe game by clearing the board, removing widgets from layout, showing win or draw message for three seconds, and enabling restart.
Create a vertical layout to announce outcome, center widgets, and color the winner label and restart button blue for player one, red for player two, or purple for a draw.
Finish end-of-game handling by styling the restart button and label, enabling the tic tac toe board, and wiring the restart button to the restart game slot in Qt.
Implement a restart function that sets the first player to Leo, clears and recreates the tic-tac-toe board, and re-enables play with a two-second freeze time.
This lecture demonstrates creating a tic tac toe game configuration window in Qt Designer, configuring game name, players, and game size, and selecting AI or two player mode.
Configure mandatory player names in the tic tac toe Qt project. Link line edits to an update slot that enables the okay button when both names are entered.
Create setters and getters for player names in the Qt game config, wiring line edits to update and retrieve names with setText and getText, then test in main.
Apply the singleton pattern to the game configuration class to ensure only one instance exists. Implement a static getInstance method, private constructor, and proper initialization and usage in main.
Configure the game side by creating setter and getter and define a min and max range. Sync the spin box and slider via signals and slots to keep values consistent.
Set the default two-player mode in the game configuration UI, rename the radio buttons, and emit signals on OK based on which mode is checked.
Create main window in Qt designer, add and name player labels, and style two player labels in code with Liberation Serif, blue for player one and red for player two.
Promote the tic tac toe board to the main window, set an 800x700 size, center widgets, and create start and quit actions with icons in a toolbar and menu.
Enable the start new game and quit game actions in the main window, using signals and slots to open a configuration dialog, reset player names, and set the game size.
Finish implementing the start new game flow by wiring the configuration to set the tic tac toe board size and launch the game.
Learn how to center all widgets in the main window by using layout alignment to set horizontal and vertical centering, even for small widgets, in a Qt C++ tic-tac-toe project.
Implement a slot that bolds the current player's name in the tic-tac-toe Qt C++ game by adjusting the label's font bold property based on the current player.
Implement a two-stage mechanism to determine the game outcome. Connect the finish signal to a slot that fetches the winner or draw and updates the UI label.
Fix restart width bug in tic tac toe by resetting the board width with constants and a data struct. Emit change player signal to highlight the starting player.
This practical course aims at teaching you step by step how to create a game using C++ and Qt. C++ is a very powerful programming language very suitable for making games, whilst Qt is a very large graphical user interface (GUI) framework fully based on C++. In this course you learn how to practically use C++ to create a GUI application and you also learn how to use and get familiar with the very powerful Qt framework.
The first aim of the course is to teach you how to plan a game. Essentially, you are going to learn how to turn your game ideas into Game Requirements for your Game application. You also learn how to meticulously organise them so as to be able to implement them incrementally, in a logical manner.
Secondly, you thoroughly learn about the Qt framework. Essentially, you learn how to navigate the massive documentation of the Qt framework, in order to be able to get the functionality that you need for your Game. Additionally, you learn step by step how to create a beautiful, coherent, and interactive graphical user interface with the Qt framework.
Thirdly, you methodically learn how to implement Game Logic using C++. Essentially, you finally become able to apply the theory of C++ in an actual GUI application, in order to create a very entertaining TicTacToe Game. Quite simply, you learn how to practically use concepts like selection control structures, repetition control structures, functions, pointers, references, classes, objects, lifetime of objects, inheritance, polymorphism, etc.
Fourthly, you learn how to add Artificial Intelligence (AI) to a Game Logic. Essentially, in this course, you learn how to create AI opponents that a human player can play against. You first learn how to create a weak AI opponent that a human player can easily defeat. Then you learn, step by step, thoroughly, how a tough AI opponent can be created, how it can be made to be very smart, and therefore very hard to defeat.
Finally, you get to have a go at the TicTacToe Game by yourself. Essentially, at the end of the course, you get a couple of Assignments where your tasks are about ameliorating and extending the Game. This is a means for you to test how much you have understood from the course.
Regarding the course itself, it is structured in a way that one section builds upon the previous ones. So this is essentially to tell you that not every section adds something new in the user interface or in the game logic. The sections are all interconnected, and in order to create the TicTacToe Game exhibited in the introduction video, you will have to go through the entire course, one video after the other.
I wish you a pleasant time as you navigate through the course.
Happy learning,
Alex