SlideShare a Scribd company logo
10.11.2016
Group No 7
Aashaka Shah​ (14114001)
Abhishek Jaisingh​ (14114002)
Akashdeep Goel​ (14114004)
Akshit Kalra​ (14114006)
Ambar Zaidi​ (14114009)
Problem Statement
This project aims to build a snake game which satisfies following requirements clearly :
1. Snake can enter a wall and emerge from the other (opposite) side.
2. Speed and size of snake must increase on eating a unit of food, thus increasing
difficulty as the game progresses.
3. Game gets over as soon as snake touches its own body.
Main Objects
1. Snake
a. Attributes of Snake object - Length (Size) => 1 (Initially)
b. Snake starts at bottom-left corner or grid-point (0, 0).
c. Snake’s length increases as it consumes more food.
d. Snake’s speed increases according to the equation:
i. Speed = 4.6 + Score * 0.66
ii. Linear variation
2. Food
a. Single unit increases the length of snake by 1.
b. Each food unit appears at random locations on the grid.
c. Food cannot appear on any of the cells currently occupied by snake.
3. Grid
a. Grid size can be adjusted.
b. Number of rows and columns can be adjusted.
c. Length and Width of columns can also be adjusted.
Technologies Used:
1. HTML & CSS (for Frontend)
2. JavaScript (three.JS Library)
three.js Basic Workflow
Three.js is a cross-browser JavaScript library/API used to create and display animated 3D
computer graphics in a web browser. Three.js uses ​WebGL​. WebGL in turn is based on
OpenGL​ ES 2.0 and provides an API for 3D graphics.
Everything made using three.JS library has three basic elements:
1. Camera​: Used to define view point, front-plane, back-plane and aspect-ratio and
viewing angle. Camera can be Perspective or Parallel.
2. Mesh​: It is the basic form of any object which in turn is made up of geometry and
material.
3. Light​: Light sources must also be defined appropriately otherwise the object
cannot be seen clearly. There are various kinds of light sources like Ambient Light,
Directional Light etc.
Outline of Steps taken:
1. Create the Scene
2. Create the Renderer
3. Create a Camera
4. Add Lighting
5. Add Meshes(Geometry+Material) to Scene
6. Add Controls
7. Render the Scene
Algorithms & Data Structures
Data Structure
We needed to model the snake using an appropriate data-structure, which fulfils the
following requirements:
1. Maintains length dynamically, i.e. length should not be constant.
2. When no food is eaten, length must remain same, but snake must move forward.
a. A new cube must be added at the front of current snake.
b. The last cube must be removed.
3. If food is eaten by the snake, length should be increased by one.
a. Here we need only to add a new cube at front of snake.
b. No removal is required as the length is supposed to increase by one unit.
As only the head and tail of the snake needs to be updated, we require a data structure
that supports the removal and addition at its two ends. So, we must use queues. But, we
need to support these addition and removal operations at both ends.
The data structure that supports all these requirements is ​Dequeue (Double Ended
Queue). In dequeue, elements can be added to or removed from either the front (head)
or back (tail) efficiently and easily.
Dequeue General JavaScript API
Operation Common name(s) JavaScript
insert element at back inject, snoc push
insert element at front push, cons unshift
remove last element eject pop
remove first element pop shift
examine last element peek last <obj>[<obj>.length - 1]
examine first element peek first <obj>[0]
Algorithm / Pseudocode:
There are basically two main functions having some algorithmic logic:
Function​ getRandomFreeLocation​():
x ​=​ random​(​0​,​ rows)
y ​=​ random​(​0​,​ cols)
for​ i ​in​ ​(​0​,​ rows​):
for​ j ​in​ ​(​0​,​ cols​):
if​ ​((​x ​+​ i ​)​ ​%​ rows​,​ ​(​y ​+​ j ​)%​ cols​)​ ​not​ ​in​ queue:
return​ ​((​x ​+​ i ​)​ ​%​ rows​,​ ​(​y ​+​ j ​)%​ cols)
Function​ ​MainRenderLoop​():
takeInput​();
IF collision​(​positionX​,​ positionY​):
Display​ ​Score
OUTPUT​(​"GAME OVER")
Stop​ ​RenderLoop
dequeue​.​push​(​newcube​)
IF foodEaten​(​positionX​,​ positionY​):
SCORE ​=​ SCORE ​+​ 1
food​.​location ​=​ getRandomFreeLocation​()
ELSE​:
dequeue​.​shift​()
calculateNewPosition​(​positionX​,​ positionY​);
Snapshots
Start of Game
Snake starts from bottom-left corner of grid with a score of zero.
Initial Score = 0
Growth of Snake
As the snake eats more food, its length and speed increases. Speed has been modeled as
a linear function of length / score.
Score = 25
Emergence from other side of wall
A snake can enter the wall and emerge from the opposite side.
Score = 21
Game Over
When snake touches any part of its own body, game is over and final score is displayed.
Final Score = 27
Snake Game Report

