0% found this document useful (0 votes)
53 views

Assignment AI

This document describes a riddle game with three difficulty levels: easy, medium, and hard. The easy level contains 5 riddles where the player earns 10 points for each correct answer and must score 30 points total to win. The medium level also has 5 riddles but the player can earn or lose 10 points per answer and must score 30 points to win. Finally, the hard level consists of 5 riddles where the player must answer all questions correctly to win. The game is coded in Java using classes for the main game, easy level, medium level, and hard level. The code implements the constraints satisfaction problem framework by defining the variables as the riddles, domains as correct/incorrect answers, and

Uploaded by

Aqeel Zaffar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Assignment AI

This document describes a riddle game with three difficulty levels: easy, medium, and hard. The easy level contains 5 riddles where the player earns 10 points for each correct answer and must score 30 points total to win. The medium level also has 5 riddles but the player can earn or lose 10 points per answer and must score 30 points to win. Finally, the hard level consists of 5 riddles where the player must answer all questions correctly to win. The game is coded in Java using classes for the main game, easy level, medium level, and hard level. The code implements the constraints satisfaction problem framework by defining the variables as the riddles, domains as correct/incorrect answers, and

Uploaded by

Aqeel Zaffar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

GROUP MEMBERS

AQEEL ZAFFAR UW-19-CS-BS-001


M. NOMAN UW-19-CS-BS-029
PROG / SEM: BSCS 6th A
COURSE TITLE: ARTIFICIALINTELLIGENCE
COURSE CODE: CS-351
ASSIGNMENT: 02
SUBMITTED TO: MISS RIDA ZAHRA

Game Title: Guess Riddle Game


Exercise: 01
Write a brief description of your game in your word document. You must:
• Describe your game, including the back story and the setting of the game
• List the items in the game and how to use it
• Explain how the player wins
Solution:
Description:
Riddle games are educational resources that are transmitted by word of mouth from time
immemorial. Their purpose is, through a description of greater or lesser extent, to guess the word
we are looking for. Being a highly demanded resource for leisure time, we have gathered the best
collection of riddles for children under 18.There are different levels of riddles which you can
play.
 Benefits:
It will allow you to expand your vocabulary, develop cognitive capacity, encourage
imagination, and facilitate a greater association of ideas and many other things, which
you’ll discover as the fun also grows with these unique puns.
 Items:
In this riddles we have four main items:
 Easy
 Medium
 Hard
 Exit
When you play this game these four lists of items will be displayed on the screen. After
that they will ask from the player select any of the option of your own choice. If player
selects easy level then questions will appear in front of you one by one. Total there are
five questions in the riddle. Similarly medium and hard level contains different types of
riddles some of them contains mathematical and logical questions. Hard level contains
mathematical riddles while medium and easy level contains some logical riddles. If you
don’t want to play any of the riddle then you should select exit option it will exit you
from the game.
 Rewarding Criteria:
The reward policy varies at different levels of riddles.
 At Easy level on every correct answer you earn 10 points and you can win the
game if you are able to make 30 or above points.
 At Medium level of riddle you can earn 10 points on every correct answer and
you can also lose your 10 points in case of incorrect answer. A player who earns
30 points will win the riddle.
 At Hard level if you answer all of the five questions correctly then you will be
able to win riddle.

Exercise: 02
In the Context of the Constraint Satisfaction problem write the constraints of your game
In proper format
Hint* A finite set of variables that store the solution V={V 1 ,V 2 ,V 3 ,…,V n }
2. A set of discrete values known as Domain Form which the solution is picked.
D= {D1, D2, D3,…, Dn }
3. A finite set of constraints C={C1, C2 ,C3 ,…,Cn }

Solution:
In this game there are three levels easy, medium and hard and at each level the CSP (Constraint
satisfaction problem) components will approximately the same. However, the variables, domains
and constraint of this game can be defined as follows:
 Variables:
In this game the variables are the questions at each level of riddle. So variables at each
level of riddles are:
V= {Question 01, Question 02, Question 03, Question 04, Question 05}
 Domains:
The domains for each variable are either the answer is correct or incorrect.
Domain for variable Question 01is:
D1= {Correct, Incorrect}
Domain for variable Question 02is:
D2= {Correct, Incorrect}
Domain for variable Question 03is:
D3= {Correct, Incorrect}
Domain for variable Question 04is:
D4= {Correct, Incorrect}
Domain for variable Question 05is:
D5= {Correct, Incorrect}
 Constraints:
Easy Level:
C1: {(Question 01, Question 02, Question 03, Question 04, Question 05), Either of three
questions will be correct.}
Medium Level:
C2: {(Question 01, Question 02, Question 03, Question 04, Question 05), To win the
riddle you are required to earn 30 points.}
Hard Level:
C3: {(Question 01, Question 02, Question 03, Question 04, Question 05), All of the
questions must be correct.}

Exercise: 03
Code your game and explain each instance of your code separately and explain how it is aligned
with the CSP.

Solution:
We use java language to build this game and software that is used to build the game is eclipse.
Guess Riddle Games contains four classes which are as follows:
Each line of the code will be explain in code comments.

Riddle Class Code (Main Class)


EasyLevel Class Code
Medium Class Code
Hard Class Code
Game Output:

***THE END***

You might also like