Are you Genius?
Let’s see what is rule to play my game Are You Genius:
Instead of money in my game I have used Points. Total points to win the game is 1 Million..
You will be having 15 Questions, each question will have 30 seconds. You have to answer each question within 30 seconds. For each question you can see 4 choice of answers and you have to pick the correct answer from the question. If you fail to answer within 30 seconds then you will be eliminated from the game. The person who answers all the 15 questions and wins the game is a Genius.
Lifeline: The player will have the following four lifelines:
Note: I will be using Icons in my application. User can click on these icons to use lifeline 1.
Ask to Computer: (If player click this option then computer will display the Answer. Note only 90% of answers will be correct. Remaining 10% might not be correct so Player has to decide weather he/she can pick the answer or not.).
50/50: The 2 non-correct answers from the choice will be removed. Player has to select the correct answer from the remaining 2 choices.
Ask to Shanu: (If player click this option then SHANU (The Program creator) will display the Answer. Note only 90% of answers will be correct. Remaining 10% might not be correct so Player has to decide weather he/she can pick the answer or not.)
Change Question: (Using this option user can change the current question to some other choice of question. If user click changeuestion then some other random question will be displayed. Note it can be easy or difficult since the random question is displaying, so the player has to think and decide to use this option. It’s a tricky one.)
Points for each question from 1st to 15th question.

Safe Zone
In each 5th question the player will reach the Safe Zone. Here in points we can see in each 5th question I have marked different color. Now for example let’s consider a player is playing this game and he/she answered 5 questions correctly and in 6th question if he picks the wrong answer then he will be getting total 1000 Points. If the player plays a game and he/she answers 3 questions correctly and for the 4th question if he picks the wrong answer then he will get 0 points no matter he answered 3 questions correctly. The player has to pick the correct answer. If he/she picks the wrong answer then he will be getting his last safe zone points. For example, a player answers 12 questions correctly and in 13th question if he picks the wrong answer then he will be getting 32,000 instead of 125,000 Points of 12th question. If the player answers all the 15 questions correctly then he’s the winner and will be a genius.
Walk Away
You can leave the game if you don’t want to lose all your points. For example, now you have answered 3 questions and before each question asked you will be asked to continue or walk away. If you select Walk Away, then you will get the last earned points. For example, now if you have answered 13 questions and if you click Walk Away before answering 14th question, then you will get 250,000 Points.
Timer
Each question will contain 45 second. If the player not pick the answer within 45 second then he will get the last answered point and will be eliminated from the game.
All this game rules logic has been implemented in my MVC application using AngularJS and WEB API. In code part we can see in detail how to implement this logic to make our own game.
Prerequisites
Visual Studio 2015 - You can download it from here.
You can also view my previous articles related to AngularJS using MVC and the WCF Rest Service.
- MVC AngularJs and WCF Rest Service For Mind Reader Quiz
- MVC, AngularJs and WCF Rest Service For Master Detail Grid
- AngularJs Filter, Sorting and Animation Using MVC and WCF Rest
- AngularJs Shopping Cart Using MVC and WCF Rest Service
- AngularJs Dynamic Menu Creation Using MVC and WCF Rest
Previous articles related to Angular JS,MVC and WEB API:
- AngularJs using MVC and and using Web API 2
- MVC, AngularJS CRUD Using WEB API 2 With Stored Procedure
- Dynamic Project Scheduling Using MVC and AngularJS
- MVC Web API and AngularJS For Word Puzzle Game
This article will explain in detail how to create an Online Are You Genius Game using MVC, Angular JS and WEB API 2. This article will explain the following:
- How to create sample tables and database at SQL Server.
- Using Entity Framework connect to database.
- Create WEB API controller to get the data and select random 16 result using LINQ query.
- How to install the Angular JS Package into a MVC application.
- How to create our Angular JS application to create our own Are You Genius Game.
AngularJS
We might be familiar with what Model, View, View Model (MVVM) and Model, View and Controller (MVC) are. AngularJS is a JavaScript framework that is purely based on HTML, CSS and JavaScript.
The AngularJS Model View Whatever (MVW) pattern is similar to the MVC and MVVM patterns. In our example I have used Model, View and Service. In the code par, let's see how to install and create AngularJS in our MVC application.
If you are interested in reading more about AngularJS, then kindly go through the following link.
Code Part
1. Create Database and Table.
We will create a QuestionDetails table under the Database ‘GeniusDB.
The following is the script to create a database, table and sample insert query. Run this script in your SQL Server. I have used SQL Server 2014.
- USE MASTER
- GO
- -- 1) Check for the Database Exists .If the database is exist then drop and create new DB
- IF EXISTS (SELECT [name] FROM sys.databases WHERE [name] = 'GeniusDB' )
- DROP DATABASE GeniusDB
- GO
- CREATE DATABASE GeniusDB
- GO
- USE GeniusDB
- GO
- -- 1) //////////// ItemDetails table
- -- Create Table ItemDetails,This table will be used to store the details like Item Information
- IF EXISTS ( SELECT [name] FROM sys.tables WHERE [name] = 'QuestionDetails' )
- DROP TABLE QuestionDetails
- GO
- CREATE TABLE QuestionDetails
- (
- Ques_ID int identity(1,1),
- Question VARCHAR(MAX) NOT NULL,
- Option1 VARCHAR(500) NOT NULL,
- Option2 VARCHAR(500) NOT NULL,
- Option3 VARCHAR(500) NOT NULL,
- Option4 VARCHAR(500) NOT NULL,
- Answer VARCHAR(500) NOT NULL,
- CONSTRAINT [PK_QuestionDetails] PRIMARY KEY CLUSTERED
- (
- Ques_ID ASC
- )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
- ) ON [PRIMARY]
- GO
- -- Insert the sample records to the ItemDetails Table
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('What is the Capital of India?','Delhi','OldDelhi','New Delhi','Delhi New','New Delhi')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('How many continent in world?','6','7','8','9','7')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('Seoul is the Capital of which Country?','korea North','Japan','Korea South','China','Korea South')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('Who is the First President of America?','George W. Bush','Barack Obama','George Washington','Abraham Lincoln','George Washington')
- --
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('who wrote Thirukural?','Avvaiyar','Thiruvalluvar','William Shakespeare','Kalidasa','Thiruvalluvar')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('what is the name of indian currency?','Won','Rupee','Yen','Renminbi','Rupee')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('How many players are there in a Cricket team?','25','40','11','6','11')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('How many seconds in one hour?','6','3600','36','360','3600')
- --
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('Which City located in 2 Continents - Europe and Asia?','Taipei','Ashgabat','Istanbul','Athens','Istanbul')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('What Bird Is Used As A Symbol Of Peace?','Peacock','Owl','Dove','White Cockatoo','Dove')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('who is father of Computer?','Charles Babbage','Antoine Lavoisier','Charles Cabbage','Nikola Tesla ','Charles Babbage')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('Where did Neil Armstrong landed?','SUN','STAR','MOON','SEA','MOON')
- --
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('What is the nick name of Wyoming State?','Water State','Sun State','Natural State','Equality State','Equality State')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('Petasos beach is in which country?','Finland','Ireland','Greece','Norway','Greece')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('How many bones does a dog have?','Average of 319','Average of 139','Average of 913','Average of 639','Average of 319')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('What is the Name of South korea President who got the Noble Price for Peace?','Park Geun-hye','Kim Dae-jung','Lee Myung-bak','Roh Moo-hyun','Kim Dae-jung')
- --
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('In which year did Sir Chandrasekhara Venkata Raman received the Nobel Prize for Physics?','1930','1979','1913','1989','1930')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('What is the name of supercontinent that existed during the late Paleozoic and early Mesozoic eras?','Laurasia','Gondwana','Pangaea','Pannotia','Pangaea')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('Who are the 4 people who won the Noble Prize 2 times?','Marie Curie,Malala Yousafzai,John Bardeen,Frederick Sanger','Marie Curie,Wolfgang Pauli,John Bardeen,Frederick Sanger','Marie Curie,Linus Pauling,John Bardeen,Frederick Sanger','Marie Curie,Linus Pauling,John Bardeen,Finn E. Kydland','Marie Curie,Linus Pauling,John Bardeen,Frederick Sanger')
- Insert into QuestionDetails(Question,Option1,Option2,Option3,Option4,Answer) values('What is the Name of present PANAMA President?','Mireya Moscoso','Juan Carlos Varela','Guillermo Endara','Martín Torrijos','Juan Carlos Varela')
- select * from QuestionDetails


































