SlideShare a Scribd company logo
1 of 19
Title:Tic Tac Toe
A Project Report for Summer Industrial Training
Submitted by:
1.>ARBAAZ ASLAM (NARULA INSTITUTE OF TECHNOLOGY),
2.>JUNAID AHSAN (BPPIMT, KOLKATA) and
3.>SYED HOZAIFA ALI (BPPIMT, KOLKATA).
In partial fulfillment for the award of the degree of
Summer Industrial Training 2017
At
Ogma TechLab Pvt. Ltd.
June-July 2017
Ogma TechLab Pvt. Ltd
BONAFIDE CERTIFICATE
Certified that this project work was carried out under my supervision
“Tic Tac Toe” is the bona fide work of
Name of the student: SYED HOZAIFA ALI Signature:
Name of the student: JUNAID ASHSAAN Signature:
Name of the student: ARBAAZ ASLAM Signature:
PROJECT MENTOR:AMAR BANERJEE
SIGNATURE:
OgmaTech Lab Original Seal:
Acknowledgement
I take this opportunity to express my deep gratitude and
sincerest thank you to my project mentor, Mr Amar Banerjee for
giving most valuable suggestion, helpful guidance and
encouragement in the execution of this project work.
I will like to give a special mention to my colleagues. Last but
not the least I am grateful to all the faculty members of OGMA
TECH LAB Pvt. Ltd. for their support.
INDEX
Table of Contents Page No
• Abstract
• Introduction of the Project
• Objectives
• Tools/Platform, Hardware and Software Requirement
specifications Goals of Implementation.
• Overview.
• Codes (Manifest codes, xml codes).
 DFD.
• Use Case Diagram.
 Future scope and further enhancement of the Project.
• Testing.
• Conclusion.
ABSTRACTION
Tic-tac-toe
A completed game of Tic-tac-toe
Genre(s) Paper-and-pencil game
Players 2
Setup time Minimal
Playing time ~1 minute
Random chance None
Skill(s) required Strategy, tactics, observation
Synonym(s) Naught and crosses
Xs and Os
Tic-tac-toe (also known as naughtand crossesor Xs and Os) is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3
grid. The play er who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row wins the game.
The f ollowing example gameis won by thefirst player, X:
Play ers soon discover that best play from both parties leads to a draw. Hence, tic-tac-toe is most often played by youngchildren.
INTRODUCTION
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 that deals with the searching of game trees. It
is straightforward to write a computer program to play tic-tac-toe perfectly, to enumerate the 765
essentially different positions (the state space complexity), or the 26,830 possible games up to rotations
and reflections (the game tree complexity) on this space.
The game can be generalized to an m, n, k-game in which two players alternate placing stones of their
own color on an m ×n board, with the goal of getting k of their own color in a row. Tic-tac-toe is the
(3,3,3)-game. Harary's generalized tic-tac-toe is an even broader generalization of tic tac toe. It can also
be generalized as nd game. Tic-tac-toe is the game where n equals 3 and d equals 2. If played properly,
the game will end in a draw making tic-tac-toe a futile game.
OBJECTIVES:
 An app which can fulfill your gaming requirements.
 Forget about papers and pencil, thus environmental friendly.
 Fun is a portable story with this type of app.
 With less space on your hard disk install and play instantly.
