Professional Documents
Culture Documents
Dice Rolling Simulator - Jagrit Sahni
Dice Rolling Simulator - Jagrit Sahni
JAGRIT SAHNI
CANDIDATE’S DECLARATION
I hereby certify that the work which is being presented in this Project entitled “Dice Rolling
Simulator Using Python ” in partial fulfillment of requirement for the award of degree of B.
Tech., Computer Science and Engineering submitted in Department of Computer Science &
Engineering at Guru Nanak Institute of Technology, Mullana, Ambala affiliated to Kurukshetra
University , Kurukshetra is an authentic record of my work carried out under the supervision of
Mr Sidharth Arora Head of Department, Department of CSE ,GNIT, Mullana, Ambala.
ABSTRACT
The specification Device Identity Composition Engine (DICE) provides a novel basis for remote
attestations specifically suitable in the IoT context. Its purpose is to provide means for remote
attestations to devices that are too size-, cost-, energy-or otherwise constrained to have
Trusted Platform Module attached. This paper gives a short explanation of DICE and compares
different approaches for building up a remote attestation protocol based on it, using symmetric
and asymmetric cryptography .Based on this comparison a symmetric attestation protocol is
proposed for most resource constrained devices and its implications for attestation servers are
discussed. Furthermore a feasibility study is conducted mapping the DICE and the proposed
DICE-based attestation approach to commercial off-the-shelf (COTS) hardware --namely
Arduino Uno in this case --and measurement of the code size, binary size and added
computational requirements is provided. The security of the mapping approach is evaluated
and its advantages and pit falls are demonstrated. The goal is to show how DICE-based
approaches can be mapped to existing hardware and how a more secure IoT environment can
be established on already deployed devices without changes to the hardware.
TABLE OF FIGURES
Figures Title
TABLE OF CONTENTS
Particulars
Abstract
Table of figures
Chapter 1
1.Introduction
1.1 Overview
1.2 Tkinter
1.3 Steps Involved
Chapter 2
Technology
1. Python 3.0
2. Installation
3. Reason of using python
Chapter 3
System Design
1. python 3 Installation On window
2. Pycharm 29
1.Features of pycharm
2.Built in develpoer tools
3.Web Development
Chapter 4
System design and implementation
1.trial.py
2.qr project.py
Chapter 5
Dice Rolling Simulator code
Conclusion
Future scope
References
CHAPTER -1
Introduction
A traditional die is a cube, with each of its six faces showing a different
number of dots (pips) from 1 to 6. When thrown or rolled, the die comes
to rest showing on its upper surface a random integer from one to six
,each value being equally likely. A variety of similar devices are also
described as dice; such specialized dice may have polyhedral or
irregular shapes and may have faces marked with symbols instead of
numbers. They may be used to produce results other than one through
six. Loaded and crooked dice are designed to favor some results over
others for purposes of cheating or amusement A dice tray, a tray used to
contain thrown dice, is sometimes used for gambling or board games, in
particular to allow dice throws which do not interfere with other game
pieces.
Fig 1.1
Tkinter-
Python offers various packages to design the GUI, i.e. the Graphical User
Interface. Tkinter is the most common, fast, and easy to use Python
package used to build Graphical User Interface applications. It provides a
powerful Object-Oriented Interface and is easy to use. Also, you develop an
application; you can use it on any platform, which reduces the need of
amendments required to use an app on Windows, Mac, or Linux.
Fig 1.2
CHAPTER -2
Technology Used
2.1 Python3.0
fig.2.1
Python features a dynamic type system and automatic memory management and
supports multiple programming including object-oriented, imperative, functional
programming, and procedural styles. It has a large and comprehensive standard
library.
Python interpreters are available for many operating systems, allowing Python
code to run on a wide variety of systems. C Python, the reference implementation
of Python, is open source software and has a community-based development
model, as do nearly all of its variant implementations. C Python is managed by the
non-profit Python Software Foundation The Python Software Foundation (PSF) is
a 501(c)(3) non-profit corporation that holds the intellectual property rights behind
the Python programming language.
We manage the open source licensing for Python version 2.1 and later and own and
protect the trademarks associated with Python. We also run the North American
PyCon conference annually, support other Python conferences around the world,
and fund Python related development with our grants program and by funding
special.
Python might not have bright years in the past years (which is mainly launch in the
year 1991) but it has seen a continuous and amazing trend of growth in the 21st
century. This stack overflow graph of major programming languages’ growth
exclusively depicts the steady progress of the PYTHON!
The growth rate of python was not something easy to achieve. Python programming
language is better used for app development, web app or web development, game
development, scientific computing, system administration, etc.
There are several traits of this programming tool which has provided it with an
incredibly successful journey. Python has a main role in the new-edge technologies of
current and upcoming times like ML and AI.
2.2 Installing
Installing Python is generally easy, and nowadays many Linux and UNIX distributions
include a recent Python. Even some Windows computers (notably those from HP) now
come with Python already installed. If you do need to install Python and aren't
confident about the task you can find a few notes, but installation is unremarkable on
most platforms.
•You will not need to be an administrator (unless a system update for the C
Runtime Library is required or you install the Python Launcher for
Windows for all users)
fig 2.2
2.3 Reasons Why You Must Consider Writing Software Applications in Python
At present, Python is supports many operating systems. You can even use Python
interpreters to run the code on specific platforms and tools. Also, Python is an
interpreted programming language. It allows you to you to run the same code on
multiple platforms without recompilation. Hence, you are not required to
recompile the code after making any alteration. You can run the modified
application code without recompiling and check the impact of changes made to
the code immediately. The feature makes it easier for you to make changes to the
code without increasing development time.
4) Robust Standard Library
Its large and robust standard library makes Python score over other programming
languages. The standard library allows you to choose from a wide range of modules
according to your precise needs. Each module further enables you to add
functionality to the Python application without writing additional code. For instance,
while writing a web application in Python, you can use specific modules to
implement web services, perform string operations, manage operating system
interface or work with internet protocols. You can even gather information about
various modules by browsing through the Python Standard Library documentation.
•The Python Launcher for Windows will be installed according to the option at the
bottom of the first page
•The standard library, test suite, launcher and pip will be installed
CHAPTER-3
SYSTEM DESIGN
1. Open your web browser and navigate to the Downloads for Windows section of the
official Python website
2.Search for your desired version of Python. At the time of publishing this article, the
latest Python 3 release is version 3.7.
while the latest Python 2 release is version 2.7.16.
3. Select a link to download either the Windows x86-64 executable installer or
Windows x86 executable installer. The download is approximately 25MB.
fig 3.2
4. The next dialog will prompt you to select whether to Disable path length
limit. Choosing this option will allow Python to bypass the 260-character
MAX_PATH limit. Effectively, it will enable Python to use long path names.
fig3.3
Path to Environment
Variables (Optional) •
fig 3.6
•Type sysdm. cpl and click OK. This opens the System Properties window.
•. Navigate to the Advanced tab and select Environment Variables.
•. Under System Variables, find and select the Path variable.
•. Click Edit.
•. Select the Variable value field. Add the path to the python.exe file
preceded with a semicolon (;). For example, in the image below, we
have added “;C:\Python34.”
fig3.7
.
2. VCS, Deployment and Remote Development
Save time with a unified UI for working with Git, SVN, Mercurial or other version control
systems. Run and debug your application on remote machines. Easily configure automatic
deployment to a remote host or VM and manage your infrastructure with Vagrant and
Docker.
3. Database tools
Access Oracle, SQL Server, PostgreSQL, MySQL and other databases right from the IDE.
Rely on PyCharm’s help when editing
SQL code, running queries, browsing data, and altering schemas.
3.2.3 WEB DEVELOPMENT
In addition to Python, PyCharm provides first-class support for various Python web
development frameworks, specific template languages, JavaScript, CoffeeScript,
TypeScript, HTML/CSS, AngularJS, Node.js, and more.
Live Edit
Live Editing Preview lets you open a page in the editor and the browser and see the changes
being made in code instantly in the browser. PyCharm auto-saves your changes, and the
browser smartly updates the page on the fly, showing your edits.
Live Edit
Live Editing Preview lets you open a page in the editor and the browser and see the
changes being made in code instantly in the browser. PyCharm auto-saves your
changes, and the browser smartly updates the page on the fly, showing your edits.
Let’s create a dice roll simulation code using the Python tkinter library.
We all love playing board games like snakes and ladders, ludo our
utmost favorite one. But what if you don’t have a dice or you lost it
somewhere. It’s a major mood off for everyone who is excited to play
along.
pip install tk
root = Tk( ) : The root window is created. The root window is a main
application window in our programs. It has a title bar and borders. These
are provided by the window manager. It must be created before any
other widgets.
Root . geometry(“400×400”) : The geometry method sets a size for the
window and positions it on the screen. The two parameters are the
width and height of the window.
def roll():
#unicodes must have a backslash
dice=['\u2680','\u2681','\u2682','\u2683','\u2684','\u2685']
l1.config(text=f'{random.choice(dice)}{random.choice(dice)}')
l1.pack()
We will now define our function roll( ) to create our dice roll simulation.
Now we will create a dice variable in which we will store the list of all
the ASCII characters of that string will be stored.
We will then congif the label.
Future Scope
In this project we have used the random module for this ,since we want to randomize the
numbers we get from the dice. It can be further improved by making a attractive graphical user
interface or any other upgradation to this that it can be supported in most of the device.
Beginner s of games or any gamer can easily get its concept and plays it because it is fully user
friendly. We are still working on implementing some graphical interface.
Reference
www.iotwebplanet.com ›
pypi.org ›
www.asp.com.au›
https://www.scribd.com/presentation/410927469/Dice-Rolling-Simulator-Using-
Python-PPT
.