0% found this document useful (0 votes)
14 views21 pages

Oop Microproject 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views21 pages

Oop Microproject 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Project Report On

“IMPLEMENTATION OF TIC-TAC-TOE GAME.”


For The Subject

OBJECT ORIENTED PROGRAMMING


Academic Year

2024 - 2025
Affiliated to
MAHARASHTRA STATE BOARD OF TECHNICAL
EDUCATION
Submitted in partial fulfilment of the requirement of the diploma of Information
Technology

GROUP MEMBERS

NO. Enrollment No. Name

1. 23112230392 SONALI S JADHAV


2. 23112230402 SHRADHA PADVAL
3. 23112230406 PRISHA PALKHE
4. 23112230414 RAJASHREE
KHANDAGALE
5. 23112230418 RASIKA VYAPARI

GUIDED BY MISS.
Tanuja Bhoir
MAHARASHTRA STATE BOARD OF TECHNICAL
EDUCATION, MUMBAI
CERTIFICATE

This is to certify that Ms.Sonali .S. Jadhav

Enrollment No . 23112230392 of Third Semester of Diploma in Information

Technology in G.V. ACHARYA POLYTECHNIC, SHELU has completed the

Microproject satisfactorily in Subject Object Oriented Programming in the academic

year 2024-2025 as per the MSBTE prescribed curriculum of K Scheme.

Place:- Shelu Enrollment No:- 23112230392

Date:- / / 2024 Exam Seat No:-

Project Guide Head of the Department Principal

Miss. Tanuja Mrs. Madhura Mrs. Madhura


Bhoir Mahindrakar Mahindrakar
MAHARASHTRA STATE BOARD OF TECHNICAL
EDUCATION, MUMBAI
CERTIFICATE

This is to certify that Ms. Shradha .K. Padval

Enrollment No. 23112230402 of Third Semester of Diploma in information

technology at GV ACHARYA POLYTECHNIC, SHELU has completed the

MicroProject satisfactorily in Subject Object Oriented Programming in the academic

year 2024-2025 as per the MSBTE prescribed curriculum of K Scheme.

Place:- Shelu Enrollment No.: - 23112230402

Date:- / / 2024 Exam Seat No.: -

Project Guide Head of the Department Principal

Miss. Tanuja Mrs. Madhura Mrs. Madhura


Bhoir Mahindrakar Mahindrakar
MAHARASHTRA STATE BOARD OF TECHNICAL
EDUCATION, MUMBAI

CERTIFICATE

This is to certify that Ms. Prisha .H. Palkhe

Enrollment No. 231122303406 of Third Semester of Diploma in Information

Technology at G. V. ACHARYA POLYTECHNIC, SHELU has completed the

MicroProject satisfactorily in subject Object Oriented Programming in the academic

year 2024-2025 as per the MSBTE prescribed curriculum of K Scheme.

Place:- Shelu Enrollment No.: - 23112230406

Date:- / / 2024 Exam Seat No.: -

Project Guide Head of the Department Principal

Miss. Tanuja Mrs. Madhura Mrs. Madhura


Bhoir Mahindrakar Mahindrakar
MAHARASHTRA STATE BOARD OF TECHNICAL
EDUCATION, MUMBAI

CERTIFICATE

This is to certify that Ms. Rajashree .S. Khandagale

Enrollment No. 23112230414 of Third Semester of Diploma in Information

Technology G. V. ACHARYA POLYTECHNIC, SHELU has completed the

MicroProject satisfactorily in Subject Object Oriented Programming in the

academic year 2024-2025 as per the MSBTE prescribed curriculum of K Scheme.

Place:- Shelu Enrollment No.: - 23112230414

Date:- / / 2024 Exam Seat No.: -

Project Guide Head of the Department Principal

Miss. Tanuja Mrs. Madhura Mrs. Madhura


Bhoir Mahindrakar Mahindrakar
MAHARASHTRA STATE BOARD OF TECHNICAL
EDUCATION,MUMBAI
CERTIFICATE

This is to certify that Miss. Rasika Subhash Vyapari

Enrollment No. 23112230418 of Third Semester of Diploma in

Information Technology at G. V. ACHARYA POLYTECHNIC, SHELU has

completed the MicroProject satisfactorily in Subject Object Oriented Programming

in the academic

year 2024-2025 as per the MSBTE prescribed curriculum of K Scheme.

Place:- Enrollment No:-23112230418

Date:- / / 2024 Exam Seat No:-

Project Guide Head of the Department Principal

Miss. Tanuja Mrs. Madhura Mrs. Madhura


Bhoir Mahindrakar Mahindrakar
CANDIDATES DECLARATION