More Related Content

What's hot

Snake PY Game.pptx
Snake PY Game.pptxSnake PY Game.pptx
Snake PY Game.pptx
Lovely professinal university
 
Snake Game in Python Progress report
Snake Game in Python Progress reportSnake Game in Python Progress report
Snake Game in Python Progress report
Muhammad Aziz
 
Car Game - Final Year Project
Car Game - Final Year ProjectCar Game - Final Year Project
Car Game - Final Year ProjectVivek Naskar
 
Final project report of a game
Final project report of a gameFinal project report of a game
Final project report of a game
Nadia Nahar
 
Web Engineering
Web EngineeringWeb Engineering
Web Engineering
Muhammad Muzammal
 
Java threads
Java threadsJava threads
Java threads
Prabhakaran V M
 
Mini Project PPT
Mini Project PPTMini Project PPT
Mini Project PPT
Faiz Ahmad Khan
 
Event handling
Event handlingEvent handling
Final Year Game Project Report - Riko: The Aventurer
 Final Year Game Project Report - Riko: The Aventurer  Final Year Game Project Report - Riko: The Aventurer
Final Year Game Project Report - Riko: The Aventurer
Nusrat Jahan Shanta
 
Applets in java
Applets in javaApplets in java
Applets in java
Wani Zahoor
 
Report on car racing game for android
Report on car racing game for androidReport on car racing game for android
Report on car racing game for android
ravijot singh
 
Tic tac toe game code
Tic tac toe game codeTic tac toe game code
Tic tac toe game code
Upendra Sengar
 
Python Interview Questions And Answers 2019 | Edureka
Python Interview Questions And Answers 2019 | EdurekaPython Interview Questions And Answers 2019 | Edureka
Python Interview Questions And Answers 2019 | Edureka
Edureka!
 
Thunkable
ThunkableThunkable
Thunkable
Don Don
 
Presentation of 3rd Semester C++ Project
Presentation of 3rd Semester C++ ProjectPresentation of 3rd Semester C++ Project
Presentation of 3rd Semester C++ Project
Chandan Gupta Bhagat
 
Software Engineer- A unity 3d Game
Software Engineer- A unity 3d GameSoftware Engineer- A unity 3d Game
Software Engineer- A unity 3d Game
Isfand yar Khan
 
SRS for Library Management System
SRS for Library Management SystemSRS for Library Management System
SRS for Library Management System
Toseef Hasan
 
Design phase of game development of unity 2d game
Design phase of game development of unity 2d game Design phase of game development of unity 2d game
Design phase of game development of unity 2d game
Muhammad Maaz Irfan
 
The complete srs documentation of our developed game.
The complete srs documentation of our developed game. The complete srs documentation of our developed game.
The complete srs documentation of our developed game.
Isfand yar Khan
 
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Edureka!
 

What's hot (20)

Snake PY Game.pptx
Snake PY Game.pptxSnake PY Game.pptx
Snake PY Game.pptx
 
