Online Restaurant Management System

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 19

Bangladesh University of Business and Technology

BUBT

Report On
Catch the Fruit
Conduct By:
Pias Miah 19201103054
Md Israfil Islam 19201103075
Md Alamin Shikder 19201103068
Asha Akter 19201103077

Advisor:
Ms. Humayra Ahmed
Lecturer
Department of Computer Science and Engineering
Bangladesh University of Business and Technology-BUBT
Declaration of Authorship
We, Pias Miah, Md Israfil Islam, Md Alamin Shikder, Asha Akter declare this
project “Catch The Fruit” and the work presented in it are our own. We confirm that.
This work was done mainly for B.Sc. Engineering in CSE degree at this university.
There any part of this project has been submitted for a qualification from this
university. We have acknowledged all main sources of help. We have consulted the
published work of others; this is always clearly attributed.

-------------------------- -------------------------- ----------------------- -----------------------


Pias Miah Md Israfil Islam Md Alamin Shikder Asha Akter
(19201103054) (19201103059) (19201103068) (19201103077)

ii
Certificate
This is to certify that we are students of B.Sc. in CSE have completed the report work
titled “Catch The Fruit” satisfactory in partial for the requirement of B.Sc. in CSE
Bangladesh university of Business and Technology in the year 2022.

Project Report Supervisor:


Ms. Humayra Ahmed
Lecturer
Department of Computer Science and Engineering
Bangladesh University of Business and Technology-
BUBT

iii
Dedication
Dedicated to our loving parents and all honorable teachers for all their love and
inspiration.

iv
Abstract
This report is meant for describing all the features and procedures that were followed
while developing the project. This report specially mentions the details of the project
how it was developed, the primary requirement as well as various features and
functionalities of the project and the procedures followed in achieving these
objectives. This system helps in freshness our mind and can thus help in spend times.
“Catch The Fruit” using this we can calm our mind and brain.

v
Acknowledgements
First of all, we are thankful and expressing our gratitude to Almighty Allah gives us
blessing, patience, mental and physical strength to complete this project work. We are
deeply indebted to our project supervisor Ms. Humayra Ahmed, Lecturer,
Department of CSE, Bangladesh University of Business and Technology. His
scholarly guidance, important suggestions, work for going through our drafts and
correcting them, and generating courage from the beginning to the end of the research
work has made the completion of this thesis possible. A very special gratitude goes out
to all our friends for their support and help to implement our works. The discussions
on various topics of our works have been very helpful for us to enrich our knowledge
and conception regarding the work. Last but not the least; we are highly grateful to our
parents and family members for supporting us spiritually throughout writing this thesis
and our life in general.

vi
Approval
This project “Catch The Fruit'' submitted by Pias Miah (19201103054), Md Israfil Islam
(19201103075), Md Alamin Shikder (19201103064), Asha Akter (19201103077), Department of
Computer Science and Engineering, Bangladesh University of Business and Technology, under the
supervision of
Ms. Humayra Ahmed, Lecturer, Department of Computer Science and Engineering, has been
accepted as satisfactory for the partial fulfillment of the requirement for the degree of Bachelor of
Science (B.Sc.) in Computer Science and Engineering and approved as to its style and contents.

-------------------------------------------------------------
Supervisor:
Ms. Humayra Ahmed
Lecturer
Department of Computer Science and Engineering
Bangladesh University of Business and Technology-BUBT

--------------------------------------------------------------

Chairman:
Md. Saifur Rahman
Assistant Professor and Chairman
Department of Computer Science and Engineering
Bangladesh University of Business and Technology-BUBT

vii
Table of Contents

Chapter 1 Introduction...........................................................................................................9

1.1 Python Programming Language...................................................................................9

1.2 Applications of Python...............................................................................................10

Chapter 2 System Requirements............................................................................................11

2.1 Software Requirements.................................................................................................11

2.2 Hardware Requirements…………………………………………………………………......11

Chapter 3 Implementation and Results................................................................................12

3.1 Project code.....................................................................................................................12

3.2 Results.............................................................................................................................16

Chapter 4 Conclusion..........................................................................................................18

Chapter 5 References...........................................................................................................19

viii
Chapter 1
Introduction
1.1 Python Programming Language
Python is one of the many open source object oriented programming application software
available in the market. Python is developed by Guido van Rossum. Guido van Rossum started
implementing Python in 1989. Python is a very simple programming language so even if you are new
to programming, you can learn python without facing any issues. Some of the many uses of Python
are application development, implementation of automation testing process, allows multiple
programming build, fully constructed programming library, can be used in all the major
operating systems and platforms, database system accessibility, simple and readable code, easy
to apply on complex software development processes, aids in test driven software application
development approach, machine learning/ data analytics, helps pattern recognitions, supported
in multiple tools, permitted by many of the provisioned frameworks, etc.

1. Readable: Python is a very readable language.


2. Easy to Learn: Learning python is easy as this is a expressive and high level
programming language, which means it is easy to understand the language and thus easy to
learn.