This is to certify that the project titled “Implementation of tic-tac-toe game.” is a


bonafied work carried out by student of Diploma in Information Technology Engineering as
a part of curriculum as prescribed by MSBTE. I hereby declare that the project work has not
formed the basis for theaward previously of any Diploma, Associate ship, Fellowship or any
other similar title according to my knowledge.

Signature of Student
1.
2.
3.
4.
5.
ACKNOWLEDGEMENT

We extend our special thanks to all teaching and non-teaching staff. Success is nourished
under the combination of perfect guidance, care and blessing. Acknowledgement is the best
way to convey Last few years spend in estimated institution has moulded us into confident
and aspiring engineers. We express our sense of gratitude towards our project guide Miss.
Tanuja Bhoir It is because of her valuable guidance, analytical approach encouragement
that we could learn, work and complete the project. We will always cherish great experience
work under the enthusiastic guidance.

We are also grateful to our principal and our vice principal who not only supported us in our
project but also encouraged for every creative activity. We also sincerely give thanks to our
head of department Mrs. Madhura Mahindrakar of computer and its sector, friends and
well-wishers to directly or indirectly contribute for the success of our maiden mission.
INDEX

SR.NO. TITLE

1. AIM

2. MICROPROJECT PROPOSAL

3. INTRODUCTION

4. METHODOLOGY

5. CODE

6. OUTPUT

7. CONCLUSION

8. AREA OF IMPROVEMENT

9. REFERENCE
AIM

The primary objective of this microproject id to design and implement a


console based Tic-Tac-Toe game using Object Oriented Programming (OOP)
concepts .
MICROPROJECT PROPOSAL

BACKGROUND :

The Tic-Tac-Toe game implementation in C++ involves developing a console-based version


of classic player game, where players take turns marking "X" or "O" on a 3x3 grid. The
project demonstrates key C++ concepts such as arrays, loops, conditionals, and functions. It
requires logic to handle win conditions (rows, columns, diagonals), detect draws, and ensure
valid input. The project provides a hands-on approach to learning basic programming,
problem-solving, and modular code design.

INTENDED COURSE OUTCOME :

The intended course outcome for the Tic-Tac-Toe game implementation in C++ is to help
students fundamental programming concepts like arrays, loops, and conditionals while
developing problem-solving skills through game logic. By creating modular functions and
handling user input with validation, students will gain experience in writing clean,
maintainable code. This project provides a practical understanding of C++ by building a
simple console-based game.

LITERATURE REVIEW :

The literature review for the Tic-Tac-Toe game implementation in C++ explores various
approaches to building interactive games using basic programming constructs. Studies on
game algorithms, such as the minimax algorithm, have shown how game AI can be enhanced
to make optimal decisions. However, for simpler, two-player versions of Tic-Tac-Toe,
research primarily focuses on efficient use of arrays or matrices to represent the game board,
and the application of conditional statements to check for winning or draw conditions. Prior
implementations emphasize modularity, using functions to break down tasks like user input,
move validation, and game state checks, demonstrating effective programming practices in
C++.
INTRODUCTION

The Tic-Tac-Toe game implementation project in C++ is designed to help students apply
their knowledge of fundamental programming concepts by developing a simple yet
interactive console-based game. Tic-Tac-Toe is a well-known two-player game where each
player alternates marking "X" or "O" on a 3x3 grid, with the goal of aligning three marks in a
row, column, or diagonal. This project allows students to dive into key aspects of C++
programming, such as working with arrays to represent the game board, using loops and
conditionals to manage game flow, and implementing functions to promote modularity and
code reuse. It provides a practical environment where students can practice input validation,
error handling, and managing user interactions, ensuring the game runs smoothly. By
breaking down the game logic into manageable tasks—such as checking for a win or draw,
ensuring valid moves, and switching between players—students gain valuable experience in
problem-solving and algorithmic thinking. Furthermore, the project introduces the concept of
structuring code efficiently, reinforcing good programming habits that are essential for more
complex software development. Ultimately, this project serves as a foundational step toward
mastering C++ by blending theory with a fun and interactive coding experience.
METHODOLOGY

This Micro project based on C++language has been completed and performed by the
involvement of all the group members. All the group members had performed and done their
work correctly.

Works performed by group members individually are:

1. Sonali jadhav provided information for micro project and worked upon
certificates,Aim and Introduction.

2. Shradha Padval provided information for the micro project and worked on
program of the microproject.

3. Prisha Palkhe provided information for the micro project and has worked on action
plan and application of these micro project.

4. Rajashree Khandagale provided information for the micro project and provided
information about the skills developed.
5.

5. Rasika Vyapari has worked upon editing like alignment,chronological order


and soft copy structures.

RESOURCES REQUIRED

Sr. Name of Resources Specifications Quantity Remarks


No
1. Computer System Windows 10 1
8.00 GB
2. Software Turbo C 1
3. Any other resource Mobile
Used
CODE

#include <iostream>
using namespace std;

// TicTacToe class
class TicTacToe {
private:
char board[3][3]; // 3x3 board
char currentPlayer;

public:
// Constructor to initialize the board and set the first player
TicTacToe() {
currentPlayer = 'X';
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
board[i][j] = '1' + i * 3 + j; // Fill board with numbers 1-9
}
}
}

// Function to display the board


void displayBoard() {
cout << "\n";
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
cout << board[i][j] << " ";
}
cout << "\n";
}
cout << "\n";
}
// Function to switch the player after each move
void switchPlayer() {
currentPlayer = (currentPlayer == 'X') ? 'O' : 'X';
}

// Function to make a move


bool makeMove(int position) {
int row = (position - 1) / 3;
int col = (position - 1) % 3;

if (board[row][col] != 'X' && board[row][col] != 'O') {


board[row][col] = currentPlayer;
return true;
} else {
cout << "Position already taken! Try again." << endl;
return false;
}
}

// Function to check if there is a winner


bool checkWin() {
// Check rows, columns, and diagonals
for (int i = 0; i < 3; ++i) {
if (board[i][0] == board[i][1] && board[i][1] == board[i][2])
return true;
if (board[0][i] == board[1][i] && board[1][i] == board[2][i])
return true;
}
if (board[0][0] == board[1][1] && board[1][1] == board[2][2])
return true;
if (board[0][2] == board[1][1] && board[1][1] == board[2][0])
return true;
return false;
}

// Function to check if the board is full (draw)


bool checkDraw() {
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
if (board[i][j] != 'X' && board[i][j] != 'O')
return false; // If any cell is not filled, it's not a draw
}
}
return true; // If all cells are filled, it's a draw
}

// Function to start the game


void play() {
int position;
bool gameWon = false;

cout << "Welcome to Tic-Tac-Toe!" << endl;


displayBoard();

while (!gameWon && !checkDraw()) {


cout << "Player " << currentPlayer << ", enter your move (1-9): ";
cin >> position;

if (position >= 1 && position <= 9 && makeMove(position)) {


displayBoard();

if (checkWin()) {
cout << "Player " << currentPlayer << " wins!" << endl;
gameWon = true;
} else if (checkDraw()) {
cout << "It's a draw!" << endl;
} else {
switchPlayer(); // Switch to the next player
}
} else {
cout << "Invalid move! Please enter a valid position." << endl;
}
}
}
};

// Main function
int main() {
TicTacToe game; // Create a TicTacToe game object
game.play(); // Start the game
return 0;
}
OUTPUT
CONCLUSION

In conclusion, the Tic-Tac-Toe game implementation project in C++ offers a comprehensive


introduction to fundamental programming principles while engaging students in a practical
application of these concepts. Through the development of this simple yet classic game,
students not only strengthen their understanding of arrays, loops, conditionals, and functions
but also enhance their problem-solving and logical thinking abilities. By modularizing the
code into smaller, reusable components, students learn the importance of writing clean,
organized, and maintainable programs—skills essential in more advanced software projects.
The project further emphasizes user input handling, ensuring that players can interact with the
game seamlessly while enforcing input validation to avoid errors. This experience with
building a functional and interactive game helps students bridge the gap between theoretical
learning and real-world coding. Overall, this project serves as an ideal foundation for students
to apply their knowledge in C++ and develop a deeper understanding of how programming
concepts come together to create complete software applications.
AREA OF IMPROVEMENT

While the Tic-Tac-Toe game implementation project effectively introduces fundamental


programming concepts, there are several areas for improvement. One enhancement could be
the addition of an AI opponent using algorithms like minimax, allowing players to compete
against the computer, which would deepen understanding of algorithmic thinking. Another
improvement could involve expanding the game to support larger grids or different game
variations, increasing complexity and engagement. Additionally, implementing a graphical
user interface (GUI) could make the game more user-friendly and visually appealing. Lastly,
incorporating unit tests and debugging practices would help students learn about software
testing and improve code reliability.
REFERENCE

https://www.geeksforgeeks.org/tic-tac-toe-game-in-cpp/

https://guiprojects.com/c-tic-tac-toe-game-project/

https://www.scaler.com/topics/tic-tac-toe-cpp/

You might also like