Snake Game in Python Progress report
Snake Game in Python Progress reportSnake Game in Python Progress report
Snake Game in Python Progress report
 
Car Game - Final Year Project
Car Game - Final Year ProjectCar Game - Final Year Project
Car Game - Final Year Project
 
Final project report of a game
Final project report of a gameFinal project report of a game
Final project report of a game
 
Web Engineering
Web EngineeringWeb Engineering
Web Engineering
 
Java threads
Java threadsJava threads
Java threads
 
Mini Project PPT
Mini Project PPTMini Project PPT
Mini Project PPT
 
Event handling
Event handlingEvent handling
Event handling
 
Final Year Game Project Report - Riko: The Aventurer
 Final Year Game Project Report - Riko: The Aventurer  Final Year Game Project Report - Riko: The Aventurer
Final Year Game Project Report - Riko: The Aventurer
 
Applets in java
Applets in javaApplets in java
Applets in java
 
Report on car racing game for android
Report on car racing game for androidReport on car racing game for android
Report on car racing game for android
 
Tic tac toe game code
Tic tac toe game codeTic tac toe game code
Tic tac toe game code
 
Python Interview Questions And Answers 2019 | Edureka
Python Interview Questions And Answers 2019 | EdurekaPython Interview Questions And Answers 2019 | Edureka
Python Interview Questions And Answers 2019 | Edureka
 
Thunkable
ThunkableThunkable
Thunkable
 
Presentation of 3rd Semester C++ Project
Presentation of 3rd Semester C++ ProjectPresentation of 3rd Semester C++ Project
Presentation of 3rd Semester C++ Project
 
Software Engineer- A unity 3d Game
Software Engineer- A unity 3d GameSoftware Engineer- A unity 3d Game
Software Engineer- A unity 3d Game
 
SRS for Library Management System
SRS for Library Management SystemSRS for Library Management System
SRS for Library Management System
 
Design phase of game development of unity 2d game
Design phase of game development of unity 2d game Design phase of game development of unity 2d game
Design phase of game development of unity 2d game
 
The complete srs documentation of our developed game.
The complete srs documentation of our developed game. The complete srs documentation of our developed game.
The complete srs documentation of our developed game.
 
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
 

Similar to Snake Game Report

Data structures and algorithms lab4
Data structures and algorithms lab4Data structures and algorithms lab4
Data structures and algorithms lab4Bianca Teşilă
 
CEN 235 4. Abstract Data Types - Queue and Stack.pdf
CEN 235 4. Abstract Data Types - Queue and Stack.pdfCEN 235 4. Abstract Data Types - Queue and Stack.pdf
CEN 235 4. Abstract Data Types - Queue and Stack.pdf
vtunali
 
Please make the complete program, distinguishing between each class .pdf
Please make the complete program, distinguishing between each class .pdfPlease make the complete program, distinguishing between each class .pdf
Please make the complete program, distinguishing between each class .pdf
faxteldelhi
 
stacks and queues for public
stacks and queues for publicstacks and queues for public
stacks and queues for public
iqbalphy1
 
Animal Project
Animal Project Animal Project
Animal Project
Ahmed Ali
 
STRINGS IN JAVA
STRINGS IN JAVASTRINGS IN JAVA
Circular queue
Circular queueCircular queue
Circular queue
Circular queueCircular queue
Machine(s) Learning with Neural Networks
Machine(s) Learning with Neural NetworksMachine(s) Learning with Neural Networks
Machine(s) Learning with Neural Networks
Bruno Gonçalves
 
HP-3 Presentation.pptx
HP-3 Presentation.pptxHP-3 Presentation.pptx
HP-3 Presentation.pptx
ShivamPandey521834
 
Transfer learning, active learning using tensorflow object detection api
Transfer learning, active learning  using tensorflow object detection apiTransfer learning, active learning  using tensorflow object detection api
Transfer learning, active learning using tensorflow object detection api
설기 김
 