3. Cross platform: Python is available and can run on various operating systems such as
Mac, Windows, Linux, Unix etc. This makes it a cross platform and portable language.

4. Open Source: Python is a open source programming language.

5. Large standard library: Python comes with a large standard library that has some
handy codes and functions which we can use while writing code in Python.

6. Free: Python is free to download and use. This means you can download it for free and
use it in your application. See: Open Source Python License. Python is an example of a
FLOSS (Free/Libre Open Source Software), which means you can freely distribute copies of
this software, read its source code and modify it.

7. Supports exception handling: If you are new, you may wonder what is an exception?
An exception is an event that can occur during program exception and can disrupt the
normal flow of program. Python supports exception handling which means we can write less
error prone code and can test various scenarios that can cause an exception later on.

8. Advanced features: Supports generators and list comprehensions. We will cover these
features later.

9. Automatic memory management: Python supports automatic memory management which


means the memory is cleared and freed automatically.

ix
1.2 Applications of Python
Python can be used to develop different applications like web applications, graphic user
interface based applications, software development application, scientific and numeric
applications, network programming, Games and 3D applications and other business
applications. It makes an interactive interface and easy development of applications. You
may be wondering what all are the applications of Python. There are so many applications of
Python, here are some of the them.

1. Web development–Web framework like Django and Flask are based on Python. They
help you write server side code which helps you manage database, write backend
programming logic, mapping urls etc.

2. Machine learning–There are many machine learning applications written in Python.


Machine learning is a way to write a logic so that a machine can learn and solve a
particular problem on its own. For example, products recommendation in websites like
Amazon, Flipkart, eBay etc. is a machine learning algorithm that recognises user’s interest.
Face recognition and Voice recognition in your phone is another example of machine
learning.

3. Data Analysis–Data analysis and data visualisation in form of charts can also be developed
using Python.

4. Scripting–Scripting is writing small programs to automate simple tasks such as sending


automated response emails etc. Such type of applications can also be written in Python
programming language.

5. Game development–You can develop games using Python.

6. You can develop Embedded applications in Python.

7. Desktop applications–You can develop desktop application in Python using library like TK
inter or QT.

x
Chapter 2
System Requirements
2.1 Software Requirements
PyCharm2019.1.1 (Community Edition)
Build#PC-191.6605.12, built on April 3, 2019
JRE:11.0.2+9-b159.34amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

2.2 Hardware Requirements


Operating system: windows 10
Processor: intel core i5
Disk space:1G b

11
Chapter 3
Implementation and Results
3.1 About Project
This is a simple “Catch The Fruit” game using Python programming language. Beginners can
use this as a small project to boost their programming skills and understanding logic.
1. The “Catch The Fruit” program randomly selects a secret picture from a list of secret
picture. The random module will provide this ability, so line 1 in program imports it.
2. The Game: Here, a random picture (a fruit and something) is picked up from our
collection and the player gets limited chances to win the game.
3. When a picture in that picture is picked up, that picture position in the object is made
visible. In this way, all chocolate picture of pictures are to be guessed before all the
chances are over.
4. For convenience, we have given live 5 chances. For example, picture to be guessed is
mango, then user gets 100 point, as a picture is chocolate user loss his live.

3.2 Project Code


from tkinter import *
from random import *
import tkinter.messagebox

class ScoreBoard():

def __init__(self, parent):


self.parent = parent
self.initGUI()
self.reset()

def initGUI(self):

self.livesVar = IntVar()
Label(self.parent, text="Lives:", font=("Helvetica", 16,
"bold")).grid(row=1, column=2, padx=35, pady=100,

sticky=N + W)
Label(self.parent, textvariable=self.livesVar, font=("Helvetica", 16,
"bold")).grid(row=1, column=2, padx=60,

pady=150, sticky=N + W)

self.scoreVar = IntVar()
Label(self.parent, text="Score:", font=("Helvetica", 16,
"bold")).grid(row=1, column=2, padx=35, pady=250,

sticky=N + W)

12
Label(self.parent, textvariable=self.scoreVar, font=("Helvetica", 16,
"bold")).grid(row=1, column=2, padx=50,

pady=300, sticky=N + W)

self.highScoreVar = IntVar()
Label(self.parent, text="Highest Score:", font=("Helvetica", 16,
"bold")).grid(row=1, column=2, padx=0,

pady=400, sticky=N + W)

Label(self.parent, textvariable=self.highScoreVar, font=("Helvetica",


16, "bold")).grid(row=1, column=2,

padx=50, pady=450,

sticky=N + W)
def reset(self):
self.lives = 5
self.score = 0
self.highScore = self.loadScore()

self.livesVar.set(self.lives)
self.scoreVar.set(self.score)
self.highScoreVar.set(self.highScore)

def loadScore(self):
with open("high-score.txt", "r") as data:
return int(data.read())

