0% found this document useful (0 votes)
80 views19 pages

Kendriya Vidyalaya No.2 A.F.S Tambaram: Dots and Boxes Game

This document describes a Dots and Boxes game project created by Aniket Singh, a class 12 student at Kendriya Vidyalaya No. 2 in Tambaram, India. The project uses Tkinter to build a graphical user interface for playing the Dots and Boxes game on the computer. It includes an introduction to the classic pencil-and-paper game, the objectives and design of the computer implementation, including the modules, user interface, backend, hardware and software requirements, and algorithm. The document also discusses the advantages and drawbacks of the project.

Uploaded by

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

Kendriya Vidyalaya No.2 A.F.S Tambaram: Dots and Boxes Game

This document describes a Dots and Boxes game project created by Aniket Singh, a class 12 student at Kendriya Vidyalaya No. 2 in Tambaram, India. The project uses Tkinter to build a graphical user interface for playing the Dots and Boxes game on the computer. It includes an introduction to the classic pencil-and-paper game, the objectives and design of the computer implementation, including the modules, user interface, backend, hardware and software requirements, and algorithm. The document also discusses the advantages and drawbacks of the project.

Uploaded by

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

KENDRIYA VIDYALAYA NO.

2
A.F.S TAMBARAM

Dots and boxes game


2021-2022

NAME: ANIKET SINGH CLASS: XII A

SUBJECT: COMPUTER SCIENCE REG NO:

pg. 1
KENDRIYA VIDYALAYA NO.2
A.F.S TAMBARAM

XII COMPUTER SCIENCE


PROJECT
2021-2022

Dots and boxes game

DONE BY: ANIKET SINGH

PROJECT MENTOR: DHANASHREE SONTAKKE


Kendriya Vidyalaya no-2 tambaram,
Chennai 73

certificate

This is to certify that this submitted

by (R.no
) to the Computer Department, Kendriya Vidyalaya

No.2 Tambaram, Chennai, was carried out by her/him under towards

partial completion of Practical Exam, during

academicyear 2021-22.

Internal Examiner External Examiner

PRINCIPAL
ACKNOWLEDGEMENT

I take this opportunity to place record on my profound


respect to our principal Mrs for guiding
light to my success.

I would like to thank my subject teacher Dhanashree


sontakke (P.G.T Computer science) who had guided,
encouraged and supported me to do this project work
successfully.

I am really fortunate to receive the blessings from my


parents whose profound love was the source of
inspiration for my endeavors.

I thank my friends and classmates who helped


methroughout the project work.
INDEX
S.no Title Page

1. INTRODUCTION
2. OBJECTIVE
3. DESIGN:
 MODULES
 USER
INTERFACE
 BACKEND

HARDWARE&
SOFTWARE
 ALGORITHM
4. ADVANTAGES
AND
DRAWBACKS
5. REFERENCE
INTRODUCTION

ABOUT THE PROJECT

Dots and Boxes is a pencil-and-paper game for two players (sometimes more). It was
first published in the 19th century by French mathematician Édouard Lucas, who called
it la pipopipette.

It has gone by many other names, including the dots and dashes, game of dots,
dot to dot grid, boxes, and pigs in a pen.

 The game starts with an empty grid of dots.

 Usually two players take turns adding a single horizontal or vertical line
between two unjoined adjacent dots.

 A player who completes the fourth side of a 1×1 box earns one point and takes
another turn.

 A point is typically recorded by placing a mark that identifies the player in the box,
such as an initial.

 The game ends when no more lines can be placed. The winner is the player with
the most points.

The board may be of any size grid. When short on time, or to learn the game, a 2×2 board (3×3 dots) is
suitable. A 5×5 board, on the other hand, is good for experts.
The diagram on the right shows a game being played on a 2×2 board (3×3 dots).
The second player ("B") plays a rotated
mirror image of the first player's moves,
hoping to divide the board into two pieces and tie the game. But the first player
("A") makes a sacrifice at move 7 and B accepts the sacrifice, getting one box.
However, B must now add another line, and so B connects the center dot to the
center-right dot, causing the remaining unscored boxes to be joined together in a
chain (shown at the end of move 8). With A's next move, A gets all three of them
and ends the game, winning 3–1.

 In combinatorial game theory, Dots and Boxes is an impartial game and many
