0% found this document useful (0 votes)
14 views32 pages

Game

Uploaded by

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

Game

Uploaded by

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

1

Project Report
On
Game
Broadcasting
site

Submitted By:

Name --------------------------------------- Sarthak sinha


Registration. No-------------------------- 221919509995
Department -------------------------------Diploma (cse)
2

ACKNOWLEDGEMENT

We take this occasion to thank God, almighty for blessing us with his grace and taking

our endeavor to a successful culmination. We extend our sincere and heartfelt thanks to our

esteemed guide, Rishabh loombo for providing us with the right guidance and advice at the crucial

junctures and for showing me the right way. We also take this opportunity to express a deep sense

of gratitude to ANANTA DEV PAUL&PARAMITA RAY. We would

like to thank our friends and family for the support and encouragement they have given us during

the course of our work.


3

TABLE OF CONTENTS

ABSTRACT 5
1. INTRODUCTION 6
1.1 PROJECT AIMS AND OBJECTIVES 6
1.2 BACKGROUND OF PROJECT 7
1.3 OPERATION ENVIRONMENT 8
2. SYSTEM ANALYSIS 9
2.1 SOFTWARE REQUIREMENT SPECIFICATION 9
2.2 EXISTING VS PROPOSED 15
2.3 SOFTWARE TOOL USED 16
4

3. SYSTEM DESIGN 20
3.1 TABLE DESIGN 20
3.2 DATA FLOW DIAGRAM’S 24
4. SYSTEM IMPLEMENTATION 30
4.1 MODULE DESCRIPTION 30
4.2 SCREEN SHOTS 80
5. SYSTEM TESTING 85
5.1 UNIT TESTING 85
5.2 INTEGRATION TESTING 87
6. CONCLUSION & FUTURE SCOPE 88
7. REFERENCES 89

Abstract:

Title: Interactive Game Hub - A Web-based Gaming Platform


The objective of this project is to develop an interactive web-based game site that
offers a seamless gaming experience with a focus on user engagement, aesthetics,
5

and performance. The website serves as a platform for hosting multiple games,
including casual games (like puzzles, quizzes, and platformers) with the potential
for multiplayer or leaderboards for competition. Key functionalities include user
registration, profile management, real-time score tracking, and an integrated
leaderboard system.
The platform is designed using HTML, CSS, and JavaScript for the front end to
provide a responsive and visually appealing interface across multiple devices. For
more advanced features like multiplayer games or real-time chats, technologies like
Web Sockets are integrated. The backend is powered by Node.js with MongoDB for
managing game data, user profiles, and high scores, ensuring scalability and quick
retrieval of data. User authentication (OAuth/Google login) ensures security and
ease of access.
The website prioritizes intuitive navigation, fast load times, and compatibility
across browsers. Special attention is given to gamification techniques, such as
achievement badges and daily challenges, to maintain user retention. Future
improvements may include integrating new games, hosting tournaments, and adding
social sharing features to enhance the community aspect of the platform.
This project demonstrates the ability to build and deploy a dynamic web platform
with real-time features, focusing on both technical and user experience aspects.
6

CHAPTER 1
INTRODUCTION

This chapter gives an overview about the aim , objectives ,background and operation
environment of the system.

1.1 PROJECT AIMS AND OBJECTIVES

The project aims and objectives that will be achieved after completion of this project are discussed
in this subchapter. The aims and objectives are as follows:
User-Friendly Interface:
Create an intuitive design with responsive layouts that ensure a smooth experience on both
desktop and mobile devices.
Game Variety & Accessibility:
Provide a collection of games, including casual, puzzle, adventure, and multiplayer games,
catering to different user interests.
7

User Authentication & Profiles:


Implement user login and registration features with personalized profiles to track progress, scores,
and achievements.
Leaderboard & Competitions:
Introduce a dynamic leaderboard system to encourage healthy competition among users.
Social Integration:
Enable users to share their achievements and invite friends via social media platforms.
Game Analytics:
Monitor user engagement, session durations, and game preferences to continually enhance the
gaming experience.
Performance Optimization:
Ensure quick loading times, minimal lag, and smooth gameplay with robust backend services.
Security & Data Privacy:
Safeguard user data through encryption and adhere to privacy policies, building user trust.
Monetization Opportunities:
Explore options like in-game purchases, ads, or premium memberships to sustain the platform.
Support & Feedback:
Include a system for user feedback and technical support to address issues and continually
improve the site.

