Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 39

Artificial Intelligence

What is AI?
Acting Humanly: The Turing Test
• Alan Turing (1950)
• designed to provide a satisfactory operational definition of
intelligence
• Turing defined intelligent behavior as the ability to achieve
human-level performance in all cognitive tasks, sufficient to fool
an interrogator.
• The computer would need to possess the following capabilities:
• natural language processing
• knowledge representation
• automated reasoning
• machine learning
Thinking Humanly: Cognitive Modelling
• If we are going to say that a given program thinks like a
human, we must have some way of determining how
humans think. 
• We need to get inside the actual workings of human
minds.
• There are two ways to do this:
• through introspection
• through psychological experiments
• cognitive science brings together computer models from
AI and experimental techniques from psychology to try
to construct precise and testable theories of the
workings of the human mind. 
Thinking Rationally: Laws of Thought
• Aristotle was one of the first to attempt to codify ``right
thinking,'' that is, irrefutable reasoning processes.
• Formal Logic provides a precise notation and rules for
representing and reasoning with all kinds of things in the
world.
• Limitation:
• Informal knowledge representation.
• Computational complexity and resources.
Acting Rationally
• Acting rationally means acting so as to achieve one's
goals, given one's beliefs. 
• An agent is just something that perceives and acts
• In the ``laws of thought'' approach to AI, the whole
emphasis was on correct inferences.
• Act rationally is to reason logically to the conclusion that
a given action will achieve one's goals, and then to act
on that conclusion.
Task Domains of AI
• Mundane Tasks
• Formal Tasks
• Expert Tasks
Mundane Tasks
• Perception
– Vision
– Speech
• Natural Language
– Understanding
– Generation
– Translation
• Common sense reasoning
• Robot control
Formal Tasks
• Games
– Chess
– Backhammon
– Checks G0
• Mathematics
– Geometry
– Logic
– Integral calculus
– Proving properties of programs
Expert Tasks
• Engineering
– Design
– Fault finding
– Manufacturing planning
• Scientific analysis
• Medical diagnosis
• Financial analysis
Game Playing is a
a) Mundane Task
b) Formal Task
c) Expert Task
d) All of these
Game Playing is a
a) Mundane Task
b) Formal Task
c) Expert Task
d) All of these
Natural Language Processing is a
a) Mundane Task
b) Formal Task
c) Expert Task
d) All of these
Natural Language Processing is a
a) Mundane Task
b) Formal Task
c) Expert Task
d) All of these
Medical diagnosis is a
a) Mundane Task
b) Formal Task
c) Expert Task
d) All of these
Medical diagnosis is a
a) Mundane Task
b) Formal Task
c) Expert Task
d) All of these
Cognitive science is used for evaluating an AI
machine
• Thinks humanly
• Acting humanly
• Thinking rationally
• Acting rationally
Cognitive science is used for evaluating an AI
machine
• Thinks humanly
• Acting humanly
• Thinking rationally
• Acting rationally
Turing test is used to evaluate an AI machine

• Thinks humanly
• Acting humanly
• Thinking rationally
• Acting rationally
Turing test is used to evaluate an AI machine

• Thinks humanly
• Acting humanly
• Thinking rationally
• Acting rationally
AI Technique
• AI technique is a method that exploits knowledge
that should be represented in such a way that:
– Knowledge captures generalization.
– It must be provided in terms, AI domain understand.
– It can easily by modified to correct errors and to
reflect changes in the world and in our world view.
– It can be used in a great many situations even if it is
not totally accurate or complete.
– It can be used to help overcome its own sheet bulk by
helping to narrow the range of possibilities that must
usually be considered.
Limitations of Knowledge
• Intelligence requires knowledge.
• Knowledge possesses some less desirable
properties, including
– It is voluminous.
– It is hard to characterize accurately.
– It is constantly changing.
– It differs from data by being organized in a way
that corresponds to the way it will be used.
Example – Tic-Tac-Toe
• We present a series of three approaches to
play Tic-Tac-Toe which increase in
– Complexity
– Use of generalization
– Clarity of knowledge
Tic-Tac-Toe Approach 1 (Table Based)
• Data Structures
– Board
• A nine element vector representing the board, where the
elements of the vector correspond to the board positions.
1 2 3
4 5 6
7 8 9
An element contains the value 0 if the corresponding square
is blank, 1 if it is filled with an X, or 2 if it is filled with an O.
– Move table
• A large vector of 39 (=19,683) elements, each element of
which is a nine-element vector.
Tic-Tac-Toe Approach 1 (Algo)
• To make a move, do the following:
– View the vector board as ternary number. Convert
it to a decimal number.
– Use the number computed in step 1 as an index
into Move table and access the vector stored
there.
– The vector selected in step 2 represents the way
the board will look after the move that should be
made. So set Board equal to that vector.
Advantages of Approach 1
• The program is very efficient in terms of time.
• In theory, it could play an optimal game of tic-
tac-toe.
Disadvantages of Approach 1
• It takes a lot of space to store the table that specifies
the correct move to make from each board position.
• Someone will have to do a lot of work specifying all the
entries in the move table.
• It is very unlikely that all the required move table
entries can be determined and entered without any
errors.
• If we want to extend the game, say to three
dimensions, we could have to start from scratch, and in
fact this technique would no longer work at all, since 327
board positions would have to be stored, thus
overwhelming present computer memories.
Approach 2
• Data Structure
– Board
• A nine element vector representing the board as
described in approach 1. But instead of using the
number 0, 1 or 2 in each element, we store 2
(indicating blank), 3 (indicating X), or 5 (indicating O).
– Turn
• An integer indicating which move of the game is about
to be played; 1 indicated the first move, 9 the last.
Approach 2 Algorithm
• Uses three sub procedures:
– Make 2
– Posswin(p)
– Go(n)
Make 2
• Returns 5 if the center square of the board is
blank, that is if board[5]=2, otherwise this
function returns any blank non corner square
(2, 4, 6, or 8).