VCE Unit 03vv.pptx
VCE Unit 03vv.pptxVCE Unit 03vv.pptx
VCE Unit 03vv.pptx
skilljiolms
 
adjava_23_bcs_vision_academy_sachinsir.pdf
adjava_23_bcs_vision_academy_sachinsir.pdfadjava_23_bcs_vision_academy_sachinsir.pdf
adjava_23_bcs_vision_academy_sachinsir.pdf
akankshasorate1
 
Queue
QueueQueue
Beholder#Giant center eye and twelve eye stalks above it. It is a.docx
Beholder#Giant center eye and twelve eye stalks above it.  It is a.docxBeholder#Giant center eye and twelve eye stalks above it.  It is a.docx
Beholder#Giant center eye and twelve eye stalks above it. It is a.docx
ikirkton
 
Queue
QueueQueue
deep learning
deep learningdeep learning
deep learning
Hassanein Alwan
 
Fast Object Recognition from 3D Depth Data with Extreme Learning Machine
Fast Object Recognition from 3D Depth Data with Extreme Learning MachineFast Object Recognition from 3D Depth Data with Extreme Learning Machine
Fast Object Recognition from 3D Depth Data with Extreme Learning Machine
Soma Boubou
 

Similar to Snake Game Report (20)

Advanced core java
Advanced core javaAdvanced core java
Advanced core java
 
Data structures and algorithms lab4
Data structures and algorithms lab4Data structures and algorithms lab4
Data structures and algorithms lab4
 
CEN 235 4. Abstract Data Types - Queue and Stack.pdf
CEN 235 4. Abstract Data Types - Queue and Stack.pdfCEN 235 4. Abstract Data Types - Queue and Stack.pdf
CEN 235 4. Abstract Data Types - Queue and Stack.pdf
 
Please make the complete program, distinguishing between each class .pdf
Please make the complete program, distinguishing between each class .pdfPlease make the complete program, distinguishing between each class .pdf
Please make the complete program, distinguishing between each class .pdf
 
stacks and queues for public
stacks and queues for publicstacks and queues for public
stacks and queues for public
 
Animal Project
Animal Project Animal Project
Animal Project
 
STRINGS IN JAVA
STRINGS IN JAVASTRINGS IN JAVA
STRINGS IN JAVA
 
Circular queue
Circular queueCircular queue
Circular queue
 
Circular queue
Circular queueCircular queue
Circular queue
 
Lecture 2d queues
Lecture 2d queuesLecture 2d queues
Lecture 2d queues
 
Machine(s) Learning with Neural Networks
Machine(s) Learning with Neural NetworksMachine(s) Learning with Neural Networks
Machine(s) Learning with Neural Networks
 
HP-3 Presentation.pptx
HP-3 Presentation.pptxHP-3 Presentation.pptx
HP-3 Presentation.pptx
 
Transfer learning, active learning using tensorflow object detection api
Transfer learning, active learning  using tensorflow object detection apiTransfer learning, active learning  using tensorflow object detection api
Transfer learning, active learning using tensorflow object detection api
 
VCE Unit 03vv.pptx
VCE Unit 03vv.pptxVCE Unit 03vv.pptx
VCE Unit 03vv.pptx
 
adjava_23_bcs_vision_academy_sachinsir.pdf
adjava_23_bcs_vision_academy_sachinsir.pdfadjava_23_bcs_vision_academy_sachinsir.pdf
adjava_23_bcs_vision_academy_sachinsir.pdf
 
Queue
QueueQueue
Queue
 
Beholder#Giant center eye and twelve eye stalks above it. It is a.docx
Beholder#Giant center eye and twelve eye stalks above it.  It is a.docxBeholder#Giant center eye and twelve eye stalks above it.  It is a.docx
Beholder#Giant center eye and twelve eye stalks above it. It is a.docx
 
Queue
QueueQueue
Queue
 
