You are on page 1of 19

Informatics College Pokhara

Artificial Intelligence
CU6051NA
Coursework 1

Submitted By: Submitted To:


Student Name: Ritesh Chaudhari Mr. Abhinav Dahal
London Met ID: 17031995
Group: L3C1 Artificial Intelligence
Date: 1-Feb-2019
Table of Contents
1. Introduction .................................................................................................................... 1
1.1 Explanation of the topic ...................................................................................... 2
1.2 Reasons for Selection ......................................................................................... 3
2. Mind Map......................................................................................................................... 4
2.1 Mind Map and Description ................................................................................. 4
2.1.1 Mind Map 1 ..................................................................................................... 4
3. Development ................................................................................................................... 9
3.1 Pseudocode................................................................................................................. 9
3.2 Concept Proof ........................................................................................................... 12
4. Analysis......................................................................................................................... 13
4.1 Concept Analysis................................................................................................ 13
4.2 State Diagram ...................................................................................................... 14
5. Conclusion ................................................................................................................... 15
References............................................................................................................................. 16
Table of Figure
Figure 1 Mind Map 1 For AI Chess AI Game ................................................... 4
Figure 2 Mind Map 2 for AI Chess Game......................................................... 5
Figure 3 Mind Map 3 for AI Chess game ......................................................... 6
Figure 4 Mind Map 4 for AI Chess Game......................................................... 7
Figure 5 Mind Map for AI Chess Game............................................................ 8
Figure 6 State Transition diagram for AI chess .............................................. 14
CU6051NA Application Development

1. Introduction

The modern definition of artificial intelligence (or AI) is "the study and design
of intelligent agents" where an intelligent agent is a system that perceives
its environment and takes actions which maximizes its chances of success.
John McCarthy, who coined the term in 1956, defines it as "the science and
engineering of making intelligent machines". The term artificial intelligence
is also used to describe a property of machines or programs: the intelligence
that the system demonstrates. (McCarthy, 2017). The Artificial Intelligence
is taking over the world so quick almost in every field. Even the concept of
AI is being implemented in the field of classic board games like Chess,
Mahjong, Sudoku and much more. The concept of using AI in these field
has helped the researchers and many technologists to understand how
quick the machine can learn and adopt with real world challenges.

Playing games with our friends or competitors have been quite a long.
Whenever we play games we try to figure out the possible outcomes of our
opponent’s tactics and we proceed according to that. One of the games
where we all try to figure out so hard to tackle the opponents move is the
Chess game. Chess game is one of the ancient games played for quite long.
Now to make it more complex, the researchers have used the concept of
Machine Learning and AI to teach the computers to play the game in their
own.

This is the individual report for the project done in Artificial Intelligence
module. The report demonstrates about the topic we are going to do as
project and also briefs about its selection. As the project is about Chess
game, the mind map is also described and designed according to it and also
same goes with the graphical summary. In the development part,
pseudocode for the project is also stated along with some diagrams to show
the transformation of different states of the game.

Ritesh Chaudhari 1
CU6051NA Application Development

1.1 Explanation of the topic


For the project of module Artificial Intelligence, I have selected the topic of
AI implementation in Chess Game. AI implementation in Board Game have
been a huge boost for Gaming industry for analysing the gamers behaviour.
Much work has been done in the past on designing Artificial Intelligence
(AI) programs to play “classic” board games, such as Chess, Checkers,
Othello, and Go. Many of these games have programs that are sufficiently
advanced that they beat the best human players. In the last ten to twenty
years, however, there has been a rise in “abstract” or “European-style”
board games. These differ from the board games many of us have played
as children (such as Monopoly or Life) in several areas: the games are
typically short, many finishing in 90 minutes or less; the games usually
emphasize player interaction in some way (components such as bidding,
competing for scarce resources, or trading/negotiation are commonly
seen); the games often are based around hidden information, so that
nobody can know the whole state of the game. These factors, especially
the last two, make designing an AI for these games a challenge, and so
much less has been done analysing these games, and what has been done
has much room for improvement. (McCulloh, n.d.)

The pattern that is used in the gaming industry with AI is NPC with decision
tree and path finding techniques. Moreover, the chess game uses the game
Engine to provide some logical decision to the computer mind. The
gameplay is similar as usual. The first move is made by the human player
and then by the computer. With each move the computer learns something
new with each movement of the set pieces. You can literally view the set
piece movement at the bottom of the game screen with some game code.
The game allows you to select the game depth level for the AI. Five different
game depth for AI is made. With each selection, the game speed varies
and game difficulty also increases. The more game depth means that the
computer AI will learn and then responses the counter move.

Ritesh Chaudhari 2
CU6051NA Application Development

1.2 Reasons for Selection


 Gaming section has become the huge area of investment in terms
of testing the AI.
 AI in general terms may be quite difficult for normal people to
understand and with game we can better make it clear.
 Lack of gaming industries in Nepal
 To show the use of path finding and decision tree algorithms for
making games.

Ritesh Chaudhari 3
CU6051NA Application Development

2. Mind Map
2.1 Mind Map and Description
2.1.1 Mind Map 1

Figure 1 Mind Map 1 For AI Chess AI Game

This is the first mind map, which I have done some research and analysis
on the given project topic. My project is a Chess game. This game is
completed with the use of Chess.js Library and its API. Within this topic
I have researched about some gaming algorithms used in Chess game
which is commonly known as NPC and path finding technique. The
environment selected for this project is only the web version with no
database. Vision is for making the computer learn more about the game.