1.2 BACKGROUND OF PROJECT

Front-End:
8

• Use HTML/CSS/JavaScript for building interactive elements.


• Frameworks like React or Vue.js can simplify component management.
• Canvas API can be used to render game visuals dynamically.
Back-End:
• Use Node.js with Express.js for managing game states and API calls.
• Integrate a database (MongoDB/MySQL) to store high scores and user data.
• Build REST APIs for score submissions and game history.
Game Logic:
• Implement core games like:
o Tic-Tac-Toe: Basic two-player logic game.
o Snake Game: Classic arcade game with food collection.
o Memory Match: Match cards with the same images.
• These games will develop your logic-building ability and help you practice algorithms.
Authentication System:
• Use JWT (JSON Web Tokens) or OAuth for user authentication (optional but good for
practice).
• Allow players to log in and save scores under their profiles.
Leaderboard & Stats:
• Create a leaderboard where players can compete for the highest score.
• Use charts (like Chart.js) to display game stats, trends, and player performance.
help librarian to manage the library with more convenience and in a more efficient way as
compared to library systems which are not computerized.

PROCESSOR INTEL CORE PROCESSOR OR BETTER


PERFORMANCE

OPERATING
SYSTEM WINDOWS VISTA ,WINDOWS7, UBUNTU
9

MEMORY 1GB RAM OR MORE

MINIMUM 3 GB FOR DATABASE USAGE


HARD DISK SPACE FOR
FUTURE

DATABASE MY SQL

CHAPTER 2

SYSTEM ANALYSIS

The purpose of the game site is to offer users an engaging platform for online gaming
with functionalities like account management, multiplayer gaming, leaderboards, and
social interaction. It should be responsive, secure, scalable, and easy to maintain.

Objectives of the System


• Provide a smooth gaming experience for single-player and multiplayer
games.
• Enable user registration, login, and profile management.
• Include leaderboards and achievements for player motivation.
• Offer payment processing for premium games or in-game purchases.
• Ensure high security to protect personal data and payment information.
10

• Maintain fast load times with minimal latency for multiplayer


interactions.
• Ensure cross-platform support (mobile, desktop, and tablets).

2.1 SOFTWARE REQUIREMENT SPECIFICATION


2.1.1 GENERAL DESCRIPTION

PRODUCT DESCRIPTION:

Creating a Software Requirement Specification (SRS) for a game site requires a detailed and
structured document. Below is an example template filled with sections to help you write a
professional SRS. You can modify it to suit your specific game site requirements.

It can help user to manage the transaction or record more effectively and time-
saving.
11

1.1 Purpose
The purpose of this document is to define the software requirements for the development of
a game site. This site will allow users to play games, manage profiles, track achievements,
participate in leaderboards, and engage in the gaming community.
1.2 Scope
The game site will be an online platform providing users access to various browser-based
games, user profiles, leaderboards, achievements, and a community forum. Key features
include:
• Game Library: A collection of single-player and multiplayer games.
• User Profiles: Players can create and customize profiles.
• Achievements and Rewards: Track in-game milestones and earn rewards.
• Leaderboards: Global, regional, and friends' leaderboards for competitive play.
• Community Forum: Discussion boards for users to connect and share experiences.
The system will run on web browsers and support desktop and mobile versions.
1.3 Definitions, Acronyms, and Abbreviations
• SRS: Software Requirement Specification
• UI: User Interface
• API: Application Programming Interface
• SSL: Secure Socket Layer
1.4 References
• IEEE Standard for Software Requirement Specifications (IEEE 830-1998)
• Game Site Design Document (if any)
1.5 Overview
The rest of this document describes the functional and non-functional requirements, system
architecture, and constraints.

2. Overall Description
2.1 Product Perspective
The game site will be a standalone platform integrated with third-party APIs for payment
processing, social logins, and game updates. It will have a modular architecture, allowing
for the addition of new games and features over time.
2.2 Product Functions
• Game Library: Browse, search, and filter games by genre and popularity.
• User Registration/Login: Register or log in using email or social media accounts.
• Leaderboards: Track player rankings and statistics.
• In-game Purchases: Buy in-game items using a secure payment gateway.
• Community Forum: Users can post and comment in discussion threads.
2.3 User Classes and Characteristics
1. Players: Users who play games, track achievements, and participate in leaderboards.
2. Administrators: Manage the site, monitor performance, and handle user reports.
3. Developers: Update games, fix bugs, and integrate new features.
12