deep learning
deep learningdeep learning
deep learning
 
Fast Object Recognition from 3D Depth Data with Extreme Learning Machine
Fast Object Recognition from 3D Depth Data with Extreme Learning MachineFast Object Recognition from 3D Depth Data with Extreme Learning Machine
Fast Object Recognition from 3D Depth Data with Extreme Learning Machine
 

More from Abhishek Jaisingh

Movie recommendation project
Movie recommendation projectMovie recommendation project
Movie recommendation project
Abhishek Jaisingh
 
Deep Q-learning Flappy Bird
Deep Q-learning Flappy BirdDeep Q-learning Flappy Bird
Deep Q-learning Flappy Bird
Abhishek Jaisingh
 
Traffic Lights Controller in VHDL
Traffic Lights Controller in VHDLTraffic Lights Controller in VHDL
Traffic Lights Controller in VHDL
Abhishek Jaisingh
 
Airline Database Design
Airline Database DesignAirline Database Design
Airline Database Design
Abhishek Jaisingh
 
Client Server Model and Distributed Computing
Client Server Model and Distributed ComputingClient Server Model and Distributed Computing
Client Server Model and Distributed Computing
Abhishek Jaisingh
 
Forget Me Not Report
Forget Me Not ReportForget Me Not Report
Forget Me Not Report
Abhishek Jaisingh
 
Skype
SkypeSkype
Quantum Computing Report
Quantum Computing ReportQuantum Computing Report
Quantum Computing Report
Abhishek Jaisingh
 
Quantum Computing
Quantum ComputingQuantum Computing
Quantum Computing
Abhishek Jaisingh
 
Innovative Business Models Presentation
Innovative Business Models PresentationInnovative Business Models Presentation
Innovative Business Models Presentation
Abhishek Jaisingh
 

More from Abhishek Jaisingh (10)

Movie recommendation project
Movie recommendation projectMovie recommendation project
Movie recommendation project
 
Deep Q-learning Flappy Bird
Deep Q-learning Flappy BirdDeep Q-learning Flappy Bird
Deep Q-learning Flappy Bird
 
Traffic Lights Controller in VHDL
Traffic Lights Controller in VHDLTraffic Lights Controller in VHDL
Traffic Lights Controller in VHDL
 
Airline Database Design
Airline Database DesignAirline Database Design
Airline Database Design
 
Client Server Model and Distributed Computing
Client Server Model and Distributed ComputingClient Server Model and Distributed Computing
Client Server Model and Distributed Computing
 
Forget Me Not Report
Forget Me Not ReportForget Me Not Report
Forget Me Not Report
 
Skype
SkypeSkype
Skype
 
Quantum Computing Report
Quantum Computing ReportQuantum Computing Report
Quantum Computing Report
 
Quantum Computing
Quantum ComputingQuantum Computing
Quantum Computing
 
Innovative Business Models Presentation
Innovative Business Models PresentationInnovative Business Models Presentation
Innovative Business Models Presentation
 

Recently uploaded

LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 

Recently uploaded (20)

LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 