Ritesh Chaudhari 4
CU6051NA Application Development

2.1.2 Mind Map 2

Figure 2 Mind Map 2 for AI Chess Game

In the second mind map, more research was carried out on the javascript
language and its frameworks. The whole system was fixed to be
developed in JavaScript and using the Chess.js framework for the
rendering and importing the chess game logic. More technical terms
were introduced in this project. Also the game is presented to the user.
Here as you can see the algorithm used in this game is clearly
mentioned.

Ritesh Chaudhari 5
CU6051NA Application Development

2.1.3 Mind Map 3

Figure 3 Mind Map 3 for AI Chess game

In this mind map, vision was cleared as what sort of algorithm the game
will use and how the computer will make decision on making the set
pieces. Also MinMax method for the game is used which causes the
computer to learn about the possible outcomes of the moves.

Ritesh Chaudhari 6
CU6051NA Application Development

2.1.4 Mind Map 4

Figure 4 Mind Map 4 for AI Chess Game

This mind goes deeper in the topic. How the game will behave and how
the machine will respond to the human response. Also you can view the
game activity with some more redefining algorithms.

Ritesh Chaudhari 7
CU6051NA Application Development

2.1.5 Mind Map 5

Figure 5 Mind Map for AI Chess Game

This is the last mind map, in this all the parts were cleared and algorithm
also was started according to Path Finding and Decision tree structure.
Here, in the path finding and decision tree structure with Alpha Beta
Pruning method the game uses the MinMax method with much filtered
and more accurate moves. This will cause the computer AI to learn and
respond quick to the human player.

Ritesh Chaudhari 8
CU6051NA Application Development

3. Development
3.1 Pseudocode

BEGIN

DO
START
DO

DO
load the Chess Board
VIEW game options
END DO

IF player SELECT depth level 1


DO
MAKE a game move
RESPONSE from COMPUTER AI in 2 Second TIME
END DO

ELSE IF player SELECT depth level 2


DO
make a game move
RESPONSE from COMPUTER AI in 5 Second TIME
END DO

ELSE IF player SELECT depth level 3


DO
make a game move
RESPONSE from COMPUTER AI in 10 Second TIME
END DO

ELSE IF player SELECT depth level 4

Ritesh Chaudhari 9
CU6051NA Application Development

DO
make a game move
RESPONSE from COMPUTER AI in 20 Second TIME
END DO

ELSE IF player SELECT depth level 5


DO
make a game move
RESPONSE from COMPUTER AI in 25 Second TIME
END DO

END IF

END DO

FOR VALID move


DO
Check set pieces move
IF set pieces move = negative area
THEN response invalid move
ELSE IF
set pieces move is valid
THEN
DO
MAKE a move
READ counter player move
THEN Computer AI repsonse to
player
END DO
END IF
END DO

FOR Winning
DO

Ritesh Chaudhari 10
CU6051NA Application Development

TARGET Queen set piece


IF so
DO
CHECK available safe Home THEN
MOVE set pieces to protect Queen set piece
ELSE IF
NO possible Move
DO
Respond with winning message.
END DO
END IF

END DO

IF game relods then launch again


END IF

END DO
END

Ritesh Chaudhari 11
CU6051NA Application Development

3.2 Concept Proof


The NPC and path finding method is a common topic while talking about
the Artificial Intelligence in games. We can take the example of Pong
Game, PUBG which uses these methods for the benefits of users and
make the game more interesting.

Talking about game, the chess game uses this methodology for making
the gam AI more efficient and more productive. Talking about these
methods, they make the decision making easier for the computer. Once
the computer learns using these methods they become more and more
efficient. Our chess game AI does the same. It observers and responds
with using these methods.

This concept is not new in the context of our country Nepal and but sure
in the college. Also in this module. no one have proposed this system for
the module project.

Ritesh Chaudhari 12
CU6051NA Application Development

4. Analysis
4.1 Concept Analysis
The initial concept was somewhat like making auto playing Tetris game
which uses the same pattern and method to improvise the AI function.
When more research was done on this topic then the idea was brought
to a different scale. On keeping research on these algorithms and
methods deeply, I concluded that this project can be better used in the
chess game where a human can compete with the computer. Also
Alpha Beta Pruning method was later introduced for making improvised
and more efficient moves with player.

In near future the AI will take over the gaming industry and will surely
dominate it. Vast amount games use AI game bots which will increase
the potency powerful and strong gaming characters. With the evolve in
technology these methods will also change gradually and they will be
made more powerful.

Ritesh Chaudhari 13
CU6051NA Application Development

4.2 State Diagram

Figure 6 State Transition diagram for AI chess

Ritesh Chaudhari 14
CU6051NA Application Development

5. Conclusion
Seeing the market and needs of online dating application backed by data
science and machine learning, we proposed and started working on the
project. We made sure we followed a proper process of software
engineering, including researching, designing, developing,
documenting, etc. in building the game using the NPC and path finding
methods.

Ritesh Chaudhari 15
CU6051NA Application Development

References
McCarthy, J., 2017. Science Daily. [Online]
Available at: https://www.sciencedaily.com/terms/artificial_intelligence.htm
[Accessed 31 January 2019].
McCulloh, D. S., n.d. Ohio Wesleyan University. [Online]
Available at: https://www.owu.edu/academics/reu/project-
descriptions/artificial-intelligence-for-modern-board-games/
[Accessed 2018].

Ritesh Chaudhari 16

You might also like