2.4 Operating Environment


• Platform: Web browsers (Chrome, Firefox, Safari)
• Devices: Desktop and mobile devices
• Database: MySQL or MongoDB
• Server: Linux-based hosting with Node.js backend
2.5 Design and Implementation Constraints
• Performance: The platform must support 500+ concurrent users without lag.
• Security: SSL encryption for data transmission, secure login mechanisms.
• Compatibility: Responsive design for both mobile and desktop views.
2.1.4 SOFTWARE AND HARDWARE REQUIREMENTS

This section describes the software and hardware requirements of the system
2.1.4.1 SOFTWARE REQUIREMENTS

• Operating system- Windows 7 is used as the operating system as it is stable and


supports more features and is more user friendly

• Database MYSQL-MYSQL is used as database as it easy to maintain and retrieve


records by simple queries which are in English language which are easy to
understand and easy to write.

• Development tools and Programming language- HTML is used to write the whole
code and develop webpages with css, java script for styling work and php for sever
side scripting.

2.1.4.2 HARDWARE REQUIREMENTS


13

Intel core i5 2nd generation is used as a processor because it is fast than other
processors an provide reliable and stable and we can run our pc for longtime.
By using this processor we can keep on developing our project without any
worries.
➢ Ram 1 gb is used as it will provide fast reading and writing capabilities and
will in turn support in processing.

Existing System:

◼ Early days Libraries are managed manually. It required lot of time to record or to retrieve
the details. The employees who have to record the details must perform their job very
carefully. Even a small mistake would create a lot of problems. Security of information is
very less. Report generations of all the information is very tough task.
◼ Maintenance of Library catalogue and arrangement of the books to the catalogue is very
complex task. In addition to its maintenance of member details, issue dates and return
dates etc. manually is a complex task.
◼ All the operations must be performed in perfect manner for the maintenance of the library
with out any degradation which may finally result in the failure of the entire system.

Proposed System:

To solve the inconveniences as mentioned in the existing system, an Online Library is proposed.
The proposed system contains the following features:

 The students will register them through Online

 Individually each member will have his account through which he can access the
information he needs.

 Book details like authors, number of copies totally maintained by library, present
available number of books, reference books, non-reference books etc. all this
information can be made handy.

 Regarding the members designation, number of books was issued.

 Issue dates and returns of each member is maintained separately and fine charged
if there is any delay in returning the book.

 Administrator can add, update the books.


14

 Time consuming is low, gives accurate results, reliability can be improved with the
help of security.

2.3 SOFTWARE TOOLS USED

The whole Project is divided in two parts the front end and the back end.

2.3.1 Front end


The front end is designed using of html , Php ,css, Java script

HTML- HTMLorHyper Text Markup Languageis the main markuplanguage for


creating web pages and other information that can be displayed in a web
browser.HTML is written in the form of HTML elements consisting of tags enclosed
in angle brackets (like <html>), within the web page content. HTML tags most
commonly come in pairs like <h1> and </h1>, although some tags represent empty
elements and so are unpaired, for example <img>. The first tag in a pair is the start
tag, and the second tag is the end tag (they are also called opening tags and closing
tags). In between these tags web designers can add text, further tags, comments and
other types of text-based content. The purpose of a web browser is to read HTML
documents and compose them into visible or audible web pages. The browser does
not display the HTML tags, but uses the tags to interpret the content of the
page.HTML elements form the building blocks of all websites. HTML allows images
and objects to be embedded and can be used to create interactive forms. It provides a
means to create structured documents by denoting structural semantics for text such
as headings, paragraphs, lists, links, quotes and other items. It can embed scripts
written in languages such as JavaScript which affect the behavior of
15

HTML web pages.

CSS- Cascading Style Sheets(CSS) is a style sheet language used fordescribing


the look and formatting of a document written in a markup language. While most
often used to style web pages and interfaces written in HTML and XHTML, the
language can be applied to any kind

of XML document, including plain XML, SVG and XUL. CSS is a cornerstone
specification of the web and almost all web pages use CSS style sheets to describe
their presentation.CSS is designed primarily to enable the separation of document
content from document presentation, including elements such as the layout, colors,
and fonts. This separation can improve content accessibility, provide more flexibility
and control in the specification.

of presentation characteristics, enable multiple pages to share formatting, and reduce


