0 ratings0% found this document useful (0 votes) 151 views31 pagesMini Project Tic Tac Toe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
ra
= §5 SCRIBD ( Search
Download now
CHAPTER NO
TABLE OF CONTENTS
TITLE
ABSTRACT
INTRODUCTION
2.1 Objective
SYSTEM ANALYSIS
3.1. Existing System
3.2 Proposed System
3.3. Feasibility Study
3.31 Economical Feasibility
3.32 Technical Feasibility
3.3.3 Operational Feasibility
SY!
SPECIFICATION
41 Hardware Specification
42. Software Specification
SOFTWARE DESCRIPTION
5.1 Python 3.6.0 IDLE 2016
5.2 Development Tools and Technologies
521 Python 3
522 GUI
PROJECT DESCRIPTIONS
61 Problem Definition
62 Overview of the project
63 Module Description
64 System Flow Diagram
6.5 Data Flow Diagram(DFD)
66 Use case Diagram
67 Input Design
6.8 Output Design
PAGE NO
aaa
ono Oa A‘TEM TESTING
7.4. Introduction
7.2 Testing Methodologies
724
7.22
7208)
724
8 sy
8.1 Purpose
Unit Testing
Integration Testing
System Testing
Performance Testing
EM IMPLEMENTATION
8.2 System Maintenance
9 CONCLUSIONS AND.
FUTURE
|ANCEMENT
9.1 Conclusion
92. Scopes for Future Enhancement
10 APPENDICES
10.1 Program Listing
10.2 Screen Shots
" BIBLIOGRAPHIES
What is Scribd?
& ad)
Home
Books
62
Audiobooks
-
DocumentsIll
S
Download now W
1 ABSTRACT
‘The game TIC TAC TOE had an early variant which began in the first century in
the Roman Empire, During that time, it was called Term Lapilli where the
Players only had three pleces and had to move around the empty spaces to play.
‘The actual game of TIC TAC TOE could be traced back to ancient Egypt. The
game was also known during that time as “Three Men's Morris”. The first
reference to Noughts and crosses was made in 1864 in a British novel called can
‘You Forgive Her. For many years the game was referred to as noughts and
crosses but was changed in the 2oth century by the United States to TIC TAC
Tor.
The purpose of this documentation is to capture all the requirements by which
the user can play a game of tic-tac-toe in Graphical User Interface as well as
they can develop a logic that what is actually happening.
What is Scribd?
S om 62 a
Home Books Audiobooks DocumentsIll
§3 SCRIBD
Download now W
SYSTEM ANALYSIS
INTRODUCTION:
Analysts can be defined by breaking up of any whole So as to find out their nature, working
Unctionaiities etc. t defines design as to make preliminary sketches of to sketch a pattern
oF Outline for planning. To plan and carry out especialy by artistic arrangement or in a skilful
wall, System analysis and design can be characterzed as 9 set of techniques and
Processes, a community of interests, a culture and intellectual onentation
The various tasks in system analysis phase including the folowing
¥ Understanding Application
¥ Project Planning
¥ Project Scheduling
¥ Performing Trade Studies
¥ Performing Cost Benefit Analysis
¥ Recommending Altemative Solutions
Supervising, Installing, Maintaining the system
‘This system allows the user to feel the taste of playing the game endlessly First design the
class which will Keeps track various functions like board structure, pixel selection, gnd
Selection, canvas structure, click recognition, gameplay, game over screen etc And
according to the moves played by the players this project will display the result in very
attractive format
3.1 EXISTING SYSTEM:
The Existing system is @ simple game to play with paper and pencil between two people
Here the whole process will be carned out in the hand-wntten format making nine square
grids, placing X's and O's and checking for the winner This process will repeat every time
So. it will be @ tedious job to draw a nine square grid every time with paper and pencil The
human effort is more here. Along with that the retneval of the information 1s not eesy as the
records are maintained in the hand-written papers. This application requires correct feed on
input into the respective field. Suppose the wrong inputs are entered, then the whole process
is to be done again. So, the users find it diffcutt to use
What is Scribd?
$5 aa 62 Ea)
Home Books Audiobooks Documents3.2. PROPOSED SYSTEM:
To overcome the drawbacks of the existing system, the proposed system has been evolved
This project aims to reduce the paper work and saving time to generate accurate results
from the player's perspective The system provides with the best Graphical User Interface.
The efficient reports can be generated by using this proposed system.
3.2.1 ADVANTAGES OF PROPOSED SYSTEM
v The game has been made user friendly with proper use of graphical
interface
v The user can play as many games without any interpretation
¥ Itis highly reliable, approximate result from user
¥ The game has been made as a thorough expert system
¥ The players can win the game, draw the game or will lose the game
¥_ Itis @ good brain exercise for all age group people
3.3. FEASIBILITY STUDY:
Feasibility study begins once the goals are defined It starts by generating board possible
‘solutions, which are possible to give an indication of what is new system should look like.
That is where creativity and imagination are used. Analysts must think up the new ways of
doing things generating new ideas. There is no need to go into the detailed system operation
yet. The solution should provide enough information to make reasonable estimates about
project cost and give user an indication of how the new system will fit into the organization
Feasibility of a new system means ensunng that the new system, which we're going to
implement is efficient and affordable. There are vanous types of feasibility that should be
taken into consideration
33.1 ECONOMICAL FEASIBILITY:
Development of this application is highly economically feasible. The only thing
to be done is making an environment with the effective supervision. It is time
effective in the sense that it will eliminate the paper work completely. The
system that is being developed is also cost effective
Vela cereal eres
$5 aa) 62 E)
Home Books Audiobooks Documents2B
¥ Placer: You provide the size of the widgets and locations to place them
this manager then places them for you
¥ Packer: It packs widgets into the correct places
Y Grid: It is used to specify GUI widget placement based on gnd
coordinates
Now once the packer has determined the sizes and alignments of your widgets, it will
then place them on the screen for you. When all the widgets are in place we instruct
the application to infinite main loop. In Tkinter the code that does it is
Tkinter .mainloop()
This is normally the last piece of sequential code your program runs
What is Scribd?
$5 CH 62 E)
Home Books Audiobooks Documentsfo
= §5 SCRIBD | Search oC
Download now
2
V Types are bound to values but not to vanables.
¥ Function and method lookup 1s done at runtime.
v Values are inspect-able
v There is an interactive interpreter, more than one. in fact
Vv You can list the methods supported by any given object
Because code is automatically compiled to byte code and executed, Python Is
suitable for use as @ scnpting language, Web application implementation language
etc Because of its strong structuring constructs (nested code blocks, functions
classes, modules and packages) and its consistent use of objects and OOP, Python
enables you to wnte clear and logical code for small and large projects
5.2.2. GUI (GRAPHICAL USER INTERFACE):
Our goal in this article 1s to provide you with an introductory of GUI programming In
order to learn the GUI programming, you must first understand a few core aspects of
GUI, So let's begin the discussion. The primary GUI toolkit will be using Tk, Pythons
default GUL We'll access Tk from its python interface called Tkinter. It 1s not the
latest and greatest nor does it have the most robust set of GUI bt
t run on most platforms
uilding blocks, but it
\s fairly simple to use and using it, you can build GUIs that
Setting up GU! application is similar to how an artist produces a painting, Conventio-
nally there is a single canvas onto which the artist must put all the work. In oul
programming a toplevel root windowing object contains all of the little windowing
objects thet will be a part of your GUI application. These can be text labels, buttons
list boxes etc These individual little GUI components are known as widgets. Top
level windows are those that show up stand alone as part of your application
Interestingly, you can have more than one top level window for your GUI, but only
one of them should be your root window.
‘The top level window can be created using this
import tkinter
top=tkinter.Tk()
The object retumed by tkinter.Tk( ) 1s usually referred to as the root window.
Within this window you can place multiple component pieces together to form your
GUI. Tk has three geometry managers that help with positioning your widget set= $5 SCRIBD ( search
Download now W
n
5. SOFTWARE DESCRIPTION
5.1 PYTHON 3.6.0 IDLE 2016
OLE stands for Integrated Development and Leaming Environment is an integrated
development environment for python. it has been bundied with the defauit implementation of
the language since 1.6 2b 1 It is packaged as an optional part of the python packaging with
‘many Linux distribution. It is completely written in python3 and Tkinter GUI toolkit IDLE is
Intended to be a simple IDE and suitable for beginners as well as advanced users To that
fend iit IS cross platform and avoids feature clutter The features provided by the IDLE
includes
¥ Python shell with syntax highlighting
Integrated debugger with stepping, persistent breakpoints and call stack
visibility
Multi-window text editor with syntax highlighting, auto completion, smart
indenting ete
5.2 DEVELOPMENT TOOLS AND TECHNOLOGIES
5.2.1 PYTHON 3:
Python is a general purpose interpreted, interactive, object-oriented, and high-level
Programming language. It was created by Guido Van Rossum during 1985-1990
Like Pert, Python source code is also available under the GNU General Public
License (GPL) Python is named after a TV show called "Monty Python's Flying
Circus’
Python 3.0(also called “Python 3000" or “Py3h") was released in December 3,
2008. The latest version of python accumulated new and redundant ways to program
the same task, Python 3.6 had an emphasis on removing duplicatve constructs and
modules, in keeping with “There should be one and preferable only one — obvious
way to do it” Python's dynamic typing encourage the programmer to wnte @ code
that is clear, well structured as well as easy to understand, The features of dynamic
typing are
What is Scribd?
$3 M1 62 A
Home Books Audiobooks Documents= §3 SCRIBD
Download now W
10
33.1 TECHNICAL FEASIBILITY:
The technical requirement for the system is economic and it doesn't use any
other hardware or software. Technical evaluation must also assess whether
the Existing System can be upgraded to use the new technology and whether
the organization has the expertise to use it install all the upgrades
frameworks into the Python IDLE package supported Linux based application
This application mostly depends two packages namely tkinter package and
Pygame package provided by Python 3.6 0
33.1 OPERATIONAL FEASIBILITY:
The system working is quite easy to use and leam due to its simple but
attractive interface. User requires no prerequisites for operating the product
Technical performance includes issues such as determining whether the
system can sense the proper click of the mouse or after sensing the click it
places the symbol in the desired cell and whether the system is orgar
din
Such @ way that it always displays the correct result according to the moves
made by the players
4. SYSTEM SPECIFICATION
4.1 HARDWARE REQUIREMENT [minimum requirement) :
Minimum RAM: - 1GB
¥ Minimum Hard Disk: - 28GB
Y Processor: - Intel Pentium 4(1.50 GHz) or above
4.1 SOFTWARE REQUIREMENT [minimum requirement ] :
¥- Operating System: - Support for both LINUX and WINDOWS users
¥ Back End: - Python 3.60 Interpreter
¥_ Front End Language: - Python?
“Front Design: - Tkinterface
What is Scribd
$ Q 63 A
Home Books Audiobooks Documents= §& SCRIBD ( Search Q
Download now
4
6. PROJECT DESCRIPTION
61 PROBLEM DEFINITION:
mm that plays TIC
The project consists of developing and implementing a computer progra
anual work that 1s
TAC TOE against another player This developed system will reduce the m
for playng a game you've not to carry @ pen or a pencil and a few sheets of papers on your
pocket all the time The system can able to provide hundreds or thousands of TIC TAC TOE
game without any interruption
62 OVERVIEW OF THE PROJECT:
This project is divided into several modules and all the modules are appearing in one class
These modules are called from the main module located at the root of the project, All the
modules have different as well a5 vital functionalities in order to develop the nght product
These modules are designed in such a way that they reflect a highly cohesiveness
6.3 MODULE DESCRIPTION:
> INITIALIZATION:
In the main class we've created a constructor which will hold all the tkinter widgets that we
are using in our program. First of all, we've used a highly versatile widget called canvas to
draw graphs and plots on our root window. We set the background colour as white Now we
want to realize the effects that we are made in our root window For that we have to use the
pack geometry manager Then we've called the bind function, which is actually used to
interact the GUI widget with our computer program. In the bind function we've passed two
objects namely '< x >", sel£.exit. The later one 1s used to exit from the root window
In the root window there should be three options displaying at the top level. The minimize
button (—), the maximize button (— ) and the close button ( X ) Now whenever the user
clicks on the X button the bind function should capture that and accordingly the root window
will destroy that means it could not be displayed any more. Then we set our game state to
zero ( 0 ) and call the title_screen module After that we create a list with nine strings and
initiate each of them with a value zero ( 0 ) and store it in a vanable called board6} SCRIBD (Search
Download now
15
> TITLE SCREEN:
In this module, what we've done is we use the delete method to clear the canvas. We use
the special tag “all” to delete all the items on the canvas. Then we create three rectangles on
our root window. We create these rectangles by using canvas supported standard item call
create_rectangle For drawing the first rectangle we've passed the rectangle bounding size
which is nothing but the original window size and the rectangle options which includes fill
and outline as an object. We choose the white colour as the rectangle boundary colour
Applying the same procedure, we have created the second rectangle The only additional
thing that is done here is regardless of sending the onginal window size we'll send the
adjusted window size as an object That means we'll just modify the X and Y axis ts such a
way that the beauty of the window is preserved. Now, for the third rectangle we've applied
the same procedure and we select appropnate colour for displaying all the texts that will be
appeared in this rectangle. Now we want to display the title of the game and besides that,
because we also would like to increase the usability of the software that we are developing
50 we also have to create another text that will increase the usability of the software For that
We are using canvas supported standard item called ereate_text that will enable us to create
informative text on the screen. Intuitively, the title of the game should be TIC TAC TOE and
just below to that another text that will be appeanng is Click to play
> NEW BOARD:
The main objective of this module is to create a new board that consists of three rows and
the columns. The board 1s nothing but a 2 Dimensional three by three matnx and we'll create
the matnx by using list of strings So, to do that first we clear all the widgets that is appearing
in the window by using the delete method and passing a special parameter “all’ to it Then
we reset the board by assigning 0 value to all the nine locations in the board. Now we've to
draw two lines vertically and honzontally To achieve this, we have to use canvas supported
another standerd item called ereate_line. To use the create_line function we should have to
pass the line co-ordinates and the line options as @ parameter. Thus, we create a loop which
will repeat two times and inside the loop we declare two create_line functions with
appropriate X co-ordinates. Y co-ordinates, grid / line width and gnd colour Insides the loop
we use the create_line function twice because one is for drawing the lines vertically and the
other one does the desired job for us by creating the lines horizontally By this we've
completed our board structurea
83 SCRIBD \, Beate iQ
Download now
16
> GAMEOVER SCREEN:
This module is concemed with displaying the result according to the outcome on the screen
It takes outcome as an object and displays the appropnate result. If the outcome 1s in favour
of player 1, °O Wins” appears on the screen in the form of a text. Similarly, if the outcome is
in favour of player2, “X Wins” should appear on the screen and if the outcome is a draw,
then both the players will see the text ‘Draw’ on the screen. We add one extra feature in the
game over module by introducing a text called “Click to play again’ and were very
optimistic that it should increase the usability of the developed software For displaying the
texts, we've used the canvas supported standard item call ereate_text function. In the game
over screen firstly we create @ rectangle on the canvas and fills it with appropnate colour and
inside that rectangle all the texts will appear. We've created the texts by adjusting the text
size. font style, text height, text width and text colour
> CLICK:
This module handles most of the game logic. A tkinter application runs most of its time inside
an event loop, which is entered via the main loop method. It waits for an event to happen
Events are generally key pressed or mouse operations by the users. We've already set the
game states globally by assigning the values STATE_TITLE_SCREEN to 0. STATE_X
TURN to 1, STATE_O_TURN to 2 and STATE_GAME_OVER to 3. In the click method
we've passed the first argument implicitly (called ‘self ) which is the reference to our main
class itself and it should have the ‘event’ object that merely describes what is actually
happened We begin our task by converting the pixels into gird coordinates and then we
have to check for the current game state condition and accordingly the game will continue
Now if game state is 0, then it will draw a new board on the screen and sets the game
states as the value of the first player If the game state is 11e. X's turn and the cell is emply
then the control goes to new move module (where we've to mandatorily pass the current
player and the board coordinates as arguments) and the appropnate cell is filled up with
symbol X Now it checks all the possible conditions (ie. whether player X has won or it is a
draw) one by one. So, at first the control moves to has won module and if the result is true
then it sets the game state to 3 and calls the game over module by passing the parameter
X wins’. If itis false then the control goes to is a draw module and if the result is true then
again it will set the game state to 3 and calls the game over module with the parameter
Draw’ If the result of both the cases 's false then only it will set the game state as 2 which is
nothing but player O can now take its tum. Now If the game state is 21 O's tum and the
cell is empty then the control goes to new move module and the appropriate cell is filled up= §3 SCRIBD (
Download now W
7
with symbol 0. Now, it checks all the possible conditions (i ¢ whether player © has won or it
'S a draw) one by one So, at first the control moves to has wen module and if the result is
true then it sets the game state to 3 and calls the game over module by passing the
Parameter ‘O wins’ If tis false then the control goes to Is @ draw module and if the result is
true then again it wil set the game state to 3 and calls the game over module with the
Parameter ‘Draw’. Ithe result of both the cases is false then only twill set the game state as
1 which is nothing but player 1 can now again take its tum. Finally, it checks for if the game
state Is being at 3 or not If tis 3, then it will reset the board by caling the module new
board and sets the game state according to the frst player With this we're completing most
of the work that is behind our game logic
> NEW MOVE:
This module 1s concemed with pacing the X's and O's in the selected cells on the board It
receives the current player and the gnd coordinates from the click module as an argument
‘and places the symbol of the player in the desired cell Now let us consider our board
structure
Here X and Y are 0 based gnd coordinates. If the current player is X then it will call the draw
X module (discussed later) with the grid coordinates and places the X symbol with
eppropniate size and colour into that gd. Now if the current player is O then it will call the
draw © module with the 0 based grid coordinates and places the O symbol into that cell
> DRAW
This module deals with drawing X on the canvas. So, for that what we've to do is, first of all
we've to convert the gnd into pixels and then we can start our drawing using canvas
supported standard packages namely create
‘grid_to_plxel module twice and we get the converted pixels. Now we must have to adjust
line. For that reason, we've called the
What is Scribd?
$3 Mm 62 A
Home Books Audiobooks Documents,&
SCRIBD ( Search
Download now
65
DATA FLOW DIAGRAM
Display
aF SE
= 83 SCRIBD (an Q
N
64 SYSTEM FLOW DIAGRAM= §3 SCRIBD
Download now W
19
> GRID TO PIXELS:
‘The main objective of this module is to transform the grid coordinate into
pixels. intuitively we've passed the grid coordinate as an argument and this
module returns accurate pixel coordinate of the centre. The pixel coordinate
should be calculated with the help of grid coordinate and the cell size. Thus, we
add the original cell size with the half of it and multiplied it with the gird
coordinate and stored the result in a variable called pixel_coord. By doing this,
the grid to pixel transformation is mostly done.
> PIXELS TO GRID:
It is just the reverse of the previous module. This module performs exactly
the opposite task, taking a pixel coordinate as an argument and converting this
into its equivalent grid coordinate. Somehow the canvas has a few extra pixels
on the right and bottom side so we've to fix this. For clipping the extra pixels,
we must check the condition that if the pixel coordinate is somehow greater
than the original window size then we've to reduce the window size. The
transformation can be achieved by dividing the pixel coordinates by the cell
size. The resultant grid can now be stored into a variable say grid_coord.
> — EXIT:
‘This module is used for closing the root window permanently. In this module
we've passed event as an argument based upon this event the window can be
closed. We want the access from the current instance in our exit © method
which ts done through self.
self .destroy ()
However, this only destroys the frame and its child windows, like the canvas,
not the top-level window.
What is Scribd?
$ M 63 cE)
Home Books Audiobooks Documents18
the width and height of the X so that no extra outline would appear in the right-hand side and
left-hand side. We divide he cell size by 2 and multiplied it with the symbol size and store it
in a variable called delta. By adjusting the delta, choosing the colour and selecting the width
in the create_line function we've completed our task
> DRAW O:
This module is concemed with drawing an O on the canvas. Like the previous module, here
also we've to convert the grid coordinates into pixels and then we've to adjust the O's in the
board. Again, we divided the cell size by 2 and multiplied it with the symbol size and
assigned it in a vanable called delta For drawing an O we've to use the canvas supported
standard package called create_oval function. In create_oval function, pixel coordinates are
adjusted in such a way that the O's have no odd lines on the left-hand side as well as right-
hand side. Then we select the appropnate width and the colour for O's so that it looks better
> HAS WON:
This module is concerned with checking for the winner and retums the result to an
appropnate calling function. In the click module, we've already converted the grids into
pixels and store them into some variables. Now the has_won function takes those pixels as
an argument and accordingly the board will fill up with the winning symbols. The checking for
the winner is quite simple. If any of the players can able to fill all the cells in a row vertically
or horizontally or diagonally, he /she will consider to be the clear winner. So, in the first for
loop, we basically check that whether all the cells of a row (vertically or horizontally or
diagonally) are filled with the same symbol or not Now if this condition satisfies, then the
Player with that symbol is the winner. In the second for loop we need to check those
Positions that are conventionally reserved for the winning position. So, we need to check the
Positions ({O}f0}{OL1}{O]2]) or (€110).(411]£1912)) or ((2I{0].211].{212)) or ({0J0},.11(0} [210})
Or (COND L1DL211}) or (CON). 02){212)) or (LOMO (111 ].{212]) or (10}{2),[1114],2][0)) and by
checking these positions we will certainly get the winner.
> IS A DRAW:
In this module, we're just checking the result is a tie or not. The result is a tie when all the
boxes/cells are filled. Checking whether it is a draw Is fairly straightforward. All we've to do is
check whether all the board boxes are filled We can do this by iterating through the board
array.A
66 USE CASE DIAGRAM§3 SCRIBD
Download now W
2B
67 INPUT DESIGN:
Input design is part of overall system design that requires special attention
designing input data is to make the data entered easy and free from errors, The
input forms are designed using the controls available in PYTHON
INTERPRETER. Validation 1s made for each and every event that is happened.
Help (how to play the game) information is provided for the users during when
the players feels difficult.
Input design ts the process of converting the user originated inputs to a
computer-based format. A system user interacting through a workstation must
be able to tell the system whether to accept the input to produce reports. The
collection of input data 1s considered to be most expensive part of the system
design. Since the input has to be planned in such a manner so as to get relevant
information, extreme care is taken to obtain pertinent information.
68 OUTPUT DESIGN:
Output design this application “TIC TAC TOE” generally refers to the results
and information that are generated by the system for many end-users; output is
the main reason for developing the system and the basis on which they evaluate
the usefulness of the application.
The output is designed in such a way that it is attractive, convenient and
informative. Board is designed with various features, which make the console
output more pleasing. As the outputs are the most important sources of
information to the users, better design should improve the system's
relationships with us and also will help in decision making. Form design
elaborates the way output is presented and the layout available for capturing
information.
One of the most important factors of the system is the output it produces.
This system refers to the results and information generated. Basically, the
output from a computer system is used to communicate the result of processing
to the user.
What is Scribd?
$3 M 69 A
Home Books Audiobooks Documents6} SCRIBD | L
Ill
Download now
Fry
SYSTEM TESTING
7.1 INTRODUCTION
once source code nas been generated, software must be tested {0 uncover and correct a5
0 customer Our goal 1s to design a series of test
many errors as possible before delivery t
To uncover the residual errors software
ding errors.
cases that have a high likelihood of fin
rovide systematic guidance for designing test that
techniques are used. These techniques p'
V_ Exercise the internal logic of software components, and
tt domains of the program to uncover errors in program
V- Exercise the input and output
function, behaviour and performance.
7.1.1 STEPS:
‘Software is tested from two different perspectives
—White box test case design techniques.
intemal program logic is exercised using
—block box test case design techniques
Software requirements are exercised using
In both cases, the intent is to find the maximum number of errors with the
minimum amount of effort and time and cost
72 TESTING METHODOLOGIES:
A strategy for sofware testing must accommedate low-level tests that are necessary '0
verity that @ small source code segment has been correctly implemented as well as high-
level tests that validate major system functions against customer requirements. A strategy
must provide guidance for the practioner and a set of milestones for the manager, Because
tho steps of the test strategy occur at a time when deadine pressure begins to nse, progress
must be measurable and problems must surface as early as possible Following testing
techniques are well known and the same strategy is adopted dunng this project testing
7.2.1 UNIT TESTING:
Since this is @ game which may have various forms of user input, it would be nearly
impossible to test every possible user combination. However, testing functionality
and likely user scenanos should be our overall goal of testing Tic-Tac-Toe Unit
testing focuses venfication effort on the smallest unit of software design- the sofware
component or module. The unit test is white-box onented. The unit testing is,
What is Scribd?
5 MO n @B
Home Books Audiobooks Documents§3 SCRIBD
Download now W
25
implemented in every module of this project by giving correct manual
‘input to the system, the inputted data are stored in database and can be
retrieved. If you want required module to access input or get the output
from the End user, any error will accrue that time will provide handler to
show what type of error will accrued,
7.2.2 INTEGRATION TESTING:
First and most importantly we will ensure the tkinter builds and runs
without errors. Also make sure it still works while embedded. GU! should
display correctly on the root window. There should be no states which
freeze the game. Switching between the players should update seamlessly
and no logical errors should occur. All warnings (highlights) should be
identified by the game state and displayed correctly by the GUI. all in all,
a full game should be playable without programming or logical errors.
7.2.3 SYSTEM TESTING:
System testing Is actually a series of different tests whose primary
Purpose is to fully exercise the computer-based system. Below we have
described the two types of testing which have been taken for this project.
its to check all modules worked on input basis. If you want change any
values or inputs, it will change all information, so specified input is must.
System testing can be stated as the process of validating and verifying
that a computer program / application / product:
¥ Meets the requirements that guided its design and development
¥ Works as expected
“Can be implemented with the same characteristics
v Satisfles the needs of stakeholders.
7.24 PERFORMANCE TESTING:
Performance testing is designed to test the run-time performance
of the software within the context of an integrated system.
Performance testing occurs throughout all steps in the testing
process. Even at the unit level, the performance of an individual
module may be assessed as white-box tests are conducted.
What is Scribd?
$3 M 62 E,)
Home Books Audiobooks Documents8. SYSTEM IMPLEMENTATION
81 PURPOSE
System implementation is the important stage of project when the theoretical design is tuned
into practical system. The main stages in the implementation are as follows
v Planning
Y Training
vy System testing and
v Changeover Planning
Planning is the first task in the system implementation. At the time of implementation of
any system people from different departments and system analysts involve. They are
confirmed to practical problem of controlling various activities of people outside their own
data processing departments
82 SYSTEM MAINTENANCE
Software maintenance is far more than finding mistakes. Provision must be made for
environment changes, which may affect either the computer. or other parts of the computer-
based systems. Such activity is normally called maintenance. It includes both the
improvement of the system functions and the corrections of faults, which anse during the
operation of a new system. It may involve the continuing involvement of a large proportion of
computer department recourses. The main task may be to adapt existing systems in a
changing environment. Back up for the entire database files are taken and stored in storage
devices like flash drives, pen drives and disks so that it is possible to restore the system at
the earliest. If there is a breakdown or collapse, then the system gives provision to restore
from database files. We focus on four types of maintenance
¥ Adaptive Maintenance
v Perfective Maintenance
v Corrective Maintenance
v Preventive MaintenanceDownload now W
2
9. CONCLUSION AND FUTURE ENHANCEMENTS
> ALLOW THE PLAYERS TO CHOOSE THE MODE OF THE GAME:
‘An option to select the mode of the game that is whether the player wants to play the game
with his/her fnends or with the machine
>» ALLOW THE PLAYERS TO DEFINE THE METRICS:
‘An option to increase the board to size ton x n, where n can be any positive number (>0)
This will increase the complexity of the code and when added with artificial intelligence wall
greatly make the game robust Also, we can add a feature where K(< n) consecutive
Marks/dots (filed by the user) is a point/score, Or we can go even further and use a range of
number n,
>» INTRODUCTION OF ARTIFICIAL INTELLIGENCE
‘An option of playing against the computer (machine) can be added too An algorithm can be
Implemented for the machine based on actual rules a player uses to fil the Tic-Tac-Toe
board This can pose @ challenge to the user when playing
>» INTRODUCTION OF DIFFICULTY LEVELS:
One option to select the ditficuty levels of the game can be added We would also like to
create @ computer AI that offered increasing resistance as the difficulty level increased
> USER PROFILES AND SCORES:
One of the other enhancements could be that users can create their profiles and save their
scores
> IN-GAME ASSISTANT:
An option to include an Assistant which will provide hints and suggestions to the user when
playing against a bot
What is Scribd?
$3 M1 62 A
Home Books Audiobooks Documents10. APPENDICES
10.1 PROGRAM LISTING
3
maw we
from tkinter import *
WINDOW_sIzz = 400
GRID_LINE_WIDTH = 2
SYMBOL_WIDTH = WINDOW_SIZE/80
SYMBOL_SIZE = 0.375
X_COLOR = ‘deep sky blued’
©_COLOR = ‘tomato!
DRAW_SCREEN_COLOR
GRID_COLOR = ‘black’
FIRST_PLAYER = 2
CELL_SIZE = WINDOW_SIZE / 3
STATE TITLE SCREEN = 0
STATE_X_TURN
STATE_O_TURN
STATE_GAME_OVER
‘light sea green’
EMPTY = 0
x=.
o=2
class Game (Tk):
def init (selé
Tk.__init__ (self)
self.canvas = Canvas(height=WINDOW_STZE,
width=WINDOW_SIZE, bi
‘white’)
1£. canvas. pack ()
self.bind('Ge>', self. exit)
self.canvas.bind('', self.click)
self.gamestate = STATE_TITLE_SCREEN
self.title_screen()
self.board = [
(EMPTY, EMPTY, EMPTY),
(EMPTY, EMPTY, EMPTY],
(EMPTY, EMPTY, EMPTY]]
def title screen(self):
self.canvas.delete(’all')
self. canvas. create_rectangle(0, 0,WINDOW_SIZE,
WINDOW_SIZE, fill="white’ , ourlint
self.canvas, create_rectangle( int (WINDOW_SIZE/15),
int (WINDOW_SIZE/15),
int (WINDOW_STZE*14/15),
int (WINDOW _SIZE*14/15),
outLine='')
self.canvas.create_rectangle( int (WINDOW_SIZE/10),
int (WINDOW_SIZE/10),
int (WINDOW_SIZE*9/10),
int (WINDOW_SIZE*S/10),
f£ill='light blue’, outline='')
28Download now
29
self.canvas. create_text (WINDOW_SIZE/2, WINDOW SIZE/3,
text='T1C TAC TOE', fi11=' black’,
font=(‘Calibri', int (-WINDOW_SIZE/12),
‘bold underline’ ))
nelé. canvas. create_text (int (WINDOW_SIZE/2),
“int (WINDOW_STZE/2.5),
text=' [click to play]', fill='purple',
font=(‘Arial’, int (-WINDOW_SIZE/25)) )
def new board(self):
self.canvas.delete(' all’)
self.board = [
(EMPTY, EMPTY, EMPTY],
[eMPTY, EMPTY, EMPTY],
(eMpry, EMPTY, EMPTY] ]
for n in range(1, 3)
self.canvas.create_line(CELL_SIZE*n, 0,
~ CELL_S1ZE*n, WINDOW_SI2R,
width=GRID_LINE_WIDTH,
£il1=GRID_CoLoR)
self.canvas.create_line(0, CELL_SIZE*n,
~ WINDOW SIZE, CELL_sIze*n,
width=GRID_LINE_WIDTH, £i11=GRID_COLOR )
def gameover_screen(self, outcome):
aelf.canvas.delete(’ all’)
Af outcome == °x WINS.
wintext = x wins
ncelor = ‘Light green’
elif outcome o wis’:
wintext = °0 wins
wincolor = 'gold2
elif outcome Raw
wintext = ‘Draw
wincolor = DRAW_SCREEN_COLOR
self.canvas. create_rectangle( 0, 0,
WINDOW_SIZE, WINDOW_SIZE,
fill=wincolor, outline="")
self.canvas, create_text(int (WINDOW_SIZB/2), int (WINDOW_SIZE/2),
text=wintext, fill='black’,
font=('Calibri’, int (-WINDOW_SI2E/6),
bold")
self.canvas.create_text( int (WINDOW SIZB/2), int (WINDOW STZB/1.65),
text=' [Click to play againj',
fill=' purple’, font=(/arial
nt (-WINDOW_STZB/25)) )
def click(selt, event):
x = selt.pixel_to_grid (event. x)
y = self.pixel to_grid(event.y)
if self.gamestate == STATE TITLE_SCREEN:
self.new_board()
selt.gamestate = FIRST_PLAYER
elif (self. gamestate==STATE_XCTURN and self, boardly) [x]
self. new move (X, x, ¥)
if self. has_won(x)
self.gamestate = STATE_GAME_OVER
self. gameover_screen('X WINS!)
eLif self.is a draw():
self.gamestate = STATE_GAME OVER
self. gameover_screen( DRAW )= §3 SCRIBD (search
O @ 0
x Xx
O
O O |X O
x x x
x O X}O/}O |X O
O|O
x
O}|O
What is Scribd? ‘oy
$ (I 62 A
Home Books Audiobooks Documents= $3) SCRIBD ( Search Q )
Yona CeTeM Cond W
32
10.2. SCREEN SHOTS:
x Pewee =
| |
|
I
|
POE
O O Oo oO O
TIC TAC TOE
jaro payi
x
x
x%)
W
def grid_to_pixel(self, grid_coord):
pinelicoord = grid coord * ceutsrae ¢ cet srzE / 2
def pinel_to_grid(se.
ixel_coord) :
Af Pixel_coord
}O%_Sr 2B,
pixel_coord = WINDOW_SIze - 1
grid_coord = int (pixel_coord / CELL stzz)
return grid_coord
def exit (self, event):
selE.destroy()
lef main(
oot = Game()
Foot. title("TIc TAC TOE")
Foot.mainloop()
maing)
What is Scribd?
$3 M G2 A
Home Books Audiobooks Documents= §3 SCRIBD |
load now W
Dow
else
seLf.gameatate = STATE_O_TURN
lig (seLE gamestate==STATE_O_TURN and sel f.board(y] (31
self-new_move(O, x, ¥)
Af self has_won(o):
seLé.gameatate = STATE_GAME_OVER
self.gameover_screen(?O WINS’)
elif self.is_adraw():
jeLE.gamentate = STATE GANE_OVER
self.gameover_screen( DRAW’)
else:
selé.gamestate = STATE_X_TURN
cLiE pelf.gamentate == STATE_GAME_OVE!
14 self new_board()
us self.gamestate = PIRST PLAYER
dof nowmove(aelf, player, grids, grid_y)?
VF player
Belf.deae x(geid_x, grid_y)
self, board (grid_yl (geid_¥] = x
elif player == 0:
aelf.draw O(grid_x, geid_y)
seit board (grid_yl (gtid_x] = ©
def draw x(self, grid_x, grid_y):
x= sel€.grid_to_pixel (grid x)
y = self-grideo pixel (grid_y)
delta = CELL _S128/2*sreor_S1ze
jelf-canvas.create_Line( xcdelta, y-delta,
xedelta, yedelte
width sYMBOL WIDTH, £11)
eLf.canvas.create_line( xtdelta, y-delta,
vedelta, yrdelta:
wideh=SMBOL_ WIDTH, £i11=X COLOR )
COLOR)
def draw o(self, grid_x, grid_y)
x = self.grid_to_pixel(grid_x)
y = self.grid_to_pixel(grid_y)
delta = CELL _S128/2*sysoL_Srze
pelf.cenvas.create_oval( x-delta, y-delta,
xtdelta, yedelta,
width=SiMBOL_WEDTH, outline=o_couon )
def has_won(self, symbol):
for y in range (3
Af gelf.board[y] == (symbol, symbol, symbol):
for x in range (3)
LE set board{O} (<]=
revucn Tr
A€ self, board(0) (0}—=seLf, board( 1) (11=
elit seit. board{o) (2)
‘return True
ass return False
jet boardl 1] [x]++aeL£ -board(2] (x]=+s¥abol:
sf. boardl21
=symbol:
ye. boardt2) 0)
elt boaratt) [1)
‘symbol:
A nr L a wstol gl oto bg
$ C 62 A
Home Books. Audiobooks Documents= §3 SCRIBD | Search
Download now W
11. BIBLIOGRAPHY
BOOKS REFERENCES:
Python Without Fear BRIAN OVERLAND.
Python and Tkinter Programming JOHN E. GRAYSON.
A Practical Introduction to python Programming BRIAN HEINHOLD.
Invent Your Own Computer Games with Python 3” Edition AL SWEIGART.
ae & NH
‘The Coder's Apprentice Learning Programming with Python 3 PIETER SPRONCK.
OTHER REFERENCES:
1. Tic Tac Toe Documentation Release 0.1 by Deterralba December 18. 2015.
2. International Journal of Computer Trends and Technology (IJCTT) -
volume 12 number2- Jun 2014 ISSN: 2231-2803 http://www. ijcttjournal.org/
Page71 Implementation of Tic-Tac-Toe Game in LabVIEW.
3. Interactive tic tac toe Stefan Bennie Botha.
WEBSITES:
4. https://effbot.org/
2. http://codeproject.com/
3. http://sta