You are on page 1of 22

[BACHELOR OF

COMPUTERAPPLICATIONS ]
[BATCH:2019-2022]

PROJECTWORK-I
“COVID-19CASES PREDICTION WITH PYTHON”

[SEMESTER-5]

SUBMITTED BY :- SUBMITTED TO :-
Parneet kaur-1928452 DR. KIRTI
Gurwinder kaur-1928406
Index
S. No. Content Page No. Remarks
1 Declaration 3
2 Abstract 4
3 Acknowledgemnt 5
4 Chapter 1 1.1 Introduction Of Project 6
1.2 Aim & Purpose 6
1.3 Introduction of 6-10
technology
5. Chapter 2 2.1 Project Overview
11

2.1.1 Objectives 11
2.1.2 SRS 12
2.1.3 Hardware 12
Specifications
2.1.4 Software 12
Specifications
6. Chapter 3 3.1 Introduction to Front 13-15
End
7. Chapter 4 4.1 ER Diagram 16-17
8. Chapter 5 5.1 Testing 18

5.2 Implementation 19-21


and running project
Screenshots
9. Conclusion 22
10. Refrences 23

2
DECLARATION

Theprojectsubmittedherewithisaresultofmyowneffortsintotalityandineve
ry aspects of the project works. All information that has been
obtainedfromothersourceshad beenfullyacknowledged.

TheprojectissubmittedtothecollegeCGCTechnicalcampusJhanjeri.Forthep
artial fulfilment oftheBachelorof ComputerApplication.

Ialsodeclarethatthisprojectreporthasnotbeenpreviouslysubmittedtoanyot
herUniversity.

TeamName&Roll.No.

1. Parneet kaur-1928452
2. Gurwinder kaur-1928406
3. Mandeep kaur-1928433
4. Simranjeet kaur-1928483

3
ABSTRACT

Tic-tac-toe is a fun game played by two players. Before starting the game, a 3x3 square grid is formed
using two vertical and two horizontal lines. The player who succeeds in placing three of their marks in a
horizontal, vertical, or diagonal row is the winner. In this study, we develop a computer program where a
player can challenge artificial intelligent heuristic approach (opponent) to win the game. We want to
prove that artificial intelligent heuristic approach enables in giving a great performance for development
of tic-tac-toe game.

TeamName&Roll.No.

Parneet kaur-1928452
Gurwinder kaur-1928406
Mandeep kaur-1928433
Simranjeet kaur-1928486

4
ACKNOWLEDGEMENT

After completion of my Project, I would like to take this chance to


express mysincere gratitude to my project supervisor which isDr.Kirti
who has guidedme a lot throughout the project development. I would
like to thanks
Dr.KirtiMa’amforonemoretimebecauseshesharesherexperiencewithussot
hatwe can get more logic understanding on how to develop a software
whichsuitablefor the currentsociety.
Ialsothankourcollegewhohavehelpedinsuccessfulcompletionofproject .

TeamName&Roll.No.

Parneet kaur-1928452
Gurwinder kaur-1928406
Mandeep kaur-1928433
Simranjeet kaur-1928486

5
INTRODUCTION

1.1 Tic Tac Toe With Python


The tic-tac-toe is a unique game as illustrated in Figure 1. A 3x3 grid is formed by using two
vertical and two horizontal lines before the game starts. The players can fill the nine spaces with
any two different sign normally crosses (‘X’) and noughts (‘O’) symbols [10]. In this study, we use
Visual Studio 2019 software to develop the tic-tac-toe program based on artificial intelligent (AI)
heuristic approach, min-max algorithm and alpha-beta pruning algorithm. When there are no player
or less number of players be able to win the game, there is an evidence that the AI approach is
effective for tic-tac-toe game development.

1.2 Aim and Purpose

Our project name is Tic-Tac-Toe game. This game is very popular and is fairlysimplebyitself.It
isactuallyatwoplayer game.Inthis game,thereis a board with n x n squares. In our game, it is 3 x 3
squares.The goal of Tic-Tac-Toe is to be one of the players to get three same symbolsinarow-
horizontally, vertically ordiagonally-ona3x3 grid.

1.3 Introduction To The Technology


AI is the simulation of human intelligence processes by machines, especially computer systems. Artificial
Intelligence exists when a machine can have human-based skills such as learning, reasoning, and solving
problems [1]. Nowadays, there is a lot of applications of AI in different fields. In astronomy, AI can be
very useful in solving complex universe problems. In healthcare, AI could give a better and faster
diagnosis than humans can be done. AI can also be used for gaming purposes, where AI machines can be
used to play strategy games like chess, where the machine can perform the best move in
differentsituations. In this study, AI is proposed for computer gaming where it acts as a challenger
(opponent) in tic-tac-toe game.

Why Python?
Python is a general-purpose, and high-level programming language which is best known for its efficiency
and powerful functions. Python is loved by data scientists because of its ease of use, which makes it more
accessible. Python provides data scientists with an extensive number of tools and packages to build
6
machine learning models. One of its special features is that we can build various machine learning with
less-code.

Steps Involved

 First, let’s check the steps to build Tic Tac Toe program in Python:
 Create the display window for our game.
 Draw the grid on the canvas where we will play Tic Tac Toe.
 Draw the status bar below the canvas to show which player’s turn is it and who wins the game.
 When someone wins the game or the game is a draw then we reset the game.
 We need to run our game inside an infinite loop. It will continuously look for events and when a user
presses the mouse button on the grid we will first get the X and Y coordinates of the mouse. Then we
will check which square the user has clicked. Then we will draw the appropriate ‘X’ or ‘O’ image on
the canvas. So that is basically what we will do in this Python project idea

Tkinter
Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides a fast and
easy way to create GUI applications. Tkinter provides a powerful object-oriented interface to the Tk
GUI toolkit.
Creating a GUI application using Tkinter is an easy task. All you need to do is perform the following
steps −
 Import the Tkinter module.
 Create the GUI application main window.
 Add one or more of the above-mentioned widgets to the GUI application.
 Enter the main event loop to take action against each event triggered by the user.
 NUMPY:-

BasicIntro:
 NumPy(NumericalPython)isanopen-sourcePythonlibrarythat’susedinalmosteveryfieldofscience
andengineering.
 UniversalstandardforworkingwithnumericaldatainPython
 NumPy API is used extensively in Pandas, SciPy, Matplotlib, scikit-learn, scikit-image
andmostotherdatascience andscientificPythonpackages.
 TheNumPylibrarycontainsmultidimensionalarrayandmatrixdatastructures
 Itprovidesn-darray,ahomogeneousn-dimensionalarrayobject,withmethodstoefficientlyoperateon it.
 It is usedtoperformawidevarietyofmathematical operationsonarrays.

DifferencebetweenaPythonListandaNumPyArray:

 Pythonlistcancontaindifferentdatatypeswithinasinglelist
 ElementsinaNumPyarrayshouldbehomogeneous.
 NumPyarraysarefasterandmorecompactthanPythonlists.

7
 Anarrayconsumeslessmemoryandisconvenienttouse.
 NumPyarrayusesmuchlessmemory tostoredata.

DataTypesinNumPy: -

NumPyhassomeextradatatypes,andrefertodatatypeswithonecharacter,likeiforintegers,uforunsignedinte
gersetc.
BelowisalistofalldatatypesinNumPy andthe charactersused to representthem.

i – integer
b - Boolean
u - unsigned integer
f - float
c - complex float
m - time delta
M - datetime
O - object
S - string
U - Unicode string

MATPLOTLIB:-

DataVisualizationusingMatplotlib

Matplotlib is one of the most popular Python packages used for data visualization. It is a cross-
platformlibraryformaking2Dplotsfromdatainarrays.MatplotlibiswritteninPythonandmakesuse of NumPy,
the numerical mathematics extension of Python. It provides an object-oriented APIthat helps in
embedding plots in applications using Python GUI toolkits such as PyQt,WxPythonotTkinter.
It can be used in Python and IPython shells, Jupyter notebook and web application servers also.Matplotlib
has a procedural interface named the Pylab, which is designed to resemble MATLAB,
aproprietaryprogramminglanguagedevelopedbyMathWorks.MatplotlibalongwithNumPycanbeconsidered
astheopensourceequivalentofMATLAB.
Matplotlibwasoriginallywrittenby JohnD.Hunterin2003.Thecurrentstableversionis2.2.0

PANDAS:-

Pandas is an open-source Python Library providing high-performance data manipulation


andanalysistoolusingitspowerful datastructures

KeyFeatures ofPandas –
 FastandefficientDataFrameobjectwithdefaultandcustomizedindexing.
 Toolsforloadingdataintoin-memorydataobjectsfromdifferentfileformats.
8
 Dataalignmentandintegratedhandlingofmissingdata.
 Reshapingandpivotingofdatesets.
 Label-basedslicing,indexingandsubsettingoflargedatasets.
 Columnsfromadatastructurecanbedeletedorinserted.
 Groupbydataforaggregationandtransformations.
 Highperformancemergingandjoiningofdata.
 TimeSeriesfunctionality.

Series–
Pandas Series structure is a one-dimensional labeled array and capable of holding data of
anytype(integer,string,float, python objects,etc.)
Syntax:
pandas.Series(data=None,index=None,dtype=None,name=None)

Parameters:
data: array- Contains data stored in Series.index: array-likeor Index (1d)
dtype:str,numpy.dtype,orExtensionDtype,optionalname: str,optional

REGRESSION:-

Regressionisatechniqueusedtomodelandanalyzetherelationshipsbetweenvariablesandoftentimeshowt
heycontributeandarerelatedtoproducing aparticularoutcometogether.

Regression models are used to predict a continuous value. Predicting prices of a house given the features
of house like size, price etc is one of the common examples of Regression. It is a supervised technique.

KEYFEATURESOFREGRESSION:

 Regression is a supervised machine learning technique which is used to predictcontinuous values.


 The ultimate goal of the regression algorithm is to plot a best-fit line or a curvebetweenthe data.
 The three main metrics that are used for evaluating the trained regression model arevariance, bias

9
and error. If the variance is high, it leads to overfitting and when the biasishigh,itleads
tounderfitting.
 Based on the number of input features and output labels, regression is classified
aslinear,multipleandmultivariate.
 Linearregressionallowsustoplotalinearequation,i.e.,a straightline.Weneedtotune coefficient and
bias of the linear equation over the training data for accuratepredictions.
 Thetuningofcoefficientandbiasisachievedthroughgradientdescentoracostfunction —
leastsquaresmethod.
 Polynomialregressionisusedwhenthedataisnon-linear.Inthis,themodelismoreflexible
asitplotsacurve between thedata.
 Regularizationtendstoavoidoverfittingbyaddingapenaltytermtothecost/lossfunction.
 RidgeandlassoregressionarethetechniqueswhichuseL2&L1regularizations.

TYPESOFREGRESSIONINMACHINE LEARNING:-

10
Project Undertaken

2.1 Project Overview


Tic-tac-toe also known as noughts and crosses is a paper and pencil game for two players, whotake turns
marking the spaces in a 3 x 3 grid traditionally. The player who succeeds in placingthree of their marks in
a horizontal, vertical or diagonal row wins the game. It is a zero-sum of perfect information game. This
means that it is deterministic, with fully observable environmentsin which two agents act alternately and
the utility values at the end of the game are always equaland opposite. Because of the simplicity of tic-
tac-toe, it is often used as pedagogical tool inartificial intelligence to deal with searching of game trees.
The optimal move for this game can begained by using minimax algorithm, where the opposition
between the utility functions makes thesituation adversarial, hence requiring adversarial search supported
by minimax algorithm withalpha beta pruning concept in artificial intelligence.

2.1.1. Objectives
Our project name is Tic-Tac-Toe game. This game is very popular and is fairlysimplebyitself.It
isactuallyatwoplayer game.Inthis game,thereis a board with n x n squares. In our game, it is 3 x 3
squares.The goal of Tic-Tac-Toe is to be one of the players to get three same symbolsinarow-
horizontally, vertically ordiagonally-ona3x3 grid.

 To develop Artificial intelligence-based tic-tac-toe game for human Vs AI byimplementing minimax


algorithm with adversarial search concept.2.
 To analyze the complexity of minimax algorithm through 4x4 tic tac toe game.3.
 To study and implement alpha-beta pruning concept for improved speed of searching theoptimal
choice in tic-tac toe game.4.
 To study optimizing methods for alpha-beta pruning using heuristic evaluation function.

11
2.1.2 SRS Software requirement Specification
Version 1.0
Tic Tac Toe Game

2.1.2.1 Hardware Specification


 Minimum RAM:- 2GB(minimum) or higher.
 Hard Disk:- 128 GB
 Processor:- Intel duo core or higher.

2.1.2.2 System Requirements Specification (SyRS)


 Operating system : Windows 7,8,10 or other.
 Language : Python With Machine learning and artificial intelligence.
 Applications : Anaconda with Jupyter notebook, Pycharm or any other python platforms.
 Libraries: tkinter,pygame etc.

12
3. Development Environments
A development environment is a combination of a text editor and a Python runtime implementation. The
text editor allows you to write code for your applications. The runtime implementation, such
as CPython or PyPy, provides the method for executing your code.

A text editor can be as simple as Notepad running on Windows or a more complicated integrated
development environment (IDE) with syntax checking, integrated test runner and code highlighting. A
couple of common IDEs for Python development are PyCharm and VSCode, both of which runs on any
major operating system.

Why is a development environment necessary?


Python code needs to be written, executed and tested to build applications. The text editor provides a way
to write the code. The interpreter allows it to be executed. Testing to see if the code does what you want
can either be done manually or by unit and functional tests

An example of development environment:


Here's what I (the author of Full Stack Python, Matt Makai) use to develop most of my Python
applications. I have a Macbook Pro with Mac OS X as its base operating system. Ubuntu 18.04 LTS is
virtualized on top with Parallels. My code is written in vim and executed with the Python 3.6 release via
the command line. I use virtualenv to create separate Python interpreters with their own
isolated application dependencies and virtualenvwrapper to quickly switch between the interpreters
created by virtualenv.

That's a common set up but you can certainly write great code with a much less expensive set up or a
cloud-based development environment.

Other developers' environments


Often the best way to figure out how to get comfortable in your own development environment is to see
examples of how other experienced developers have set up their configurations. The following posts
contain the tools, editors and workflows that developers have taken the time to publicly document.

 My Python development environment has a setup with Sublime Text, Anaconda, PyCharm and
the author's workflow for how to use the different editors for different purposes.

 My Python Development Environment, 2018 Edition explains Jacob Kaplan-Moss' (one of the
original creators of the Django web framework) local setup.

 The definitive guide to setup my Python workspace is geared towards using Python for data
science but the guide remains useful for configuring your system for any type of Python work. There is
some solid advice in the post about not adulterating your global Python installation as well as how to split
out many virtual environments for Python 2 & 3.

13
General development environment resources:-
Development environments are unique to each programmer because Python is used for many different
purposes. The following guides range from web development to DevOps and from getting started to data
science. Even though your environment requirements are unique, you should be able to find someone
who has set up something similar to what you need. Use that configuration as a starting point and
customize it from there.

 The Python subreddit had a nice thread with developers giving the specifications to their Python
development environments in this post on What is in your Python Development Environment?.

 Real Python has an awesome, detailed post on setting up your Sublime Text 3 environment as a full-
fledged IDE.

 How to bootstrap a Python project covers using a virulent, where to store your files, which version of
Python to use and adding code metrics libraries for checking syntax.

 PyCharm: The Good Parts shows you how to be more efficient and productive with that IDE if it's
your choice for writing Python code.

 JetBrains' PyCharm Blog is required reading if you're using the IDE or considering trying it. One of
the core developers also has an interview on the Talk Python to Me podcast that's worth listening to.

 The Joy of Linux Desktop Environments talks about desktop environments, not specifically
development environments, but provides an explanation for why the core Linux operating system is
awesome for being unbundled from the desktop environment itself. You can change your desktop
environment from just a command line without a windowing system to a full windowed system
provided by Gnome, KDE or Unity for using the system and getting your programming work done.

 The Hitchhiker's Guide to Python has a page dedicated to development environments.

 Setting up a Python Development Environment with and without Docker explains the reasoning
behind why and when to use various tools in your local environment.

 Epic Development Environment using Windows Subsystem for Linux is geared


towards JavaScript developers but contains a slew of good advice for developers trying to configure
Windows.

14
3.1 Front End Development Environment:-
Anaconda Navigator:

Jupyter Notebook:

15
4. System Design