Posswin(p)
• Returns 0 if player p cannot win on his next move;
otherwise, it returns the number of the square
that constitutes a winning move.
• This function will enable the program both to win
and to block the opponent’s win.(#Posswin checks
row,column,diagonal)
• If the product is 18 (3 X 3 X 2) then X can win.
• If the product is 50 (5 X 5 X 2), then O can win.
• If we find a winning row, we determine which
element is blank, and return the number of that
square.
Go(n)
• Makes a move in square n.
• This procedure sets board[n] to 3 if Turn is odd
or 5 if Turn is even. It also increments Turn by
one.
Moves
• Turn =1: Go(1) (upper left corner).
• Turn =2: If board[5] is blank, Go(5), else Go(1).
• Turn =3: If board[9] is blank, Go(9), else Go(3).
• Turn =4: If Posswin(X) is not 0, then Go(Posswin(X)) [i.e. block
opponent’s win], else Go(Make2)
• Turn =5: If Posswin(X) is not 0, then Go(Posswin(X)) [i.e. win], else if
Posswin(O) is not 0, then Go(Posswin(O))[i.e. block win] else if
board[7] is blank, then Go(7) else Go(3).
• Turn =6: If Posswin(O) is not 0 then Go(Posswin(O)), else if
Posswin(X)is not 0, then Go(Posswin(X)), else Go(Make2).
• Turn =7: If Posswin(X) is not 0, then Go(Posswin(X)), else if Posswin(O)
is not 0, then Go(Posswin(O)), else go anywhere that is blank.
• Turn =8: If Posswin(O) is not 0 then Go(Posswin(O)), else if
Posswin(X)is not 0, then Go(Posswin(X)), else go anywhere that is
blank.
• Turn =9: Same as Turn 7.
Move table
• Move 1:- 1 GO 1
• Move 2:- 5 GO 5
• Move 3:- 9 GO 9
• Move 4:- 8 Non corner
• Move 5:- 2 non corner
• Move 6:- 3 Block X winning
• Move 7:- 7 Block O winning
• Move 8:- 4 anywhere
• Move 9:- 6 same as 7
Comments
• It is not quite as efficient in terms of time as
the first one since it has to check several
conditions before making each move.
• But it is more efficient in terms of space.
• It is also easier to understand the program’s
strategy or to change the strategy if desired.
Approach 3 (Magic Square)
• This approach is identical to Approach 2 except for one change in the
representation of the board.
• Vector elements arranged as a magic square: all the rows, columns and
diagonals sum up to 15.
8 3 4
1 5 9
6 7 2
• Process of checking winning condition is simple.
• We keep a list of squares for each player in which he/ she has played.
• To check for a possible win,
– we consider each pair of squares owned by that player and compute the difference
between 15 and the sum of the two squares.
– If the difference is not positive or if it is greater than 9, then the original two squares
were not collinear,and so can be ignored
– Otherwise, if the square representing the difference is blank, a move there will produce
a win.
HUMAN MACHINE
Move 2- 8 Move 1- 5
Move 4- 6 Move 3- 5, 4
Move 6- 8,6,3 Move 5:-
5+4=9
15-9=6 [not empty,machine
can’t win]
Now checks Human win :-
8+6=14
15-14=1[empty,will not allow
human to win]

=>Move 5- 5,4,1

Move 7:-
Lets take 5+1=6
15-6=9[empty,winning move
for machine]

=>Move 7- 5,4,1,9

MACHINE WINS
Advantages of Approach 3
• Since no player can have more than four
squares at a time, there will be many fewer
squares examined.
Thanks

You might also like