Tools/Platform, Hardwareand Software Requirement
specifications.
Tools
• Android Studio(Software)
• Android Phone
Platform
Windows 7/8/10
Hardware Requirement Specification
Criterion Description
Disk Space 500 MB diskspace for
Android Studio,atleast
1.5 GB for AndroidSDK,
emulatorsystem
images,andcaches
RAM 3 GB RAM minimum, 8
GB RAMrecommended;
plus1 GB for the
AndroidEmulator
Java Version Java DevelopmentKit(JDK) 8
Software Requirement Specification
• Java -> Java SE
• Android SDK -> Android Studio and SDK Tools
OVERVIEW
• The project is aimed at creating efficiency of the students forthose who have no basic idea about
the game “tic tac toe” and thus this android application will help the students to learn according to their
time and polish their skill.
• The idea is to increase efficiency and reduce the learning time in most effective way for the
students.This would make the learners to use mobile phone and polish their skills in programming
languages in this era of technology advancement.
CODES
package com.example.junaidahsan.tictactoe;
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class Act1 extends AppCompatActivity implements View.OnClickListener {
int turn_count = 0;
Button[] bArray = null;
Button a1, a2, a3, b1, b2, b3, c1, c2, c3;
boolean turn=true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_act1);
a1 = (Button) findViewById(R.id.A1);
b1 = (Button) findViewById(R.id.B1);
c1 = (Button) findViewById(R.id.C1);
a2 = (Button) findViewById(R.id.A2);
b2 = (Button) findViewById(R.id.B2);
c2 = (Button) findViewById(R.id.C2);
a3 = (Button) findViewById(R.id.A3);
b3 = (Button) findViewById(R.id.B3);
c3 = (Button) findViewById(R.id.C3);
bArray = new Button[] { a1, a2, a3, b1, b2, b3, c1, c2, c3 };
for (Button b : bArray)
b.setOnClickListener(this);
Button bnew = (Button) findViewById(R.id.button1);
bnew.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
turn = true;
turn_count = 0;
enableOrDisable(true);
}
});
}
@Override
public void onClick(View v) {
// just to be clear. as no other views are registered YET,
// it is safe to assume that only
// the 9 buttons call this on click
buttonClicked(v);
}
private void buttonClicked(View v) {
Button b = (Button) v;
if (turn) {
// X's turn
b.setText("X");
} else {
// O's turn
b.setText("O");
}
turn_count++;
b.setClickable(false);
b.setBackgroundColor(Color.LTGRAY);
turn = !turn;
checkForWinner();
}
private void checkForWinner() {
// NOOB TECHNIQUE...
// if used repeatedly, causes several mental injuries
// dont try this at home
boolean there_is_a_winner = false;
// horizontal:
if (a1.getText() == a2.getText() && a2.getText() == a3.getText()
&& !a1.isClickable())
there_is_a_winner = true;
else if (b1.getText() == b2.getText() && b2.getText() == b3.getText()
&& !b1.isClickable())
there_is_a_winner = true;
else if (c1.getText() == c2.getText() && c2.getText() == c3.getText()
&& !c1.isClickable())
there_is_a_winner = true;
// vertical:
else if (a1.getText() == b1.getText() && b1.getText() == c1.getText()
&& !a1.isClickable())
there_is_a_winner = true;
else if (a2.getText() == b2.getText() && b2.getText() == c2.getText()
&& !b2.isClickable())
there_is_a_winner = true;
else if (a3.getText() == b3.getText() && b3.getText() == c3.getText()
&& !c3.isClickable())
there_is_a_winner = true;
// diagonal:
else if (a1.getText() == b2.getText() && b2.getText() == c3.getText()
&& !a1.isClickable())
there_is_a_winner = true;
else if (a3.getText() == b2.getText() && b2.getText() == c1.getText()
&& !b2.isClickable())
there_is_a_winner = true;
// i repeat.. DO NOT TRY THIS AT HOME
if (there_is_a_winner) {
if (!turn)
message("X wins");
else
message("O wins");
enableOrDisable(false);
} else if (turn_count == 9)
message("Draw!");
}
private void message(String text) {
Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT)
.show();
}
private void enableOrDisable(boolean enable) {
for (Button b : bArray) {
b.setText("");
b.setClickable(enable);
if (enable) {
b.setBackgroundColor(Color.parseColor("#33b5e5"));
} else {
b.setBackgroundColor(Color.LTGRAY);
}
}
}
}
package com.example.user.login;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;
public class Act2 extends AppCompatActivity {
TextView editText;
Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_act2);
btn=(Button)findViewById(R.id.btn);
editText=(TextView)findViewById(R.id.editText);
Bundle b=getIntent().getExtras();
String Username=b.getString("username");
String Password=b.getString("password");
editText.setText("Username is :"+Username+"and Password is :"+Password);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.menu,menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
case R.id.menu1:
Toast toast=Toast.makeText(getApplicationContext(),"MENU 1 IS
sELECTED",Toast.LENGTH_LONG);
toast.show();
return true;
case R.id.menu2:
Toast toast1=Toast.makeText(getApplicationContext(),"MENU 1 IS
sELECTED",Toast.LENGTH_LONG);
toast1.show();
return true;
case R.id.menu3:
Toast toast2=Toast.makeText(getApplicationContext(),"MENU 1 IS
sELECTED",Toast.LENGTH_LONG);
toast2.show();
return true;
default:return super.onOptionsItemSelected(item);
}
}
public void popup(View view){
PopupMenu popupMenu = new PopupMenu(Act2.this,btn);
popupMenu.getMenuInflater().inflate(R.menu.popup,popup(););
}
}
MANIFEST codes:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.user.tictactoe">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".splashscreen"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".MainActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
</activity>
</application>
</manifest>
Data Model:
Data flow diagram:
USE CASE DIAGRAM
FURTHER ENHANCEMENT
Using the code
The solution has three projects - TicTacToeLib is the main project and it contains all the gamelogic is the test project, and TicTacToe is a Windows Forms project to
display the game, but it can easily be replaced by any other GUI project type (WPF, Web, etc).
Two classes handle thegamelogic - Boardand Field. Boardis a container of Fields.
The Fieldclass' only purpose is to keep information about its status. It can be EMPTY, which is the default value,or PLAYER1/PLAYER2.
Whenever status is changed, the FieldStatusChangedevent is fired.
public class Field
{
private FIELD_STATUS _fieldStatus;
public event EventHandler FieldStatusChanged;
// some code omitted
public FIELD_STATUS FieldStatus
{
get
{
return _fieldStatus;
}
set
{
if (value != _fieldStatus)
{
_fieldStatus = value;
OnFieldStatusChanged();
}
}
The Boardclass listens to FieldStatusChanged events from its Fieldscollection and checks for end game conditions. Event handlers
are created after fieldsfor each field in the Boardclass.
Hide Copy Code
private void AddFieldEventListeners()
{
for (int i = 0; i < _fields.GetLength(0); i++)
{
for (int j = 0; j < _fields.GetLength(1); j++)
{
_fields[i, j].FieldStatusChanged += Board_FieldStatusChanged;
}
}
}
From game rules we can definefive end gameconditions:
 Win condition when all fields in the same row belong to one player. In code terms, all field status inPLAYER1or PLAYER2are in the same row.
 Win condition when all fields in the same column belong to one player
 Win condition when all fields in the main diagonal belong to one player
 Win condition when all fields are in anti-diagonal belonging to one player
 Tie condition when all fields have a value other than EMPTY, but no win conditions apply.
Whenever status in any field changes, the CheckWinConditionmethod is invoked in the Boardclass. If any win condition or tie is applicable,
board fires the GameEndevent. As a parameter, event sends the GameStatusclass which is a simple two enum collection withinformation about the
winning player and the win condition. The caller should handle it appropriately - in this example, theWindows Form disablesall controls used to display fields,
displays the game result, and highlights the winning row, column, or diagonal.
And finally testing. Since classes Fieldand GameStatusare simple, only the Boardclass is covered with tests. There arenine testsin
the BoardTests class. First three check if the Board class throws exceptions with a bad constructor parameter.
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void TestConstructorFieldNull()
{
Board board = new Board(null);
}
[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void TestConstructorFieldNotSquareMatrix()
{
Field[,] fields = new Field[2, 3];
fields[0, 0] = new Field();
fields[0, 1] = new Field();
fields[0, 2] = new Field();
fields[1, 0] = new Field();
fields[1, 1] = new Field();
fields[1, 2] = new Field();
Board board = new Board(fields);
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void TestConstructorNullFieldsInMatrix()
{
Field[,] fields = new Field[3, 3];
fields[0, 0] = new Field();
fields[0, 1] = new Field();
fields[0, 2] = new Field();
fields[1, 0] = new Field();
fields[1, 1] = null;
fields[1, 2] = new Field();
fields[2, 0] = new Field();
fields[2, 1] = new Field();
fields[2, 2] = new Field();
Board board = new Board(fields);
}
The forth test tests if the Fieldscollection is successfully set as theclass Fieldsproperty.
Hide Copy Code
[TestMethod]
public void TestConstructorRegularCase()
{
Field[,] fields = new Field[3, 3];
fields[0, 0] = new Field();
fields[0, 1] = new Field();
fields[0, 2] = new Field();
fields[1, 0] = new Field();
fields[1, 1] = new Field();
fields[1, 2] = new Field();
fields[2, 0] = new Field();
fields[2, 1] = new Field();
fields[2, 2] = new Field();
Board board = new Board(fields);
Assert.AreEqual(fields.GetLength(0), board.Fields.GetLength(0));
Assert.AreEqual(fields.GetLength(1), board.Fields.GetLength(1));
}
The last five tests simulate and test win conditions. All testshave threeparts,first the Boardobject construction:
Hide Copy Code
[TestMethod]
public void TestAllFieldsInRowWinCondition()
{
Field[,] fields = new Field[3, 3];
fields[0, 0] = new Field() { FieldStatus = FIELD_STATUS.EMPTY };
fields[0, 1] = new Field() { FieldStatus = FIELD_STATUS.EMPTY };
fields[0, 2] = new Field() { FieldStatus = FIELD_STATUS.EMPTY };
fields[1, 0] = new Field() { FieldStatus = FIELD_STATUS.EMPTY };
fields[1, 1] = new Field() { FieldStatus = FIELD_STATUS.EMPTY };
fields[1, 2] = new Field() { FieldStatus = FIELD_STATUS.EMPTY };
fields[2, 0] = new Field() { FieldStatus = FIELD_STATUS.EMPTY };
fields[2, 1] = new Field() { FieldStatus = FIELD_STATUS.EMPTY };
fields[2, 2] = new Field() { FieldStatus = FIELD_STATUS.EMPTY };
Board board = new Board(fields);
Second, the event handler is created for the Board GameEnd event. When the event is fired, it will assert if the board returned the correct win
parameters:
Hide Copy Code
board.GameEnd += (sender, e) =>
{
Assert.AreEqual(GAME_STATUS.PLAYER_ONE_WON, e.GameProgress);
Assert.AreEqual(WIN_CONDITION.ROW, e.WinCondition);
Assert.AreEqual(0, e.WinRowOrColumn);
};
Third, the game is simulated by changing the board field status:
Hide Copy Code
fields[0, 0].FieldStatus = FIELD_STATUS.PLAYER1;
// [X] [ ] [ ]
// [ ] [ ] [ ]
// [ ] [ ] [ ]
fields[1, 1].FieldStatus = FIELD_STATUS.PLAYER2;
// [X] [ ] [ ]
// [ ] [0] [ ]
// [ ] [ ] [ ]
fields[0, 1].FieldStatus = FIELD_STATUS.PLAYER1;
// [X] [X] [ ]
// [ ] [0] [ ]
// [ ] [ ] [ ]
fields[2, 2].FieldStatus = FIELD_STATUS.PLAYER2;
// [X] [X] [ ]
// [ ] [0] [ ]
// [ ] [ ] [0]
fields[0, 2].FieldStatus = FIELD_STATUS.PLAYER1;
// [X] [X] [X]
// [ ] [0] [ ]
// [ ] [ ] [ ]
TESTING
. Testing
Team Interaction
The following describes the level of team interaction necessary to have a successful product.
 The Test Team will work closely with the Development Team to achieve a high quality design and user
interface specifications based on customer requirements. The Test Teamis responsible for visualizing test cases
and raising quality issues and concerns during meetings to address issues early enough in the development
cycle.
 The Test Team will work closely with Development Team to determine whether or not the application meets
standards for completeness. If an area is not acceptable for testing, the code complete date will be pushed out,
giving the developers additional time to stabilize the area.
 Since the application interacts with a back-end system component, the Test Teamwill need to include a plan for
integration testing. Integration testing must be executed successfully prior to systemtesting.
Test Objective
The objective our test plan is to find and report as many bugs as possible to improve the integrity of our program.
Conclusion:
Gaming becomes modern when played on tabs, mobiles etc .Enjoy with your friend , anytime and anyplace.

More Related Content

What's hot

project on snake game in c language
project on snake game in c languageproject on snake game in c language
project on snake game in c languageAshutosh Kumar
 
Final Year Project of Online Food Ordering System
Final Year Project of Online Food Ordering SystemFinal Year Project of Online Food Ordering System
Final Year Project of Online Food Ordering SystemSidraShehbaz
 
Attendance management system project report.
Attendance management system project report.Attendance management system project report.
Attendance management system project report.Manoj Kumar
 
Online Voting System Project File
Online Voting System Project FileOnline Voting System Project File
Online Voting System Project FileNitin Bhasin
 
Online Quiz System Project Report
Online Quiz System Project Report Online Quiz System Project Report
Online Quiz System Project Report Kishan Maurya
 
e-commerce web development project report (Bookz report)
e-commerce web development project report (Bookz report)e-commerce web development project report (Bookz report)
e-commerce web development project report (Bookz report)Mudasir Ahmad Bhat
 
college website project report
college website project reportcollege website project report
college website project reportMahendra Choudhary
 
quiz game project report.pdf
quiz game project report.pdfquiz game project report.pdf
quiz game project report.pdfzccindia
 
Machine learning Summer Training report
Machine learning Summer Training reportMachine learning Summer Training report
Machine learning Summer Training reportSubhadip Mondal
 
408372362-Student-Result-management-System-project-report-docx.docx
408372362-Student-Result-management-System-project-report-docx.docx408372362-Student-Result-management-System-project-report-docx.docx
408372362-Student-Result-management-System-project-report-docx.docxsanthoshyadav23
 
Banking Management System Project documentation
Banking Management System Project documentationBanking Management System Project documentation
Banking Management System Project documentationChaudhry Sajid
 
E learning project report (Yashraj Nigam)
E learning project report (Yashraj Nigam)E learning project report (Yashraj Nigam)
E learning project report (Yashraj Nigam)Yashraj Nigam
 
Final project report of a game
Final project report of a gameFinal project report of a game
Final project report of a gameNadia Nahar
 
E farming management system project ppt
E farming management system project pptE farming management system project ppt
E farming management system project pptnandinim26
 
Placement management system
Placement management systemPlacement management system
Placement management systemMehul Ranavasiya
 

What's hot (20)

project on snake game in c language
project on snake game in c languageproject on snake game in c language
project on snake game in c language
 
Final Year Project of Online Food Ordering System
Final Year Project of Online Food Ordering SystemFinal Year Project of Online Food Ordering System
Final Year Project of Online Food Ordering System
 
Complete-Mini-Project-Report
Complete-Mini-Project-ReportComplete-Mini-Project-Report
Complete-Mini-Project-Report
 
Attendance management system project report.
Attendance management system project report.Attendance management system project report.
Attendance management system project report.
 
Compiler design lab programs
Compiler design lab programs Compiler design lab programs
Compiler design lab programs
 
Online Voting System Project File
Online Voting System Project FileOnline Voting System Project File
Online Voting System Project File
 
Online Quiz System Project Report
Online Quiz System Project Report Online Quiz System Project Report
Online Quiz System Project Report
 
e-commerce web development project report (Bookz report)
e-commerce web development project report (Bookz report)e-commerce web development project report (Bookz report)
e-commerce web development project report (Bookz report)
 
college website project report
college website project reportcollege website project report
college website project report
 
quiz game project report.pdf
quiz game project report.pdfquiz game project report.pdf
quiz game project report.pdf
 
Machine learning Summer Training report
Machine learning Summer Training reportMachine learning Summer Training report
Machine learning Summer Training report
 
408372362-Student-Result-management-System-project-report-docx.docx
408372362-Student-Result-management-System-project-report-docx.docx408372362-Student-Result-management-System-project-report-docx.docx
408372362-Student-Result-management-System-project-report-docx.docx
 
Simple Calculator Flowchart
Simple Calculator FlowchartSimple Calculator Flowchart
Simple Calculator Flowchart
 
Banking Management System Project documentation
Banking Management System Project documentationBanking Management System Project documentation
Banking Management System Project documentation
 
E learning project report (Yashraj Nigam)
E learning project report (Yashraj Nigam)E learning project report (Yashraj Nigam)
E learning project report (Yashraj Nigam)
 
Final project report of a game
Final project report of a gameFinal project report of a game
Final project report of a game
 
E farming management system project ppt
E farming management system project pptE farming management system project ppt
E farming management system project ppt
 
Atm project
Atm projectAtm project
Atm project
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Placement management system
Placement management systemPlacement management system
Placement management system
 

Similar to Synopsis tic tac toe

Visual Component Testing -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
Visual Component Testing  -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...Visual Component Testing  -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
Visual Component Testing -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...Applitools
 
MIND GAME ZONE - Abhijeet
MIND GAME ZONE - AbhijeetMIND GAME ZONE - Abhijeet
MIND GAME ZONE - AbhijeetAbhijeet Kalsi
 
Building Conversational Experiences with Actions on Google
Building Conversational Experiences with Actions on Google Building Conversational Experiences with Actions on Google
Building Conversational Experiences with Actions on Google Peter Friese
 
12th CBSE Computer Science Project
12th CBSE Computer Science Project  12th CBSE Computer Science Project
12th CBSE Computer Science Project Ashwin Francis
 
Mini Max Algorithm Proposal Document
Mini Max Algorithm Proposal DocumentMini Max Algorithm Proposal Document
Mini Max Algorithm Proposal DocumentUjjawal Poudel
 
project report in C++ programming and SQL
project report in C++ programming and SQLproject report in C++ programming and SQL
project report in C++ programming and SQLvikram mahendra
 
Snake game implementation in c
Snake game implementation in cSnake game implementation in c
Snake game implementation in cUpendra Sengar
 
Year 5-6: Ideas for teaching coding
Year 5-6: Ideas for teaching codingYear 5-6: Ideas for teaching coding
Year 5-6: Ideas for teaching codingJoanne Villis
 
Improving Engagement of Students in Software Engineering Courses through Gami...
Improving Engagement of Students in Software Engineering Courses through Gami...Improving Engagement of Students in Software Engineering Courses through Gami...
Improving Engagement of Students in Software Engineering Courses through Gami...Facultad de Informática UCM
 
ma project
ma projectma project
ma projectAisu
 
Discussions In your own words (75-150 words)Due Sunday, May .docx
Discussions     In your own words (75-150 words)Due Sunday, May .docxDiscussions     In your own words (75-150 words)Due Sunday, May .docx
Discussions In your own words (75-150 words)Due Sunday, May .docxedgar6wallace88877
 
tic tac toe.pptx
tic tac toe.pptxtic tac toe.pptx
tic tac toe.pptxrocky720491
 
進擊的UX - the basics of UX and Rapid prototyping @ CHT
進擊的UX - the basics of UX and Rapid prototyping @ CHT進擊的UX - the basics of UX and Rapid prototyping @ CHT
進擊的UX - the basics of UX and Rapid prototyping @ CHT伯方 蘇
 
Gdc09 Minigames
Gdc09 MinigamesGdc09 Minigames
Gdc09 MinigamesSusan Gold
 

Similar to Synopsis tic tac toe (20)

Visual Component Testing -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
Visual Component Testing  -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...Visual Component Testing  -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
Visual Component Testing -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
 
Ip project
Ip projectIp project
Ip project
 
MIND GAME ZONE - Abhijeet
MIND GAME ZONE - AbhijeetMIND GAME ZONE - Abhijeet
MIND GAME ZONE - Abhijeet
 
TIC-TAC-TOE IN C
TIC-TAC-TOE IN CTIC-TAC-TOE IN C
TIC-TAC-TOE IN C
 
Javascript status 2016
Javascript status 2016Javascript status 2016
Javascript status 2016
 
ELAVARASAN.pdf
ELAVARASAN.pdfELAVARASAN.pdf
ELAVARASAN.pdf
 
Building Conversational Experiences with Actions on Google
Building Conversational Experiences with Actions on Google Building Conversational Experiences with Actions on Google
Building Conversational Experiences with Actions on Google
 
12th CBSE Computer Science Project
12th CBSE Computer Science Project  12th CBSE Computer Science Project
12th CBSE Computer Science Project
 
Mini Max Algorithm Proposal Document
Mini Max Algorithm Proposal DocumentMini Max Algorithm Proposal Document
Mini Max Algorithm Proposal Document
 
project report in C++ programming and SQL
project report in C++ programming and SQLproject report in C++ programming and SQL
project report in C++ programming and SQL
 
Snake game implementation in c
Snake game implementation in cSnake game implementation in c
Snake game implementation in c
 
Year 5-6: Ideas for teaching coding
Year 5-6: Ideas for teaching codingYear 5-6: Ideas for teaching coding
Year 5-6: Ideas for teaching coding
 
Improving Engagement of Students in Software Engineering Courses through Gami...
Improving Engagement of Students in Software Engineering Courses through Gami...Improving Engagement of Students in Software Engineering Courses through Gami...
Improving Engagement of Students in Software Engineering Courses through Gami...
 
ma project
ma projectma project
ma project
 
Discussions In your own words (75-150 words)Due Sunday, May .docx
Discussions     In your own words (75-150 words)Due Sunday, May .docxDiscussions     In your own words (75-150 words)Due Sunday, May .docx
Discussions In your own words (75-150 words)Due Sunday, May .docx
 
Pong
PongPong
Pong
 
tic tac toe.pptx
tic tac toe.pptxtic tac toe.pptx
tic tac toe.pptx
 
進擊的UX - the basics of UX and Rapid prototyping @ CHT
進擊的UX - the basics of UX and Rapid prototyping @ CHT進擊的UX - the basics of UX and Rapid prototyping @ CHT
進擊的UX - the basics of UX and Rapid prototyping @ CHT
 
ChatGPT in Education
ChatGPT in EducationChatGPT in Education
ChatGPT in Education
 
Gdc09 Minigames
Gdc09 MinigamesGdc09 Minigames
Gdc09 Minigames
 

Recently uploaded

(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 

Recently uploaded (20)

Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 

Synopsis tic tac toe

  • 1. Title:Tic Tac Toe A Project Report for Summer Industrial Training Submitted by: 1.>ARBAAZ ASLAM (NARULA INSTITUTE OF TECHNOLOGY), 2.>JUNAID AHSAN (BPPIMT, KOLKATA) and 3.>SYED HOZAIFA ALI (BPPIMT, KOLKATA). In partial fulfillment for the award of the degree of Summer Industrial Training 2017 At Ogma TechLab Pvt. Ltd. June-July 2017
  • 2. Ogma TechLab Pvt. Ltd BONAFIDE CERTIFICATE Certified that this project work was carried out under my supervision “Tic Tac Toe” is the bona fide work of Name of the student: SYED HOZAIFA ALI Signature: Name of the student: JUNAID ASHSAAN Signature: Name of the student: ARBAAZ ASLAM Signature: PROJECT MENTOR:AMAR BANERJEE SIGNATURE: OgmaTech Lab Original Seal:
  • 3. Acknowledgement I take this opportunity to express my deep gratitude and sincerest thank you to my project mentor, Mr Amar Banerjee for giving most valuable suggestion, helpful guidance and encouragement in the execution of this project work. I will like to give a special mention to my colleagues. Last but not the least I am grateful to all the faculty members of OGMA TECH LAB Pvt. Ltd. for their support.
  • 4. INDEX Table of Contents Page No • Abstract • Introduction of the Project • Objectives • Tools/Platform, Hardware and Software Requirement specifications Goals of Implementation. • Overview. • Codes (Manifest codes, xml codes).  DFD. • Use Case Diagram.  Future scope and further enhancement of the Project. • Testing. • Conclusion. ABSTRACTION Tic-tac-toe
  • 5. A completed game of Tic-tac-toe Genre(s) Paper-and-pencil game Players 2 Setup time Minimal Playing time ~1 minute Random chance None Skill(s) required Strategy, tactics, observation Synonym(s) Naught and crosses Xs and Os Tic-tac-toe (also known as naughtand crossesor Xs and Os) is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The play er who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row wins the game. The f ollowing example gameis won by thefirst player, X: Play ers soon discover that best play from both parties leads to a draw. Hence, tic-tac-toe is most often played by youngchildren. INTRODUCTION 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 that deals with the searching of game trees. It is straightforward to write a computer program to play tic-tac-toe perfectly, to enumerate the 765
  • 6. essentially different positions (the state space complexity), or the 26,830 possible games up to rotations and reflections (the game tree complexity) on this space. The game can be generalized to an m, n, k-game in which two players alternate placing stones of their own color on an m ×n board, with the goal of getting k of their own color in a row. Tic-tac-toe is the (3,3,3)-game. Harary's generalized tic-tac-toe is an even broader generalization of tic tac toe. It can also be generalized as nd game. Tic-tac-toe is the game where n equals 3 and d equals 2. If played properly, the game will end in a draw making tic-tac-toe a futile game. OBJECTIVES:  An app which can fulfill your gaming requirements.  Forget about papers and pencil, thus environmental friendly.  Fun is a portable story with this type of app.  With less space on your hard disk install and play instantly. Tools/Platform, Hardwareand Software Requirement specifications. Tools • Android Studio(Software) • Android Phone Platform Windows 7/8/10 Hardware Requirement Specification Criterion Description Disk Space 500 MB diskspace for Android Studio,atleast 1.5 GB for AndroidSDK, emulatorsystem images,andcaches RAM 3 GB RAM minimum, 8
  • 7. GB RAMrecommended; plus1 GB for the AndroidEmulator Java Version Java DevelopmentKit(JDK) 8 Software Requirement Specification • Java -> Java SE • Android SDK -> Android Studio and SDK Tools OVERVIEW • The project is aimed at creating efficiency of the students forthose who have no basic idea about the game “tic tac toe” and thus this android application will help the students to learn according to their time and polish their skill. • The idea is to increase efficiency and reduce the learning time in most effective way for the students.This would make the learners to use mobile phone and polish their skills in programming languages in this era of technology advancement. CODES package com.example.junaidahsan.tictactoe; import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; public class Act1 extends AppCompatActivity implements View.OnClickListener { int turn_count = 0; Button[] bArray = null; Button a1, a2, a3, b1, b2, b3, c1, c2, c3; boolean turn=true; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_act1); a1 = (Button) findViewById(R.id.A1); b1 = (Button) findViewById(R.id.B1); c1 = (Button) findViewById(R.id.C1); a2 = (Button) findViewById(R.id.A2); b2 = (Button) findViewById(R.id.B2);
  • 8. c2 = (Button) findViewById(R.id.C2); a3 = (Button) findViewById(R.id.A3); b3 = (Button) findViewById(R.id.B3); c3 = (Button) findViewById(R.id.C3); bArray = new Button[] { a1, a2, a3, b1, b2, b3, c1, c2, c3 }; for (Button b : bArray) b.setOnClickListener(this); Button bnew = (Button) findViewById(R.id.button1); bnew.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { turn = true; turn_count = 0; enableOrDisable(true); } }); } @Override public void onClick(View v) { // just to be clear. as no other views are registered YET, // it is safe to assume that only // the 9 buttons call this on click buttonClicked(v); } private void buttonClicked(View v) { Button b = (Button) v; if (turn) { // X's turn b.setText("X"); } else { // O's turn b.setText("O"); } turn_count++; b.setClickable(false); b.setBackgroundColor(Color.LTGRAY); turn = !turn; checkForWinner(); } private void checkForWinner() { // NOOB TECHNIQUE... // if used repeatedly, causes several mental injuries // dont try this at home boolean there_is_a_winner = false; // horizontal: if (a1.getText() == a2.getText() && a2.getText() == a3.getText() && !a1.isClickable()) there_is_a_winner = true; else if (b1.getText() == b2.getText() && b2.getText() == b3.getText() && !b1.isClickable()) there_is_a_winner = true; else if (c1.getText() == c2.getText() && c2.getText() == c3.getText() && !c1.isClickable())
  • 9. there_is_a_winner = true; // vertical: else if (a1.getText() == b1.getText() && b1.getText() == c1.getText() && !a1.isClickable()) there_is_a_winner = true; else if (a2.getText() == b2.getText() && b2.getText() == c2.getText() && !b2.isClickable()) there_is_a_winner = true; else if (a3.getText() == b3.getText() && b3.getText() == c3.getText() && !c3.isClickable()) there_is_a_winner = true; // diagonal: else if (a1.getText() == b2.getText() && b2.getText() == c3.getText() && !a1.isClickable()) there_is_a_winner = true; else if (a3.getText() == b2.getText() && b2.getText() == c1.getText() && !b2.isClickable()) there_is_a_winner = true; // i repeat.. DO NOT TRY THIS AT HOME if (there_is_a_winner) { if (!turn) message("X wins"); else message("O wins"); enableOrDisable(false); } else if (turn_count == 9) message("Draw!"); } private void message(String text) { Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT) .show(); } private void enableOrDisable(boolean enable) { for (Button b : bArray) { b.setText(""); b.setClickable(enable); if (enable) { b.setBackgroundColor(Color.parseColor("#33b5e5")); } else { b.setBackgroundColor(Color.LTGRAY); } } } } package com.example.user.login; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.PopupMenu; import android.widget.TextView;
  • 10. import android.widget.Toast; public class Act2 extends AppCompatActivity { TextView editText; Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_act2); btn=(Button)findViewById(R.id.btn); editText=(TextView)findViewById(R.id.editText); Bundle b=getIntent().getExtras(); String Username=b.getString("username"); String Password=b.getString("password"); editText.setText("Username is :"+Username+"and Password is :"+Password); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.menu,menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case R.id.menu1: Toast toast=Toast.makeText(getApplicationContext(),"MENU 1 IS sELECTED",Toast.LENGTH_LONG); toast.show(); return true; case R.id.menu2: Toast toast1=Toast.makeText(getApplicationContext(),"MENU 1 IS sELECTED",Toast.LENGTH_LONG); toast1.show(); return true; case R.id.menu3: Toast toast2=Toast.makeText(getApplicationContext(),"MENU 1 IS sELECTED",Toast.LENGTH_LONG); toast2.show(); return true; default:return super.onOptionsItemSelected(item); } } public void popup(View view){ PopupMenu popupMenu = new PopupMenu(Act2.this,btn); popupMenu.getMenuInflater().inflate(R.menu.popup,popup();); } } MANIFEST codes: <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  • 13.
  • 14. USE CASE DIAGRAM FURTHER ENHANCEMENT Using the code The solution has three projects - TicTacToeLib is the main project and it contains all the gamelogic is the test project, and TicTacToe is a Windows Forms project to display the game, but it can easily be replaced by any other GUI project type (WPF, Web, etc).
  • 15. Two classes handle thegamelogic - Boardand Field. Boardis a container of Fields. The Fieldclass' only purpose is to keep information about its status. It can be EMPTY, which is the default value,or PLAYER1/PLAYER2. Whenever status is changed, the FieldStatusChangedevent is fired. public class Field { private FIELD_STATUS _fieldStatus; public event EventHandler FieldStatusChanged; // some code omitted public FIELD_STATUS FieldStatus { get { return _fieldStatus; } set { if (value != _fieldStatus) { _fieldStatus = value; OnFieldStatusChanged(); } } The Boardclass listens to FieldStatusChanged events from its Fieldscollection and checks for end game conditions. Event handlers are created after fieldsfor each field in the Boardclass. Hide Copy Code private void AddFieldEventListeners() { for (int i = 0; i < _fields.GetLength(0); i++) { for (int j = 0; j < _fields.GetLength(1); j++) { _fields[i, j].FieldStatusChanged += Board_FieldStatusChanged; } }
  • 16. } From game rules we can definefive end gameconditions:  Win condition when all fields in the same row belong to one player. In code terms, all field status inPLAYER1or PLAYER2are in the same row.  Win condition when all fields in the same column belong to one player  Win condition when all fields in the main diagonal belong to one player  Win condition when all fields are in anti-diagonal belonging to one player  Tie condition when all fields have a value other than EMPTY, but no win conditions apply. Whenever status in any field changes, the CheckWinConditionmethod is invoked in the Boardclass. If any win condition or tie is applicable, board fires the GameEndevent. As a parameter, event sends the GameStatusclass which is a simple two enum collection withinformation about the winning player and the win condition. The caller should handle it appropriately - in this example, theWindows Form disablesall controls used to display fields, displays the game result, and highlights the winning row, column, or diagonal. And finally testing. Since classes Fieldand GameStatusare simple, only the Boardclass is covered with tests. There arenine testsin the BoardTests class. First three check if the Board class throws exceptions with a bad constructor parameter. [TestMethod] [ExpectedException(typeof(ArgumentNullException))]
  • 17. public void TestConstructorFieldNull() { Board board = new Board(null); } [TestMethod] [ExpectedException(typeof(ArgumentException))] public void TestConstructorFieldNotSquareMatrix() { Field[,] fields = new Field[2, 3]; fields[0, 0] = new Field(); fields[0, 1] = new Field(); fields[0, 2] = new Field(); fields[1, 0] = new Field(); fields[1, 1] = new Field(); fields[1, 2] = new Field(); Board board = new Board(fields); } [TestMethod] [ExpectedException(typeof(ArgumentNullException))] public void TestConstructorNullFieldsInMatrix() { Field[,] fields = new Field[3, 3]; fields[0, 0] = new Field(); fields[0, 1] = new Field(); fields[0, 2] = new Field(); fields[1, 0] = new Field(); fields[1, 1] = null; fields[1, 2] = new Field(); fields[2, 0] = new Field(); fields[2, 1] = new Field(); fields[2, 2] = new Field(); Board board = new Board(fields); } The forth test tests if the Fieldscollection is successfully set as theclass Fieldsproperty. Hide Copy Code [TestMethod] public void TestConstructorRegularCase() { Field[,] fields = new Field[3, 3]; fields[0, 0] = new Field(); fields[0, 1] = new Field(); fields[0, 2] = new Field(); fields[1, 0] = new Field(); fields[1, 1] = new Field(); fields[1, 2] = new Field(); fields[2, 0] = new Field(); fields[2, 1] = new Field(); fields[2, 2] = new Field(); Board board = new Board(fields);
  • 18. Assert.AreEqual(fields.GetLength(0), board.Fields.GetLength(0)); Assert.AreEqual(fields.GetLength(1), board.Fields.GetLength(1)); } The last five tests simulate and test win conditions. All testshave threeparts,first the Boardobject construction: Hide Copy Code [TestMethod] public void TestAllFieldsInRowWinCondition() { Field[,] fields = new Field[3, 3]; fields[0, 0] = new Field() { FieldStatus = FIELD_STATUS.EMPTY }; fields[0, 1] = new Field() { FieldStatus = FIELD_STATUS.EMPTY }; fields[0, 2] = new Field() { FieldStatus = FIELD_STATUS.EMPTY }; fields[1, 0] = new Field() { FieldStatus = FIELD_STATUS.EMPTY }; fields[1, 1] = new Field() { FieldStatus = FIELD_STATUS.EMPTY }; fields[1, 2] = new Field() { FieldStatus = FIELD_STATUS.EMPTY }; fields[2, 0] = new Field() { FieldStatus = FIELD_STATUS.EMPTY }; fields[2, 1] = new Field() { FieldStatus = FIELD_STATUS.EMPTY }; fields[2, 2] = new Field() { FieldStatus = FIELD_STATUS.EMPTY }; Board board = new Board(fields); Second, the event handler is created for the Board GameEnd event. When the event is fired, it will assert if the board returned the correct win parameters: Hide Copy Code board.GameEnd += (sender, e) => { Assert.AreEqual(GAME_STATUS.PLAYER_ONE_WON, e.GameProgress); Assert.AreEqual(WIN_CONDITION.ROW, e.WinCondition); Assert.AreEqual(0, e.WinRowOrColumn); }; Third, the game is simulated by changing the board field status: Hide Copy Code fields[0, 0].FieldStatus = FIELD_STATUS.PLAYER1; // [X] [ ] [ ] // [ ] [ ] [ ] // [ ] [ ] [ ] fields[1, 1].FieldStatus = FIELD_STATUS.PLAYER2; // [X] [ ] [ ] // [ ] [0] [ ] // [ ] [ ] [ ] fields[0, 1].FieldStatus = FIELD_STATUS.PLAYER1; // [X] [X] [ ] // [ ] [0] [ ] // [ ] [ ] [ ] fields[2, 2].FieldStatus = FIELD_STATUS.PLAYER2; // [X] [X] [ ] // [ ] [0] [ ] // [ ] [ ] [0] fields[0, 2].FieldStatus = FIELD_STATUS.PLAYER1; // [X] [X] [X] // [ ] [0] [ ]
  • 19. // [ ] [ ] [ ] TESTING . Testing Team Interaction The following describes the level of team interaction necessary to have a successful product.  The Test Team will work closely with the Development Team to achieve a high quality design and user interface specifications based on customer requirements. The Test Teamis responsible for visualizing test cases and raising quality issues and concerns during meetings to address issues early enough in the development cycle.  The Test Team will work closely with Development Team to determine whether or not the application meets standards for completeness. If an area is not acceptable for testing, the code complete date will be pushed out, giving the developers additional time to stabilize the area.  Since the application interacts with a back-end system component, the Test Teamwill need to include a plan for integration testing. Integration testing must be executed successfully prior to systemtesting. Test Objective The objective our test plan is to find and report as many bugs as possible to improve the integrity of our program. Conclusion: Gaming becomes modern when played on tabs, mobiles etc .Enjoy with your friend , anytime and anyplace.