Skip to content

whitcr/tictactoe5x5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

                                                ABOUT GAME AND CODE

Tic-tac-toe is a simple game that can be played with two players or against a computer. The objective of the game is to get N(some number) of your symbols (either X or O) in a row, either horizontally, vertically, or diagonally on the game board. The game board could be 3x3, 5x5, 7x7 or other grid, and each cell on the grid can be empty or contain an X or an O.

To play the game, first, select the game mode and board size on the start menu. Then, the game board will be initiated, and you will be prompted to make a move. To make a move, you will be prompted to enter the row and column coordinates where you want to place your symbol. For example, if you want to place your symbol on the top-left corner of the board, you would enter "1 1".

The game will continue until either one of the players gets N of their symbols in a row and wins the game, or the game board is full, and the game is a draw.

The game will then print the result and prompt the player if they want to play again.

It's important to note that in this code the size of the board can be modified, so the player can play on a board of different sizes.

                                                  MORE ABOUT CODE

This code is a Tic-Tac-Toe game written in C++. It utilizes the iostream, conio.h, stdlib.h, and Windows.h libraries. The program has a start menu that allows the player to select the game mode (player vs player or player vs computer), the board size, and the player's names. The game board is represented by a 2D array of characters, and the program includes functions to initiate and print the board, as well as handle user input and game logic. It also uses the HANDLE and SetConsoleTextAttribute functions from the Windows.h library to change the color of the text in the start menu. A little bit about function:

startMenu(): displays the start menu to the player and allows them to select the game mode, board size, and player names. initiateBoard(): initializes the game board by filling it with the '-' character. printBoard(): prints the current state of the game board to the console. handleInput(): handles user input, placing the player's chosen symbol on the game board and updating the move counter. checkForWin(): checks if a player has won the game by getting three of their symbols in a row, column, or diagonal on the game board. computerMove(): if the game mode is set to player vs computer, this function will handle the computer's move.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages