Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

CHAPTER 1

INTRODUCTION
1.1 GENERAL

Whereas in general game theory methods, say min-max algorithm, the algorithm always
assume a perfect opponent who is so rational that each step it takes is to maximize its reward and
minimize our agent reward, in reinforcement learning it does not even presume a model of the
opponent and the result could be surprisingly well.

By considering the opponent as part of the environment which the agent can interact with,
after a certainamount of iterations, the agent is able to plan ahead without any model of the agent
or environment, or conducting any search of possible future actions or states. The advantage is
obvious in that the method saves the effort of complex mathematical deduction or exploration of
a large number of search spaces, but it is able to achieve state-of-art skill by simply trial and
learning.

1.2 OBJECTIVE:

In a game project, the product is a game. But here comes the point: Agame is much more
than just its software. It has to provide content to become enjoyable. Just likea web server:
without content the server is useless, and the quality cannot be measured. This hasan important
effect on the game project as a whole. The software part of the project is not the onlyone, and it
must be considered in connection to all other parts: The environment of the game, thestory,
characters, game plays, the artwork, and so on.

1.3EXISTING SYSTEM:

Since the 1970s [10], people started to take interest in using their computers as an
entertainment environment, thus, the multibillion game industry [3] was starting to take shape.
Having presented earlier the sum of money this industry produces; I decided to have a go and
create a game of my own. As a kid, I was always fascinated by the idea of becoming a game

1
developer, but, as years went by, I have realized this is not exactly what programming and
computer science, as a practice, are about and I dropped the idea. However, the third-year project
offered me the possibility to try and achieve one of my childhood’s dreams and I couldn’t resist
the temptation.

1.4LITERATURE SURVEY

1.4.1Title: E. Kaplan, "Interactive tic-tac-toe slot machine

Author: ED Google Patents,

Year: 2020

Description: Tic-Tac-Toe game is an easy game which is mostly played among children and it
also helps them to improve their concentration. The objective of this tic-tac-toe game python
project is to build a tic-tac-toe game so you can play it without wasting paper and improve your
concentration. To build this game we use the tkinter module with the concept of python. To play
this game we require two players to play one is X and the other is O and both players play by
putting their marks in empty squares. To win the game players have to get 3 of her marks in a
row (up, down, across, or diagonally).

Project Prerequisites

To build tic-tac-toe game using python we require tkinter module and basic concept of python

Tkinter modules is a standard graphical user interface used to render graphics.

Tkinter.messagebox used to display message box

To install tkinter modules we used pip install command on command prompt:

2
1.4.2 Title: Electronic tic-tac-toe game having three function control

Author: D. B. Klitsner and B. P. Clemens

Year: 2019

Description:

A game apparatus includes a housing supporting a three by three grid of tic-tac-toe game
play squares. The housing further supports a pivot able multi-function launch control which
provides three game function inputs to the game microprocessor. The display further includes a
trio of paths for each of the three columns in the tic-tac-toe square array. The game simulates
launch of a game object down one of the paths selected by pivotal movement of the launch
control to attempt marking a particular square in the tic-tac-toe array. The launch control
includes a depressible launch button which performs a second function of setting game object
launch power and a third function of triggering game object simulated launch. FIELD OF THE
INVENTION. This invention relates generally to electronic games and particularly to those
electronic games which are configured to play the game of tic-tac-toe.

1.4.3 Title: "Combination tic-tac-toe and question and answer game"

Author: R. P. Turner

Year: 2019

Description:

Embodiment of a game board with a playing surface divided into at least nine squares.
There are a plurality of writing/playing cards of at least two sets that have an X on the back of
one set and an O on the back of the other set. The writing/playing cards have a writing surface on
the front of both sets in which players write words to complete fill-in-the-blank sentences. The
back of the writing/playing cards, which are marked with an X or an O, is utilized to participate
in playing the game of “Tic-Tac-Toe” after a correct response is given for the fill-in-the-blank
sent
1. A game apparatus which comprises:

3
(a) means for forming nine tic-tac-toe arrangements in a square pattern, each said tic-tac-toe
arrangement being labeled as a different subject area, said forming means including a playing
board having a plurality of apertures;

(b) a plurality of playing cards having questions and answers to said questions, said questions
and said answers being of grade level in difficulty, said playing cards having consecutively
numbered questions and answers;

(c) a holder for setting up said playing cards;

(d) means for scoring when said correct questions are answered until three said tic-tac-toe
arrangements are won in a vertical, horizontal, diagonal row to completely win said game, said
scoring means including two different sets of playing pieces used by each player by placing each
said playing piece into one of said apertures on said playing board; and

(e) means for randomly choosing one of said numbered questions to be answered by one of said
players, said randomly choosing means further comprising two dice being of one color so that
when rolling said dice they will occupy the tens and hundreds place with lower die number
always going to said hundreds place, and one die being of another color so that when rolling said
die it will always occupy the ones place, thus three said dice will indicate a three digit number
corresponding to one of said numbered questions on one of said playing cards.

1.4.4 Title: Three-dimensional tic-tac-toe game

Author: S. C. Raphael, A. S. Raphael, and R. R. King,

Year: 2018

Description:

3D tic-tac-toe, also known by the trade name Qubic, is an abstract strategy board game,
generally for two players. It is similar in concept to traditional tic-tac-toe but is played in a
cubical array of cells, usually 4x4x4. Players take turns placing their markers in blank cells in the
array. The first player to achieve four of their own markers in a row wins. The winning row can
be horizontal, vertical, or diagonal on a single board as in regular tic-tac-toe, or vertically in a
column, or a diagonal line through four boards.

4
1.4.5 Title: Gaming machine with pattern-driven bonus array

Author: P. R. Anderson, J. D. Flint, J. J. Giobbi, S. P. Joshi, and E. A. Frohm.

Year: 2017

Description:

A game of chance is played on a gaming machine controlled by a processor in response to a


wager. The game includes an array of locations displayed on a video display and individually
selectable by a player and the processor. The player and the processor make alternating
selections of unoccupied ones of the locations in the array for placement of respective first and
second symbol types. The probability of using a winning strategy for the selections by the
processor increases with successive ones of the selections by the processor so that the processor
appears to become more intelligent as the game progresses. A payout is awarded to the player
based on the outcome of the game.

5
1.4 PROPOSED SYSTEM

The Tic Tac Toe game is a game for two players, called "X" and "O", who take turns marking
the spaces in a 3×3 grid. The player who succeeded in placing three respective marks in a
horizontal, vertical, or diagonal row wins the game. The Tic Tac Toe is a great way to pass your
free time whether you're standing in a line or spending time with your kids. Stop wasting paper
and save trees. Because of the simplicity of Tic Tac Toe, it is often used as a pedagogical tool for
teaching the concepts of good sportsmanship and the branch of artificial intelligence.

6
CHAPTER 2

PROJECT DESCRIPTION

2.1 GENERAL:

Game development in the future is hard to predict. In general a software project is a project
focusing on the creation of software. Consequently, Success can be measured by taking a look at
the resulting software. In a game project, the product is a game. But here comes the point: A
game is much more than just its software. It has to provide content to become enjoyable. Just like
a web server: without content the server is useless, and the quality cannot be measured. This has
an important effect on the game project as a whole. The software part of the project is not the
only one, and it must be considered in connection to all other parts: The environment of the
game, the story, characters, game plays, the artwork, and so on

2.2 METHODOLOGIES

2.2.1MODULES NAME:
A. TICTAC GAME
B. MOTIVATION
C. CONTRIBUTION

A. TICTAC GAME

Tic-Tac-Toe was additionally utilized by understudies to exhibit the computational energy of


Tinker toy components. The Tinker toy PC, made out of (nearly) just Tinker toys, can play Tic-
Tac-Toe flawlessly. It is right now in plain view at the Museums. Chess and Tic-Tac-Toe are one
of the most famous games to which the moves are not left to chance, rather than pure
mathematics and logical reasoning. In these games, a player wins by achieving a winning
configuration first, like for instance: checkmate in chess, and 3-in-a-row in a basic Tic-Tac-Toe
game in 3x3 boards[6]. In order to find a winning strategy, in theory all the paths could be
explored. However, in practice this is not easy because the total number of strategies can be
calculated using a double exponential function of the size of the board. This is because each cells
has 3 options; Marked by the first player, Marked by the second player[5][6]

7
B. Motivation

To develop a Tic-Tac-Toe 4X4 game for two players can come together and play for fun
using computerized interfaces as well as automatic AI computerized games. b. To develop a
game that help a user to think fast when a problem occurs as well as to think and communicate.

C. Contributions

This is critical on the grounds that there are new calculations building up each day, along
these lines the requirement for ideal and less intricate calculations has turned out to be essential.
Our commitments to the Tic-Tac-Toe issue can be condensed as follows; (1) we are considering
diverse ways to deal with the issue. (2) Building up an ideal calculation to take care of the issue.
(3) Improving the effectiveness of the calculation while keeping up polynomial time
multifaceted nature. This examination might be useful in enhancing the many-sided quality and
giving ideal answers for comparable issues.

2.3TECHNIQUE USED OR ALGORITHM USED

2.3.1 EXISTING TECHNIQUE:-

Since the 1970s [10], people started to take interest in using their computers as an entertainment
environment, thus, the multibillion game industry [3] was starting to take shape. Having
presented earlier the sum of money this industry produces; I decided to have a go and create a
game of my own. As a kid, I was always fascinated by the idea of becoming a game developer,
but, as years went by, I have realized this is not exactly what programming and computer
science, as a practice, are about and I dropped the idea. However, the third-year project offered
me the possibility to try and achieve one of my childhood’s dreams and I couldn’t resist the
temptation

2.3.2 PROPOSED TECHNIQUE:-

The Tic Tac Toe is a great way to pass your free time whether you're standing in a line or
spending time with your kids.

8
CHAPTER 3

REQUIREMENTS ENGINEERING

3.1 GENERAL

The interpretation of the handwriting character by developing techniques and methods such as
improvement of character classification techniques. The accurate and rapid classification for
accurate information retrieval, sound classification, stock price forecasting.

3.2 HARDWARE REQUIREMENTS

The hardware requirements may serve as the basis for a contract for the implementation of the
system and should therefore be a complete and consistent specification of the whole system.
They are used by software engineers as the starting point for the system design. It shouls what
the system do and not how it should be implemented.

● Processor - Pentium –IV


● Speed - 1.1 GHz
● Ram - 256 MB
● Hard Disk - 20 GB
● Key Board - Standard Windows Keyboard
● Mouse - Two or Three Button Mouse
● Monitor - SVGA

9
3.3 SOFTWARE REQUIREMENTS

The software requirements document is the specification of the system. It should include both a
definition and a specification of requirements. It is a set of what the system should do rather than
how it should do it. The software requirements provide a basis for creating the software
requirements specification. It is useful in estimating cost, planning team activities, performing
tasks and tracking the teams and tracking the team’s progress throughout the development
activity.

SOFTWARE REQUIREMENTS

● Operating System - Windows XP


● Coding Language - Python

10
3.4 FUNCTIONAL REQUIREMENTS

A functional requirement defines a function of a software-system or its component. A function is


described as a set of inputs, the behavior. Firstly, the system is the first that achieves the standard
notion of semantic security for data confidentiality in attribute-based reduplication systems by
resorting to the hybrid cloud architecture.

3.5 NON-FUNCTIONAL REQUIREMENTS

EFFICIENCY

Our multi-modal event tracking and evolution framework is suitable for multimedia documents
from various social media platforms, which can not only effectively capture their multi-modal
topics, but also obtain the evolutionary trends of social events and generate effective event
summary details over time. Our proposed ETM model can exploit the multi-modal property of
social event, which can effectively model social media documents including long text with
related images and learn the correlations between textual and visual modalities to separate the
visual-representative topics and non-visual-representative topics.

11
CHAPTER 4

DESIGN ENGINEERING

4.1 GENERAL

Design Engineering deals with the various UML [Unified Modeling language] diagrams
for the implementation of project. Design is a meaningful engineering representation of a thing
that is to be built. Software design is a process through which the requirements are translated into
representation of the software. Design is the place where quality is rendered in software
engineering. Design is the means to accurately translate customer requirements into finished
product.

4.2 UML DIAGRAMS

4.2.1 USE CASE DIAGRAM

Start

Choose Options
player vs player

Player name

user

select option X or O

start Game

Technique

Result

EXPLANATION:

The main purpose of a use case diagram is to show what system functions are performed for
which actor. Roles of the actors in the system can be depicted. The above diagram consists of
user as actor. Each will play a certain role to achieve the concept.

12
4.2.2 CLASS DIAGRAM

EXPLANATION

In this class diagram represents how the classes with attributes and methods are linked together
to perform the verification with security. From the above diagram shown the various classes
involved in our project.

13
4.2.3 OBJECT DIAGRAM

start choose option player o player name

select X or O

Technique start Game


Result

EXPLANATION:

In the above diagram tells about the flow of objects between the classes. It is a diagram that
shows a complete or partial view of the structure of a modeled system. In this object diagram
represents how the classes with attributes and methods are linked together to perform the
verification with security.

14
4.2.4 SEQUENCE DIAGRAM

Start Choose option player vs Player Name select Option X Start Game Technique Result
computer & player vs player or O

user started

selected option

player name
both result

X or O

game Started

player result

EXPLANATION:

A sequence diagram in Unified Modeling Language (UML) is a kind of interaction diagram that
shows how processes operate with one another and in what order. It is a construct of a Message
Sequence Chart. A sequence diagram shows object interactions arranged in time sequence. It
depicts the objects and classes involved in the scenario and the sequence of messages exchanged
between the objects needed to carry out the functionality of the scenario.

15
4.2.5 STATE DIAGRAM

Enter Name

option player computer

choose1 option

player name

select X or O

Start Game

Technique

play

Result

EXPLANATION:

State diagram are a loosely defined diagram to show workflows of stepwise activities and
actions, with support for choice, iteration and concurrency. State diagrams require that the
system described is composed of a finite number of states; sometimes, this is indeed the case,
while at other times this is a reasonable abstraction. Many forms of state diagrams exist, which
differ slightly and have different semantics.

16
4.2.6 ACTIVITY DIAGRAM

start

Choose option player or computer

player name

select X or O

start Game

Technique

Result

EXPLANATION:

Activity diagrams are graphical representations of workflows of stepwise activities and actions
with support for choice, iteration and concurrency. In the Unified Modeling Language, activity
diagrams can be used to describe the business and operational step-by-step workflows of
components in a system. An activity diagram shows the overall flow of control.

17
4.2.7 COMPONENT DIAGRAM

Start choose Option player name


player vs

Start game select option


X or O

Result Technique

EXPLANATION

In the Unified Modeling Language, a component diagram depicts how components are wired
together to form larger components and or software systems. They are used to illustrate the
structure of arbitrarily complex systems. User gives main query and it converted into sub queries
and sends through data dissemination to data aggregators. Results are to be showed to user by
data aggregators. All boxes are components and arrow indicate dependencies.

18
4.2.8 DEPLOYMENT DIAGRAM

start choose optio


n

player name
select X or 0

Technique start game


Result

EXPLANATION:

Deployment Diagram is a type of diagram that specifies the physical hardware on which the
software system will execute. It also determines how the software is deployed on the underlying
hardware. It maps software pieces of a system to the device that are going to execute it.

19
4.2.9 COLLABORATION DIAGRAM

1: user started
Start Choose option player vs
computer & player vs player

2: selected option

select Option Player


X or O Name
3: player name

5: X or O 7: player result

6: game Started 4: both result


Start Techniqu Result
Game e

EXPLANATION:
A collaboration diagram, also called a communication diagram or interaction diagram, is an
illustration of the relationships and interactions among software objects in the Unified Modeling
Language (UML). The concept is more than a decade old although it has been refined as
modeling paradigms have evolved.

20
4.3 SYSTEM ARCHITECTURE

21
CHAPTER 5

DEVELOPMENT TOOLS

Python

Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is


designed to be highly readable. It uses English keywords frequently where as other languages
use punctuation, and it has fewer syntactical constructions than other languages.

History of Python

Python was developed by Guido van Rossum in the late eighties and early nineties at the
National Research Institute for Mathematics and Computer Science in the Netherlands.

Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68,
Small Talk, and Unix shell and other scripting languages.

Python is copyrighted. Like Perl, Python source code is now available under the GNU General
Public License (GPL).

Python is now maintained by a core development team at the institute, although Guido van
Rossum still holds a vital role in directing its progress.

Importance of Python
● Python is Interpreted − Python is processed at runtime by the interpreter. You do not
need to compile your program before executing it. This is similar to PERL and PHP.

● Python is Interactive − You can actually sit at a Python prompt and interact with the
interpreter directly to write your programs.

● Python is Object-Oriented − Python supports Object-Oriented style or technique of


programming that encapsulates code within objects.

● Python is a Beginner's Language − Python is a great language for the beginner-level


programmers and supports the development of a wide range of applications from simple
text processing to WWW browsers to games.

22
Features of Python

● Easy-to-learn − Python has few keywords, simple structure, and a clearly defined
syntax. This allows the student to pick up the language quickly.

● Easy-to-read − Python code is more clearly defined and visible to the eyes.

● Easy-to-maintain − Python's source code is fairly easy-to-maintain.

● A broad standard library − Python's bulk of the library is very portable and cross-
platform compatible on UNIX, Windows, and Macintosh.

● Interactive Mode − Python has support for an interactive mode which allows
interactive testing and debugging of snippets of code.

● Portable − Python can run on a wide variety of hardware platforms and has the same
interface on all platforms.

● Extendable − You can add low-level modules to the Python interpreter. These modules
enable programmers to add to or customize their tools to be more efficient.

● Databases − Python provides interfaces to all major commercial databases.

● GUI Programming − Python supports GUI applications that can be created and ported
to many system calls, libraries and windows systems, such as Windows MFC,
Macintosh, and the X Window system of Unix.

● Scalable − Python provides a better structure and support for large programs than shell
scripting.

Apart from the above-mentioned features, Python has a big list of good features, few are listed
below −

● It supports functional and structured programming methods as well as OOP.

● It can be used as a scripting language or can be compiled to byte-code for building large
applications.

● It provides very high-level dynamic data types and supports dynamic type checking.

23
● IT supports automatic garbage collection.

● It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

Libraries used in python:

● NumPy - mainly useful for its N-dimensional array objects.


● pandas - Python data analysis library, including structures such as dataframes.
● matplotlib - 2D plotting library producing publication quality figures.
● scikit-learn - the machine learning algorithms used for data analysis and data mining
tasks.

Figure: NumPy, Pandas, Matplotlib, Scikit-learn

24
CHAPTER 6

TESTING

6.1 GENERAL
The purpose of testing is to discover errors. Testing is the process of trying to discover
every conceivable fault or weakness in a work product. It provides a way to check the
functionality of components, sub-assemblies, assemblies and/or a finished product It is the
process of exercising software with the intent of ensuring that the Software system meets its
requirements and user expectations and does not fail in an unacceptable manner. There are
various types of test. Each test type addresses a specific testing requirement.

6.2 DEVELOPING METHODOLOGIES


The test process is initiated by developing a comprehensive plan to test the general
functionality and special features on a variety of platform combinations. Strict quality control
procedures are used. The process verifies that the application meets the requirements specified in
the system requirements document and is bug free. The following are the considerations used to
develop the framework from developing the testing methodologies.

6.3TYPES OF TESTS

6.3.1 UNIT TESTING