complexity and repetition in the structural content (such as by allowing for table less
web design).CSS can also allow the same markup page to be presented in different
styles for different rendering methods, such as on-screen, in print, by voice (when
read out by a speech-based browser or screen reader) and on Braille-based, tactile
devices. It can also be used to allow the web page to display differently depending on
the screen size or device on which it is being viewed. While the author of a document
typically links that document to a CSS file, readers can use a different style sheet,
perhaps one on their own computer, to override the one the author has specified.
However if the author or the reader did not link the document to a specific style sheet
the default style of the browser will be applied.CSS specifies a priority scheme to
determine which style rules apply if more than one rule matches against a particular
element. In this so-called cascade, priorities or weights are calculated and assigned to
rules, so that the results are predictable.
16

JAVA SCRIPT- JavaScript(JS) is a dynamic computer programminglanguage. It is


most commonly used as part of web browsers, whose implementations allow
clientside scripts to interact with the user, control the browser, communicate
asynchronously, and alter the document content that is displayed. It is also being used
in server-side programming, game development and the creation of desktop and
mobile applications. JavaScript is a prototype-based scripting language with dynamic
typing and has first-class functions. Its syntax was influenced by C. JavaScript copies
many names and naming conventions from Java, but the two languages are otherwise
unrelated and have very different semantics. The key design principles within
JavaScript are taken from

the Self and Scheme programming languages. It is a multiparadigm


language, supporting object-oriented, imperative,

and functional programming styles. The application of JavaScript to use outside


of web pages—for example, in PDF documents, site-specific browsers, and
desktop widgets—is also significant. Newer and faster JavaScript VMs and
platforms built upon them (notably Node.js) have also increased the popularity of
JavaScript for server-side web applications. On the client side, JavaScript was
traditionally implemented as an interpreted language but just-in-time compilation
is now performed by recent (post-2012) browsers.

PHP- PHPis a server-side scripting language designed for webdevelopment but also
used as a general-purpose programming language. PHP is now installed on more than
244 million websites and 2.1 million web servers. Originally created by Rasmus
Lerdorf in 1995, the reference implementation of PHP is now produced by The PHP
Group. While PHP originally stood for Personal Home Page, it now stands for PHP:
HypertextPreprocessor, a recursive backronym.PHP code is interpreted by a
webserver with a PHP processor module, which generates the resulting web page:
17

PHP commands can be embedded directly into an HTML source document rather
than calling an external file to process data. It has also evolved to include a
command-line interface capability and can be used

in standalone graphical applications. PHP is free software released under the PHP
License. PHP can be deployed on most web servers and also as a standalone shell on
almost every operating system and platform, free of charge.

MYSQL- MySQL("My S-Q-L", officially, but also called "My Sequel") is (as ofJuly
2013) the world's second most widely used open-source relational database management
system (RDBMS). It is named after co-founder Michael Widenius daughter, My. The
SQL phrase stands for Structured Query Language. The MySQL development project
has made its source code available under the terms of the GNU General Public License, as well as
under a variety
of proprietary agreements. MySQL was owned and sponsored by a single for-profit

firm, the Swedish company MySQL AB, now owned by Oracle Corporation .MySQL is a
popular choice of database for use in web applications, and is a central component of the
widely used LAMP open source web application software stack (and other 'AMP' stacks).
LAMP is an acronym for "Linux, Apache, MySQL, Perl/PHP/Python." Free-software-
open source projects that require a full-featured database management system often use
MySQL. For commercial use, several paid editions are available, and offer additional
functionality. Applications which use MySQL

databases

include: TYPO3, MODx, Joomla, WordPress, phpBB, MyBB, Drupal and other
18

software. MySQL is also used in many high-profile, large-scale websites, including

Wikipedia, Google (though not for searches), Facebook, Twitter, Flickr, and

YouTube

After entering to the home page of the website , Admin can choose the Admin Login option
where they are asked to enter username & password , and if he/she is a valid user then a
teacher login page will be displayed.

USE CAESE DIAGRAM FOR USER


19

After entering to the home page of the website , student can choose the USER LOGIN option
where they are asked to enter username & password , and if he/she is a valid user then a
student login page will be displayed.
20

CHAPTER 4

SYSTEM IMPLEMENTATION

4.1 Screenshot for homepage

4.3 Screenshot of videos from user

4.4 Screenshot of open-link from user