4.1Flowcharts / DFDs:-
The existing system as we seen includes the use of classifier were they train dataset and perform
operations on the dataset and then user get output value. The presented System Architecture is using
classifier and datasets:

This system works on classifier and its repetitive output since predicting accurate house price is not
possible with this architecture. Proposed System Architecture As discussed above, architecture does not
have the accurate price prediction to overcome this we designed architecture where accuracy can be
achieved

16
17
IMPLEMENTATION & TESTING

5.1 Testing:-

Testing your code is very important.Getting used to writing testing code and running this code in parallel
is now considered a good habit. Used wisely, this method helps to define your code’s intent more
precisely and have a more decoupled architecture.

 A testing unit should focus on one tiny bit of functionality and prove it correct.
 Each test unit must be fully independent. Each test must be able to run alone, and also within the
test suite, regardless of the order that they are called. The implication of this rule is that each test
must be loaded with a fresh dataset and may have to do some cleanup afterwards. This is usually
handled by setUp() and tearDown() methods.
 Try hard to make tests that run fast. If one single test needs more than a few milliseconds to run,
development will be slowed down or the tests will not be run as often as is desirable. In some cases,
tests can’t be fast because they need a complex data structure to work on, and this data structure
must be loaded every time the test runs. Keep these heavier tests in a separate test suite that is run by
some scheduled task, and run all other tests as often as needed.
 Learn your tools and learn how to run a single test or a test case. Then, when developing a
function inside a module, run this function’s tests frequently, ideally automatically when you save
the code.
 Always run the full test suite before a coding session, and run it again after. This will give you
more confidence that you did not break anything in the rest of the code.
 It is a good idea to implement a hook that runs all tests before pushing code to a shared repository.
 If you are in the middle of a development session and have to interrupt your work, it is a good
idea to write a broken unit test about what you want to develop next. When coming back to work,
you will have a pointer to where you were and get back on track faster.
 The first step when you are debugging your code is to write a new test pinpointing the bug. While
it is not always possible to do, those bug catching tests are among the most valuable pieces of code
in your project.
 Use long and descriptive names for testing functions. The style guide here is slightly different
than that of running code, where short names are often preferred. The reason is testing functions are
never called explicitly. square() or even sqr() is ok in running code, but in testing code you would
have names such as test_square_of_number_2(), test_square_negative_number(). These function
names are displayed when a test fails, and should be as descriptive as possible.
 When something goes wrong or has to be changed, and if your code has a good set of tests, you or
other maintainers will rely largely on the testing suite to fix the problem or modify a given behavior.
Therefore the testing code will be read as much as or even more than the running code. A unit test
whose purpose is unclear is not very helpful in this case.
 Another use of the testing code is as an introduction to new developers. When someone will have
to work on the code base, running and reading the related testing code is often the best thing that

18
they can do to start. They will or should discover the hot spots, where most difficulties arise, and the
corner cases. If they have to add some functionality, the first step should be to add a test to ensure
that the new functionality is not already a working path that has not been plugged into the interface.

5.2 IMPLEMENTATION:-

19
20
Conclusion
With the basis of minimax algorithm for mathematical analysis alongside speeding up thecomputation by
alpha beta pruning concept and optimizing the utility function using heuristicfunction, the 4x4 tic tac toe
game was developed. We explored that a 4x4 tic tac toe, an adversarysearch technique game in artificial
intelligence, can be developed using these techniques.Increasing the size of this game would create a
huge time complexity issue with the same algorithmand techniques, for which other logics must be
further researched.

21
Refrences:

1. K. Kask. [Online]. Available: https://www.ics.uci.edu/~kkask/Fall-


2016%20CS271/slides/04-games.pdf. [Accessed 02 01 2020].
2. G. Surma. [Online]. Available: https://towardsdatascience.com/tic-tac-toe-creating-
unbeatable-ai-with-minimax-algorithm-8af9e52c1e7d. [Accessed 20 12 2019].
3. P. G. ,. P. S. P. Sunil Karamchandani, "A Simple Algorithm For Designing An
ArtificialIntelligence Based Tic Tac Toe Game"
4. 12 09 2019. [Online]. Available: https://www.edureka.co/blog/alpha-beta-pruning-in-
ai.[Accessed 20 11 2019].

22

You might also like