positions can be analyzed using Sprague–Grundy theory. However, Dots and
Boxes lacks the normal play convention of most impartial games (where the last
player to move wins), which complicates the analysis considerably.

 For most novice players, the game begins with a phase of more-or-less
randomly connecting dots, where the only strategy is to avoid adding the third
side to any box.

 This continues until all the remaining (potential) boxes are joined together into
chains – groups of one or more adjacent boxes in which any move gives all the
boxes in the chain to the opponent.

 At this point, players typically take all available boxes, then open the
smallest available chain to their opponent.

 For example, a novice player faced with a situation like position 1 in the diagram on
the right, in which some boxes can be captured, may take all the boxes in the chain,
resulting in position 2. But, with their last move, they have to open the next, larger
chain, and the novice loses the game.
WHY DO YOU WANT TO DO?

Benefits of playing this game


Dots and Boxes is a game that helps in not with the arithmetic parts of math, but with
the –

 Geometric

 Logical

elements of math that are the underpinning of so much mathematical development.

Considering how under-emphasized these parts of math can be in a typical classroom, this
game is a great supplement for kids of all ages.

Where's the Math?

The math of Dots and Boxes begins to reveal itself after


you play a couple of quick rounds.

 Your child may draw in the third side of a box,


only to realize that you can happily claim that box on the
next turn.

 So they begin to look at the game board a little


differently, focusing on "safe" lines that they can draw. The beginning of the game
turns into a dance, where both

 opponents circle each other, adding lines in new locations while being careful not
to draw the third side on any box, lest their opponent claim that fourth side.
Eventually, of course, someone is going to run out of safe spots to play,
and the race for boxes begins in earnest.

 Then a new question presents itself:

How can I claim more than one box in a single turn?

 Your child might begin to notice that if they create little chains of boxes across the
board, they can fill in multiple squares on a single turn. For example, in the image
below, the blue player is able to capture three boxes in a row by capturing the
chain of boxes that runs around the top left corner of the board.

 Once you've played a couple of rounds on a 4x4 grid, you should move up to
larger grids such as 6x6 or 8x8 so that these chains of boxes become more
apparent to you and to your child.

 Once you see the chains of boxes, you begin to look at the board with an even
more refined perspective on the spatial relationships that the board contains.

 Each new insight into the strategy of the game allows you to see new things in
what would otherwise be a simplistic set of dots and lines.

 Dots and Boxes is a game that helps your child, not with the arithmetic parts of
math, but with the geometric and logical elements of math that are the underpinning
of so much mathematical development.
 Considering how under-emphasized these parts of math can be in a typical
classroom, this game is a great supplement for kids of all ages.

Questions to Ask
Dots and Boxes is a great game for questions with your kid, since the game is accessible
to kids as young as 5 while still being a strategic challenge for teenagers and adults.
 For the younger kids, a great question to ask is "Is this line safe to draw?"You
can ask this question on your turn or on theirs, with the same goal in mind:
getting your child to determine whether a line will allow the opponent to claim
a box.

 This sort of simple, repeated question can help your child hone in on the
strategy of the game.

 Once your child has the basics down, you can start asking deeper questions to pull
out the strategy of the game. A great start is "How can you claim more than one box
in a turn?" You can even ask your child to draw a sample game board to show how
they can capture multiple boxes at once. Once they can create a chain of boxes on a
sample board, they can work toward building those chains in the game!

 Lastly, you can always find some sort of puzzle in games like this. Here's a quick
one: How many lines can you draw without completing a single
box? That's a challenge that you and your child could both try!
DESIGN

MODULES
 TKINTER

 The tkinter package (“Tk interface”) is the standard Python interface to the
Tcl/Tk GUI toolkit. Both Tk and tkinter are available on most Unix
platforms, including macOS, as well as on Windows systems.
 Running python -m tkinter from the command line should open a