For Library Management System it is divided into the following Modules:


21

CHAPTER 5 SYSTEM TESTING

The aim of the system testing process was to determine all defects in our project .The program
was subjected to a set of test inputs and various observations were made and based on these
observations it will be decided whether the program behaves as expected or not. Our
Project went through two levels of testing

1.Unit testing

2.integration testing
22

• Student account addition- In this section the admin can verify student details
from student academinc info and then only add student details to main library
database it contains add and delete buttons if user click add button data will be
added to student database and if he clicks delete button the student data will be
deleted

• Book Addition- Admin can enter details of book and can add the details to the
main book table also he can view the books requests .

2. Test for Student login module

• Test for Student login Form-This form is used for log in of Student .In this
we enter thelibraryid, username and password if all these are correct student
login page will open other wise if any of data is wrong it will get redirected
back to the login page and again ask for libraryid, username and password.

• Test for account creation- This form is used for new account creation when
student does not fill the form completely it asks again to fill the whole form
when he fill the form fully it gets redirected to page which show waiting for
conformation message as his data will be only added by administrator after
verification.

3. Test for teacher login module-

Test for teacher login form- This form is used for logg in of teacher .In this we enter the username
and password if all these are correct teacher login page will open other wise if any of data is
wrong it will get redirected back to the login page and again ask for username and password.
23

INTEGRATION TESTING

In this type of testing we test various integration of the project module by providing the input

.The primary objective is to test the module interfaces in order to ensure that no errors are
occurring when one module invokes the other module.

CHAPTER 6 CONCLUSION & FUTURE SCOPE

This website provides a computerized version of library management system which will benefit
the students as well as the staff of the library.

It makes entire process online where student can search books, staff can generate reports and do
book transactions. It also has a facility for student login where student can login and can see
24

status of books issued as well request for book or give some suggestions. It has a facility of
teacher’s login where teachers can add lectures notes and also give necessary suggestion to
library and also add info about workshops or events happening in our college or nearby college
in the online notice board.

There is a future scope of this facility that many more features such as online lectures video
tutorials can be added by teachers as well as online assignments submission facility , a feature Of
group chat where students can discuss various issues of engineering can be added to this project
thus making it more interactive more user friendly and project which fulfills each users need in
the best way possible.

CHAPTER 7

REFERENCES

Here are some of the best resources where you can practice and improve your game development
skills:
1. Unity Learn: This platform offers a wide range of free tutorials and structured learning
pathways on game development using the Unity engine. It provides hands-on projects and
lessons across different levels, covering 2D and 3D games, VR, and mobile AR
development.
25

2. CS50's Introduction to Game Development by Harvard (via edX): A hands-on course


exploring both 2D and 3D game development. It teaches key concepts like animation,
sound, collision detection, and frameworks like Unity and LÖVE 2D. The course breaks
down famous games (e.g., Super Mario, Pokémon) to teach game mechanics practically.
3. Zenva Academy: Zenva provides practical, beginner-friendly courses focused on coding,
Unity, and Phaser engines. These courses include topics like C# programming and
JavaScript-based game development, giving you both theoretical and practical skills.
4. Udemy: With several free and affordable courses, Udemy allows learners to practice game
development through projects such as creating a Pong clone in C++ or arcade games in
JavaScript. Courses range from beginner to advanced levels.
5. Codecademy: This interactive platform provides coding lessons for essential game
development languages like Python, C#, and JavaScript. It’s ideal for learning to build
small projects while applying programming concepts directly.
These platforms emphasize a mix of theory and hands-on learning, making them great for both
beginners and those with some experience. Depending on your focus (e.g., coding, game engines,
or full-scale game development), these resources will help you develop practical skills and
portfolio-worthy projects.
26

<div class="quiz">
<div class="quiz-content">
<div class="question">
What is the sum of <span class="text-info" id="field1">5</span> and <span class="text-info"
id="field2">5</span>?
</div>
<div class="options">
<div class="fields animated zoomIn">
<div class="field-block" id="option1" onclick="checkAnswer(this)">
10
</div>
</div>
<div class="fields animated zoomIn">
<div class="field-block" id="option2" onclick="checkAnswer(this)">
10
</div>
</div>
<div class="fields animated zoomIn">
<div class="field-block" id="option3" onclick="checkAnswer(this)">
10
</div>
</div>
<div class="fields animated zoomIn">
<div class="field-block" id="option4" onclick="checkAnswer(this)">
10
</div>
</div>
</div>
<div class="after hide" id="after">