Unit testing involves the design of test cases that validate that the internal program logic is
functioning properly, and that program input produce valid outputs. All decision branches and
internal code flow should be validated. It is the testing of individual software units of the
application .it is done after the completion of an individual unit before integration. This is a
structural testing, that relies on knowledge of its construction and is invasive. Unit tests perform
basic tests at component level and test a specific business process, application, and/or system

25
configuration. Unit tests ensure that each unique path of a business process performs accurately
to the documented specifications and contains clearly defined inputs and expected results.

6.3.2 FUNCTIONAL TEST


Functional tests provide systematic demonstrations that functions tested are available as
specified by the business and technical requirements, system documentation, and user manuals.
Functional testing is centered on the following items:
Valid Input : identified classes of valid input must be accepted.
Invalid Input : identified classes of invalid input must be rejected.
Functions : identified functions must be exercised.
Output : identified classes of application outputs must be exercised.
Systems/Procedures: interfacing systems or procedures must be invoked.

6.3.3 SYSTEM TEST


System testing ensures that the entire integrated software system meets requirements. It tests a
configuration to ensure known and predictable results. An example of system testing is the
configuration oriented system integration test. System testing is based on process descriptions
and flows, emphasizing pre-driven process links and integration points.

6.3.4 PERFORMANCE TEST


The Performance test ensures that the output be produced within the time limits,and the time
taken by the system for compiling, giving response to the users and request being send to the
system for to retrieve the results.

6.3.5 INTEGRATION TESTING


Software integration testing is the incremental integration testing of two or more integrated
software components on a single platform to produce failures caused by interface defects.
The task of the integration test is to check that components or software applications, e.g.
components in a software system or – one step up – software applications at the company level –
interact without error.

26
6.3.6 ACCEPTANCE TESTING
User Acceptance Testing is a critical phase of any project and requires significant participation
by the end user. It also ensures that the system meets the functional requirements.

ACCEPTANCE TESTING FOR DATA SYNCHRONIZATION:


⮚ The Acknowledgements will be received by the Sender Node after the Packets are
received by the Destination Node
⮚ The Route add operation is done only when there is a Route request in need
⮚ The Status of Nodes information is done automatically in the Cache Updation process

6.2.7 BUILD THE TEST PLAN


Any project can be divided into units that can be further performed for detailed processing. Then
a testing strategy for each of this unit is carried out. Unit testing helps to identity the possible
bugs in the individual component, so the component that has bugs can be identified and can be
rectified from errors.

27
CHAPTER 7

IMPLEMENTATION

7.1 GENERAL

SOURCE PROGRAM

print("\n\t\t WELCOME TO THE WORLD OF TIC TAC TOE GAME! \n")

input("Press ENTER to start!")

default()

rules()

while True:

#Creating the board as a list; to be kept replacing it with user input;

theBoard = [' ']*10

#Creating the available options on the board:

available = [str(num) for num in range(0,10)] # a List Comprehension

#available = '0123456789'

print("\n[0]. Player vs. Computer")

print("[1]. Player vs. Player")

print("[2]. Computer vs. Computer")

mode = int(input("\nSelect an option [0]-[2]: "))

28
if mode == 1:

#Asking Names;

p1_name, p2_name = names()

# Asking Choices; Printing choices; X or O;

p1_choice, p2_choice = choice()

print(f"\n{p1_name}:", p1_choice)

print(f"{p2_name}:", p2_choice)

elif mode == 0:

p1_name = input("\nEnter NAME of PLAYER who will go against the


Computer:\t").capitalize()

p2_name = "Computer"

# Asking Choices; Printing choices; X or O;

p1_choice, p2_choice = choice()

print(f"\n{p1_name}:", p1_choice)

print(f"{p2_name}:", p2_choice)

else:

p1_name = "Computer1"

p2_name = "Computer2"

p1_choice, p2_choice = "X", "O"

print(f"\n{p1_name}:", p1_choice)

29
print(f"\n{p2_name}:", p2_choice)

#Printing randomly who will go first;

if first_player():

turn = p2_name

else:

turn = p1_name

print(f"\n{turn} will go first!")

#Asking the user, if ready to play the game; Output will be True or False;

if(mode == 2):

ent = input("\nThis is going to be fast! Press Enter for the battle to begin!\n")

play_game = 1

else:

play_game = play()

while play_game:

############################

#PLAYER1

if turn == p1_name:

#Displaying the board;

display_board(theBoard, available)

30
#Position of the input;

if mode != 2:

position = player_choice(theBoard, p1_name, p1_choice)

else:

position = CompAI(theBoard, p1_name, p1_choice)

print(f'\n{p1_name} ({p1_choice}) has placed on {position}\n')

#Replacing the ' ' at *position* to *p1_choice* in *theBoard* list;

place_marker(theBoard, available, p1_choice, position)

#To check if Player 1 has won after the current input;

if win_check(theBoard, p1_choice):

display_board(theBoard, available)

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

if(mode):

print(f'\n\nCONGRATULATIONS {p1_name}! YOU HAVE WON THE


GAME!\n\n')

else:

print('\n\nTHE Computer HAS WON THE GAME!\n\n')

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

play_game = False

else:

31
#To check if the board is full; if yes, the game is a draw;

if full_board_check(theBoard):

display_board(theBoard, available)

print("~~~~~~~~~~~~~~~~~~")

print('\nThe game is a DRAW!\n')

print("~~~~~~~~~~~~~~~~~~")

break

#If none of the above is possible, next turn of Player 2;

else:

turn = p2_name

#PLAYER2

elif turn == p2_name:

#Displaying the board;

display_board(theBoard, available)

#Position of the input;

if(mode == 1):

position = player_choice(theBoard, p2_name, p2_choice)

else:

position = CompAI(theBoard, p2_name, p2_choice)

32
print(f'\n{p2_name} ({p2_choice}) has placed on {position}\n')

#Replacing the ' ' at *position* to *p2_choice* in *theBoard* list;

place_marker(theBoard, available, p2_choice, position)

#To check if Player 2 has won after the current input;

if win_check(theBoard, p2_choice):

display_board(theBoard, available)

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

if(mode):

print(f'\n\nCONGRATULATIONS {p2_name}! YOU HAVE WON THE


GAME!\n\n')

else:

print('\n\nTHE Computer HAS WON THE GAME!\n\n')

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

play_game = False

else:

#To check if the board is full; if yes, the game is a draw;

if full_board_check(theBoard):

display_board(theBoard, available)

print("~~~~~~~~~~~~~~~~~~")

print('\nThe game is a DRAW!\n')

33
print("~~~~~~~~~~~~~~~~~~")

break

#If none of the above is possible, next turn of Player 2;

else:

turn = p1_name

if replay():

#if Yes;

continue

else:

#if No;

break

print("\n\n\t\t\tTHE END!")

#END

34
7.1 SCREENSHOTS

Fig. 7.1. Initial beginning of the game

35
Fig. 7.2. Game between player and computer.

Result Analysis: The game is a draw between the player and the computer.

36
Fig. 7.3. Game between player 1 vs. player 2

Result Analysis: The game is won by player 2.

37
CHAPTER 8

APPLICATION AND FUTURE ENHANCEMENT

8.1 APPLICATIONS

The main Machine Learning module that was created is so adaptable that it can be used with any
platform, such as Web Applications, Android Applications, IoT devices and so on.

8.2 FUTURE ENHANCEMENT

It would be of great help if we revise and update our curriculum and other extra activities for
each semester in accordance with the public, private and government sector requirement. We can
also predict which company picks which category of students. Make a list of skill a particular
company is looking for, then on the basis of that we can train our student. These traits will make
the prediction process more accurate. Some other reactions will enable X to compel the win.
Once the opening is finished, O's undertaking is to take after the above rundown of needs so as to
constrain the draw, or else to pick up a win if X makes a frail play. To ensure a tie in case you're
O however, in the event that X doesn't play focus (playing a corner is the best opening move),
take focus, and afterward a side cent

38

You might also like