Pradeep SahooPosted Nov 5, 2015, 10:42 PM
Good way to learn !!!
Mukesh KumarPosted Oct 22, 2015, 2:51 PM
Great Work
Priyaranjan K SPosted Oct 21, 2015, 1:07 PM
Nice Article
Pramod GuptaPosted Oct 21, 2015, 11:29 AM
grt
Harshad PansuriyaPosted Oct 21, 2015, 7:48 AM
Great one Sir !!
Nilesh JadavPosted Oct 21, 2015, 6:39 AM
Nice one sir !!
Sumit JoshiPosted Sep 21, 2015, 3:30 AM
good one..
Sibeesh VenuPosted Sep 21, 2015, 3:24 AM
Nice Share :)
Humayun Kabir MamunPosted Sep 21, 2015, 2:43 AM
Great work...
Manas MohapatraPosted Sep 21, 2015, 2:29 AM
Great article Shanu.
Karthikeyan KPosted Sep 20, 2015, 1:38 AM
Excellent sir !!!...
Saineshwar BageriPosted Sep 20, 2015, 12:59 AM
nice one
Ankit BansalPosted Sep 19, 2015, 10:28 AM
Great use of AngularJS...Thanks for sharing source code...
Pooja BaraskarPosted Sep 19, 2015, 7:25 AM
Great Work !!
Afzaal Ahmad ZeeshanPosted Sep 19, 2015, 5:24 AM
Excellent article Shanu! Great work, the article represents your hard work. :-)
Debasis SahaPosted Sep 19, 2015, 3:40 AM
Nice One..
Nilesh JadavPosted Sep 19, 2015, 1:30 AM
This is Really Incredible !! Great News
Vaikesh K PPosted Sep 19, 2015, 12:32 AM
Great work :)
Harshad PansuriyaPosted Sep 19, 2015, 12:08 AM
Good One
Rajeesh MenothPosted Sep 18, 2015, 1:50 PM
Good Article :)