</div>
<div class="play-again">
<a class="button" onclick="playAgain()">Play Again</a>
</div>
</div>
</div>
27

<style type="text/css">
.App {
text-align: center;
}

.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 60px;
}

.App-header {
background-color: #222;
height: 180px;
padding: 20px;
color: white;
}

.App-intro {
font-size: large;
}

@keyframes App-logo-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}

.text-info {
color: #fff;
font-weight: bold;
font-size: 2.1rem;
}

.question {
font-size: 2rem;
}

.options {
28

margin: 5%;
display: flex;
margin-right: -12px;
margin-left: -12px;
flex-direction: row;
flex-wrap: wrap;
align-items: stretch;
flex: 1 0 auto;
}

.fields {
display: flex;
padding: 12px;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
flex: 1;
}

.field-block {
display: flex;
min-height: 160px;
padding: 10%;
flex-direction: row;
justify-content: center;
align-items: center;
/*flex: 1 0 auto;*/
border-radius: 4px;
background-color: #f9bad0;
font-size: 6rem;
color: #fff;
cursor: pointer;
}

.quiz {
color: #ddd;
margin: 2%;
29

background-color: #ec1561;
padding: 2%;
width: 90%;
position: relative;
}

.button {
display: flex;
height: 48px;
padding-right: 16px;
padding-left: 16px;
flex-direction: row;
justify-content: center;
align-items: center;
flex: 0 0 auto;
border-radius: 4px;
background-color: #2fcaaa;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .05), 0 2px 12px 0 rgba(0, 0, 0, .1);
transition: box-shadow 200ms ease-out;
color: #fff;
font-weight: 500;
text-align: center;
cursor: pointer;
}

.quiz .after {
position: absolute;
top: 5%;
left: 5%;
width: 90%;
height: 80%;
/*display: none;*/
color: #FFF;
text-align: center;
align-items: center;
justify-content: center;
display: flex;
30

opacity: 0.8;
font-size: 3rem;
}

.correct {
background-color: green;
}

.wrong {
background-color: #D91E18;
}

.hide {
display: none !important;
}

</style>

<script type="text/javascript">

playGame();

var riddle = {};

function randomNumber(min, max) {


return Math.floor(Math.random() * (max - min + 1) + min);
}

function playGame() {
var field1 = randomNumber(20, 50);
var field2 = randomNumber(20, 50);
var result = field1 + field2;
var resultsArray = generateRandomOptions(result);
resultsArray.push(result);
resultsArray.sort(function(a, b) {return 0.5 - Math.random()});

riddle = {
31

field1: field1,
field2: field2,
resultsArray: resultsArray,
answer: result
};

document.getElementById("field1").innerHTML = riddle.field1;
document.getElementById("field2").innerHTML = riddle.field2;
document.getElementById("option1").innerHTML = riddle.resultsArray[0];
document.getElementById("option2").innerHTML = riddle.resultsArray[1];
document.getElementById("option3").innerHTML = riddle.resultsArray[2];
document.getElementById("option4").innerHTML = riddle.resultsArray[3];

function generateRandomOptions(sum) {
var resultsArray = [];
var randomNumberArray = [];
var addSubtract = randomNumber(0, 1);
while (randomNumberArray.length < 3) {
var random = randomNumber(1, 10);
if (randomNumberArray.indexOf(random) > -1) continue;
randomNumberArray.push(random);
}

for (var i = 0; i < 3; i++) {


var addSubtract = randomNumber(0, 1);
var result = sum;
if (addSubtract === 1) {
result += randomNumberArray[i];
} else {
result += randomNumberArray[i];
}
resultsArray.push(result);
}

return resultsArray;
}
}
32

function checkAnswer(selectedElement) {
if (selectedElement.innerHTML == riddle.answer) {
after.classList.remove('hide');
after.classList.add('correct');
after.classList.add('animated');
after.classList.add('zoomInDown');
after.innerHTML = "Good Job! Hit the Play Again Button."
} else {
after.classList.remove('hide');
after.classList.add('wrong');
after.innerHTML = 'Ohh Ohh! You Missed it...'
}
}

function playAgain() {
var after = document.getElementById('after');
after.classList.remove('wrong');
after.classList.remove('correct');
after.classList.add('hide');
playGame();
}

</script>

You might also like