def saveScore(self):
if self.score > self.highScore:
with open("high-score.txt", "w") as data:
data.write(str(self.score))

def gameOver(self):
self.saveScore()
tkinter.messagebox.showinfo("", "U Ju5t lost ur live !")
if tkinter.messagebox.askyesno("", "Pl4y Ag41n ?"):
self.reset()
else:
exit()

def updateBoard(self, livesStatus, scoreStatus):


self.lives += livesStatus;
self.score += scoreStatus
if self.lives < 0: self.gameOver()
self.livesVar.set(self.lives);
self.scoreVar.set(self.score)

class ItemsFallingFromSky():

def __init__(self, parent, canvas, player, board):


self.parent = parent
self.canvas = canvas

13
self.player = player
self.board = board

self.fallSpeed = 50
self.xPosition = randint(50, 750)
self.isgood = randint(0, 1)

self.goodItems = ["ananas.gif", "apple.gif", "orange.gif"]


self.badItems = ["candy1.gif", "candy2.gif", "lollypop.gif"]

if self.isgood:
self.itemPhoto =
tkinter.PhotoImage(file="images/{}".format(choice(self.goodItems)))
self.fallItem = self.canvas.create_image((self.xPosition, 50),
image=self.itemPhoto, tag="good")
else:
self.itemPhoto =
tkinter.PhotoImage(file="images/{}".format(choice(self.badItems)))
self.fallItem = self.canvas.create_image((self.xPosition, 50),
image=self.itemPhoto, tag="bad")

self.move_object()

def move_object(self):

self.canvas.move(self.fallItem, 0, 15)

if (self.check_touching()) or (self.canvas.coords(self.fallItem)[1] >


650):
self.canvas.delete(self.fallItem)
else:
self.parent.after(self.fallSpeed, self.move_object)

def check_touching(self):

x0, y0 = self.canvas.coords(self.fallItem)
x1, y1 = x0 + 50, y0 + 50

overlaps = self.canvas.find_overlapping(x0, y0, x1, y1)

if (self.canvas.gettags(self.fallItem)[0] == "good") and


(len(overlaps) > 1) and (
self.board.lives >= 0):
self.board.updateBoard(0, 100)
return True
elif (self.canvas.gettags(self.fallItem)[0] == "bad") and
(len(overlaps) > 1) and (
self.board.lives >= 0):
self.board.updateBoard(-1, 0)
return True
return False

class TheGame(ItemsFallingFromSky, ScoreBoard):

def __init__(self, parent):


self.parent = parent

14
self.parent.geometry("1024x650")
self.parent.title("Hello Jerry?")

self.canvas = Canvas(self.parent, width=800, height=600)


self.canvas.config(background="#E5FFCC")
self.canvas.bind("<Key>", self.keyMoving)
self.canvas.focus_set()
self.canvas.grid(row=1, column=1, padx=25, pady=25, sticky=W + N)

self.playerPhoto =
tkinter.PhotoImage(file="images/{}".format("jew.gif.png"))
self.playerChar = self.canvas.create_image((275, 533),
image=self.playerPhoto, tag="player")

self.personalboard = ScoreBoard(self.parent)

self.createEnemies()

def keyMoving(self, event):


if (event.char == "a") and (self.canvas.coords(self.playerChar)[0] >
50):
self.canvas.move(self.playerChar, -50, 0)
if (event.char == "d") and (self.canvas.coords(self.playerChar)[0] <
750):
self.canvas.move(self.playerChar, 50, 0)

def createEnemies(self):
ItemsFallingFromSky(self.parent, self.canvas, self.playerChar,
self.personalboard)
self.parent.after(1100, self.createEnemies)

if __name__ == "__main__":
root = Tk()
TheGame(root)
root.mainloop()

15
3.3 Result

16
17
Chapter 4
Conclusion
In the conclusion of this project, “Catch The Fruit” is a traditional game, typically
played with pictures. Catch the fruit in the python is a simple game. The project file
contains image files and python scripts. GUI uses the pygame library. Talking about
the gameplay, it’s a simple single player platformer game, where the player has to
collect all the candies in order to win the game. The main objective of this game is to
take as many fruits as you can. This game is inspired by the 90s famous game “fruit-
ninja”.

A simple and clean GUI is provided for easy gameplay. The gameplay design is so
simple that the user won’t find it difficult to use and understand. Different images are
used in the development of this game project, the gaming environment is just like
the fruit ninja game.

18
Chapter 5
References
 https://www.upgrad.com/blog/python-game-projects-topics/
 https://data-flair.training/blogs/python-project-ideas/"
 https://www.freecodecamp.org/news/python-projects-for-beginners/
 https://www.askpython.com/python/examples/easy-games-in-python
 https://realpython.com/tutorials/gamedev/
 https://www.youtube.com/watch?v=bgQKvWbdYdU
 https://code-projects.org/catch-the-fruit-in-python-with-source-code/
 https://data-flair.training/blogs/fruit-ninja-game-python/

19

You might also like