Snake Game Report

  • 1. 10.11.2016 Group No 7 Aashaka Shah​ (14114001) Abhishek Jaisingh​ (14114002) Akashdeep Goel​ (14114004) Akshit Kalra​ (14114006) Ambar Zaidi​ (14114009) Problem Statement This project aims to build a snake game which satisfies following requirements clearly : 1. Snake can enter a wall and emerge from the other (opposite) side. 2. Speed and size of snake must increase on eating a unit of food, thus increasing difficulty as the game progresses. 3. Game gets over as soon as snake touches its own body.
  • 2. Main Objects 1. Snake a. Attributes of Snake object - Length (Size) => 1 (Initially) b. Snake starts at bottom-left corner or grid-point (0, 0). c. Snake’s length increases as it consumes more food. d. Snake’s speed increases according to the equation: i. Speed = 4.6 + Score * 0.66 ii. Linear variation 2. Food a. Single unit increases the length of snake by 1. b. Each food unit appears at random locations on the grid. c. Food cannot appear on any of the cells currently occupied by snake. 3. Grid a. Grid size can be adjusted. b. Number of rows and columns can be adjusted. c. Length and Width of columns can also be adjusted. Technologies Used: 1. HTML & CSS (for Frontend) 2. JavaScript (three.JS Library)
  • 3. three.js Basic Workflow Three.js is a cross-browser JavaScript library/API used to create and display animated 3D computer graphics in a web browser. Three.js uses ​WebGL​. WebGL in turn is based on OpenGL​ ES 2.0 and provides an API for 3D graphics. Everything made using three.JS library has three basic elements: 1. Camera​: Used to define view point, front-plane, back-plane and aspect-ratio and viewing angle. Camera can be Perspective or Parallel. 2. Mesh​: It is the basic form of any object which in turn is made up of geometry and material. 3. Light​: Light sources must also be defined appropriately otherwise the object cannot be seen clearly. There are various kinds of light sources like Ambient Light, Directional Light etc.
  • 4. Outline of Steps taken: 1. Create the Scene 2. Create the Renderer 3. Create a Camera 4. Add Lighting 5. Add Meshes(Geometry+Material) to Scene 6. Add Controls 7. Render the Scene Algorithms & Data Structures Data Structure We needed to model the snake using an appropriate data-structure, which fulfils the following requirements: 1. Maintains length dynamically, i.e. length should not be constant. 2. When no food is eaten, length must remain same, but snake must move forward. a. A new cube must be added at the front of current snake. b. The last cube must be removed. 3. If food is eaten by the snake, length should be increased by one. a. Here we need only to add a new cube at front of snake. b. No removal is required as the length is supposed to increase by one unit. As only the head and tail of the snake needs to be updated, we require a data structure that supports the removal and addition at its two ends. So, we must use queues. But, we need to support these addition and removal operations at both ends. The data structure that supports all these requirements is ​Dequeue (Double Ended Queue). In dequeue, elements can be added to or removed from either the front (head) or back (tail) efficiently and easily.
  • 5. Dequeue General JavaScript API Operation Common name(s) JavaScript insert element at back inject, snoc push insert element at front push, cons unshift remove last element eject pop remove first element pop shift examine last element peek last <obj>[<obj>.length - 1] examine first element peek first <obj>[0] Algorithm / Pseudocode: There are basically two main functions having some algorithmic logic: Function​ getRandomFreeLocation​(): x ​=​ random​(​0​,​ rows) y ​=​ random​(​0​,​ cols) for​ i ​in​ ​(​0​,​ rows​): for​ j ​in​ ​(​0​,​ cols​): if​ ​((​x ​+​ i ​)​ ​%​ rows​,​ ​(​y ​+​ j ​)%​ cols​)​ ​not​ ​in​ queue: return​ ​((​x ​+​ i ​)​ ​%​ rows​,​ ​(​y ​+​ j ​)%​ cols)
  • 6. Function​ ​MainRenderLoop​(): takeInput​(); IF collision​(​positionX​,​ positionY​): Display​ ​Score OUTPUT​(​"GAME OVER") Stop​ ​RenderLoop dequeue​.​push​(​newcube​) IF foodEaten​(​positionX​,​ positionY​): SCORE ​=​ SCORE ​+​ 1 food​.​location ​=​ getRandomFreeLocation​() ELSE​: dequeue​.​shift​() calculateNewPosition​(​positionX​,​ positionY​); Snapshots Start of Game Snake starts from bottom-left corner of grid with a score of zero.
  • 7. Initial Score = 0 Growth of Snake As the snake eats more food, its length and speed increases. Speed has been modeled as a linear function of length / score. Score = 25
  • 8. Emergence from other side of wall A snake can enter the wall and emerge from the opposite side. Score = 21 Game Over When snake touches any part of its own body, game is over and final score is displayed. Final Score = 27