window demonstrating a simple Tk interface, letting you know
that tkinter is properly installed on your system, and also showing what version
of Tcl/Tk is installed, so you can read the Tcl/Tk documentation specific to that
version.
 Tkinter supports a range of Tcl/Tk versions, built either with or without thread
support. The official Python binary release bundles Tcl/Tk 8.6 threaded. See the
source code for the _tkinter module for more information about supported
versions.
 Tkinter is not a thin wrapper, but adds a fair amount of its own logic to make the
experience more pythonic. This documentation will concentrate on these additions
and changes, and refer to the official Tcl/Tk documentation for details that are
unchanged.

Standard attributes
Let us take a look at how some of their common attributes.such as sizes, colors and fonts
are specified.
 Dimensions
 Colors
 Fonts
 Anchors
 Relief styles
 Bitmaps

 cursors

 Numpy

NumPy, which stands for Numerical Python, is a library consisting of multidimensional


array objects and a collection of routines for processing those arrays. Using NumPy,
mathematical and logical operations on arrays can be performed.

NumPy is a Python package. It stands for ‘Numerical Python’. It is a library


consisting of multidimensional array objects and a collection of routines for
processing of array.

Numeric, the ancestor of NumPy, was developed by Jim Hugunin.

Another package Numarray was also developed, having some additional


functionalities. In 2005, Travis Oliphant created NumPy package by incorporating the
features of Numarray into Numeric package.

There are many contributors to this open-source project.

Operations using NumPy

Using NumPy, a developer can perform the following operations −

 Mathematical and logical operations on arrays.


 Fourier transforms and routines for shape manipulation.
 Operations related to linear algebra. NumPy has in-built functions for linear
algebra and random number generation.
 Csv
CSV (Comma Separated Values) is a simple file format used to store tabular data, such as
a spreadsheet or database.

 A CSV file stores tabular data (numbers and text) in plain text. Each line of the
file is a data record. Each record consists of one or more fields, separated by
commas.

 The use of the comma as a field separator is the source of the name for this file
format.

 For working CSV files in python, there is an inbuilt module called csv.

The csv module implements classes to read and write tabular data in CSV format.

It allows programmers to say, “write this data in the format preferred by Excel,” or “read
data from this file which was generated by Excel,” without knowing the precise details of
the CSV format used by Excel.

Programmers can also describe the CSV formats understood by other applications or
define their own special-purpose CSV formats.
USER INTERFACE

1. Player 1 starts the game

2. Click on edges to mark them

3. If a box is made, it gets shaded with the player assigned color

4. When all the edges are marked, the result is displayed on the result screen

5. Click anywhere on the result screen to play again


BACKEND

 CSV (Comma Separated Values) is a simple file format used to store tabular data,
such as a spreadsheet or database.
 A CSV file stores tabular data (numbers and text) in plain text. Each line of the
file is a data record.
 Each record consists of one or more fields, separated by commas. The use of the
comma as a field separator is the source of the name for this file format.

In this python project the data is stored inside a csv file where the data of no of
 rounds
 winners list
is been stored and will be fetched when the game ends on the screen for
summary
HARDWARE AND SOFTWARE REQUIRMENT

 Hardware Requirement:

 i3 Processor Based Computer or higher


 Memory: 1 GB RAM
 Hard Drive: 50 GB
 Monitor

 Software Requirement:

 Windows 7 or higher
 Python latest
 Pycharm
ALGORITHM

1. Import modules tkinter and numpy

2. Using tkinter module make the necessary GUI by providing reasonable

dimensions

3. Initialize size of the board number of boxes

4. Initialize distance between the dots

5. Initialize logical functions

6. Initialize drawing functions

7. Initialize program terminating functions


ADVANTAGES & DRAWBACKS

 Advantages

 The system is user-friendly and has simple interface.

 Can be used in manufacturing company

 Limitation

 Data need to be entered properly otherwise , outcome may won’t be accurate.

 Application

 This system can be used by the multiple peoples to get the advantage of the

game
REFERENCE

https://www.google.com/
https://github.com/
https://www.youtube.com/

You might also like