You are on page 1of 15

ARIFICIAL INTELLIGENCE

UNIT 1
➢ Introduction, History, Intelligent systems, Foundations of AI, Applications, tic-
tac-toe game playing, Development of AI languages, Current trends in AI

INTRODUCTION :

What is AI ?
Artificial Intelligence is concerned with the design of intelligence in an artificial device.
The term was coined by McCarthy in 1956.

There are two ideas in the definition.


1. Intelligence
2. artificial device

What is intelligence?

Artificial intelligence is the study of systems that act in a way that to any observer would appear
to be intelligent.
Artificial Intelligence involves using methods based on the intelligent behaviour of humans
and other animals to solve complex problems.

–Is it that which characterize humans? Or is there an absolute standard of judgement?

Accordingly there are two possibilities:


– A system with intelligence is expected to behave as intelligently as a human
– A system with intelligence is expected to behave in the best possible manner
Secondly what type of behavior are we talking about?
– Are we looking at the thought process or reasoning ability of the system?
– Or are we only interested in the final manifestations of the system in terms of
its actions?
This distinction is brought into sharper contrast when we look at the difference between so-
called strong AI and weak AI.
The followers of strong AI believe that by giving a computer program sufficient processing
power, and by providing it with enough intelligence, one can create a computer that can literally
think and is conscious in the same way that a human is conscious.
Many philosophers and Artificial Intelligence researchers consider this view to be false,
and even ludicrous. The possibility of creating a robot with emotions and real consciousness is
one that is often explored in the realms of science fiction but is rarely considered to be a goal
of Artificial Intelligence.
Weak AI, in contrast, is simply the view that intelligent behavior can be modeled and
used by computers to solve complex problems. This point of view argues that just because a
computer behaves intelligently does not prove that it is actually intelligent in the way that a
human is. We will examine this argument in more detail in further classes.

History :

The Concept of Artificial Intelligence is goes back into classical ages


AI Covers the domains like :
Machine Learning, Deep Learning, Neural Networks, Natural Language Processing,
Knowledge Base and Expert Systems and so on. They also made way in Computer Vision and
Image Processing.

If AI is being here from over half a century ? Why it suddenly came an importance?
And why we are talking about AI now

History of Artificial Intelligence :

Artificial Intelligence is not a new word and not a new technology for researchers. This
technology is much older than you would imagine. Even there are the myths of Mechanical
men in Ancient Greek and Egyptian Myths. Following are some milestones in the history of
AI which defines the journey from the AI generation to till date development.

Maturation of Artificial Intelligence (1943-1952)


• Year 1943: The first work which is now recognized as AI was done by Warren
McCulloch and Walter pits in 1943. They proposed a model of artificial neurons.
• Year 1949: Donald Hebb demonstrated an updating rule for modifying the connection
strength between neurons. His rule is now called Hebbian learning.
• Year 1950: The Alan Turing who was an English mathematician and pioneered
Machine learning in 1950. Alan Turing publishes "Computing Machinery and
Intelligence" in which he proposed a test. The test can check the machine's ability to
exhibit intelligent behavior equivalent to human intelligence, called a Turing test.
The birth of Artificial Intelligence (1952-1956)
• Year 1955: An Allen Newell and Herbert A. Simon created the "first artificial
intelligence program "Which was named as "Logic Theorist". This program had proved
38 of 52 Mathematics theorems, and find new and more elegant proofs for some
theorems.
• Year 1956: The word "Artificial Intelligence" first adopted by American Computer
scientist John McCarthy at the Dartmouth Conference. For the first time, AI coined as
an academic field.
At that time high-level computer languages such as FORTRAN, LISP, or COBOL were
invented. And the enthusiasm for AI was very high at that time.

The golden years-Early enthusiasm (1956-1974)


• Year 1966: The researchers emphasized developing algorithms which can solve
mathematical problems. Joseph Weizenbaum created the first chatbot in 1966, which
was named as ELIZA.
• Year 1972: The first intelligent humanoid robot was built in Japan which was named
as WABOT-1.
The first AI winter (1974-1980)
• The duration between years 1974 to 1980 was the first AI winter duration. AI winter
refers to the time period where computer scientist dealt with a severe shortage of
funding from government for AI researches.
• During AI winters, an interest of publicity on artificial intelligence was decreased.
A boom of AI (1980-1987)
• Year 1980: After AI winter duration, AI came back with "Expert System". Expert
systems were programmed that emulate the decision-making ability of a human expert.
• In the Year 1980, the first national conference of the American Association of Artificial
Intelligence was held at Stanford University.
The second AI winter (1987-1993)
• The duration between the years 1987 to 1993 was the second AI Winter duration.
• Again Investors and government stopped in funding for AI research as due to high cost
but not efficient result. The expert system such as XCON was very cost effective.
The emergence of intelligent agents (1993-2011)
• Year 1997: In the year 1997, IBM Deep Blue beats world chess champion, Gary
Kasparov, and became the first computer to beat a world chess champion.
• Year 2002: for the first time, AI entered the home in the form of Roomba, a vacuum
cleaner.
• Year 2006: AI came in the Business world till the year 2006. Companies like Facebook,
Twitter, and Netflix also started using AI.
Deep learning, big data and artificial general intelligence (2011-
present)
• Year 2011: In the year 2011, IBM's Watson won jeopardy, a quiz show, where it had
to solve the complex questions as well as riddles. Watson had proved that it could
understand natural language and can solve tricky questions quickly.
• Year 2012: Google has launched an Android app feature "Google now", which was able
to provide information to the user as a prediction.
• Year 2014: In the year 2014, Chatbot "Eugene Goostman" won a competition in the
infamous "Turing test."
• Year 2018: The "Project Debater" from IBM debated on complex topics with two
master debaters and also performed extremely well.
• Google has demonstrated an AI program "Duplex" which was a virtual assistant and
which had taken hairdresser appointment on call, and lady on other side didn't notice
that she was talking with the machine.
Now AI has developed to a remarkable level. The concept of Deep learning, big data, and
data science are now trending like a boom. Nowadays companies like Google, Facebook, IBM,
and Amazon are working with AI and creating amazing devices. The future of Artificial
Intelligence is inspiring and will come with high intelligence.

Application of AI
Artificial Intelligence has various applications in today's society. It is becoming essential
for today's time because it can solve complex problems with an efficient way in multiple
industries, such as Healthcare, entertainment, finance, education, etc. AI is making our daily
life more comfortable and fast.
1. AI in Astronomy
Artificial Intelligence can be very useful to solve complex universe problems. AI
technology can be helpful for understanding the universe such as how it works, origin, etc.
2. AI in Healthcare
In the last, five to ten years, AI becoming more advantageous for the healthcare industry
and going to have a significant impact on this industry.
Healthcare Industries are applying AI to make a better and faster diagnosis than humans.
AI can help doctors with diagnoses and can inform when patients are worsening so that medical
help can reach to the patient before hospitalization.
3. AI in Gaming
AI can be used for gaming purpose. The AI machines can play strategic games like chess,
where the machine needs to think of a large number of possible places.

Following are some sectors which have the application of Artificial Intelligence:
4. AI in Finance
AI and finance industries are the best matches for each other. The finance industry is
implementing automation, chatbot, adaptive intelligence, algorithm trading, and machine
learning into financial processes.
5. AI in Data Security
The security of data is crucial for every company and cyber-attacks are growing very
rapidly in the digital world. AI can be used to make your data more safe and secure. Some
examples such as AEG bot, AI2 Platform,are used to determine software bug and cyber-attacks
in a better way.
6. AI in Social Media
Social Media sites such as Facebook, Twitter, and Snapchat contain billions of user
profiles, which need to be stored and managed in a very efficient way. AI can organize and
manage massive amounts of data. AI can analyze lots of data to identify the latest trends,
hashtag, and requirement of different users.
7. AI in Travel &Transport
AI is becoming highly demanding for travel industries. AI is capable of doing various travel
related works such as from making travel arrangement to suggesting the hotels, flights, and
best routes to the customers. Travel industries are using AI-powered chatbots which can make
human-like interaction with customers for better and fast response.
8. AI in Automotive Industry
Some Automotive industries are using AI to provide virtual assistant to their user for better
performance. Such as Tesla has introduced TeslaBot, an intelligent virtual assistant.
Various Industries are currently working for developing self-driven cars which can make
your journey more safe and secure.
9. AI in Robotics:
Artificial Intelligence has a remarkable role in Robotics. Usually, general robots are
programmed such that they can perform some repetitive task, but with the help of AI, we can
create intelligent robots which can perform tasks with their own experiences without pre-
programmed.
Humanoid Robots are best examples for AI in robotics, recently the intelligent Humanoid
robot named as Erica and Sophia has been developed which can talk and behave like humans.
10. AI in Entertainment
We are currently using some AI based applications in our daily life with some
entertainment services such as Netflix or Amazon. With the help of ML/AI algorithms, these
services show the recommendations for programs or shows.
11. AI in Agriculture
Agriculture is an area which requires various resources, labor, money, and time for best
result. Now a day's agriculture is becoming digital, and AI is emerging in this field. Agriculture
is applying AI as agriculture robotics, solid and crop monitoring, predictive analysis. AI in
agriculture can be very helpful for farmers.
12. AI in E-commerce
AI is providing a competitive edge to the e-commerce industry, and it is becoming more
demanding in the e-commerce business. AI is helping shoppers to discover associated products
with recommended size, color, or even brand.
13. AI in education:
AI can automate grading so that the tutor can have more time to teach. AI chatbot can
communicate with students as a teaching assistant.
AI in the future can be work as a personal virtual tutor for students, which will be accessible
easily at any time and any place.

Tic Tac Toe Game Playing


Tic-tac-toe (also known as noughts and crosses or Xs and Os) is a paper-and-pencil
game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player
who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row wins the
game.
How would you solve it?
I guess that would you think that the best move in such a scenario would be to place an
X in the middle of the board and win the game.
And you would be correct, but is this the only winning solution for X? How to derive
this solution?
In order to determine this, let’s draw a tree of all possible board states.
CODE:
// A C++ Program to play tic-tac-toe

#include<bits/stdc++.h>
using namespace std;
#define COMPUTER 1
#define HUMAN 2
#define SIDE 3 // Length of the board
// Computer will move with 'O' and human with 'X'
#define COMPUTERMOVE 'O'
#define HUMANMOVE 'X'
// A function to show the current board status
void showBoard(char board[][SIDE])
{
printf("\n\n");
printf("\t\t\t %c | %c | %c \n", board[0][0], board[0][1], board[0][2]);
printf("\t\t\t--------------\n");
printf("\t\t\t %c | %c | %c \n", board[1][0], board[1][1], board[1][2]);
printf("\t\t\t--------------\n");
printf("\t\t\t %c | %c | %c \n\n", board[2][0], board[2][1], board[2][2]);
return;
}
// A function to show the instructions
void showInstructions()
{
printf("\t\t\t Tic-Tac-Toe\n\n");
printf("Choose a cell numbered from 1 to 9 as below" " and play\n\n");
printf("\t\t\t 1 | 2 | 3 \n");
printf("\t\t\t--------------\n");
printf("\t\t\t 4 | 5 | 6 \n");
printf("\t\t\t--------------\n");
printf("\t\t\t 7 | 8 | 9 \n\n");
printf("-\t-\t-\t-\t-\t-\t-\t-\t-\t-\n\n");
return;
}
// A function to initialise the game
void initialise(char board[][SIDE], int moves[])
{
// Initiate the random number generator so that the same configuration doesn't arises
srand(time(NULL));
// Initially the board is empty
for (int i=0; i<SIDE; i++)
{
for (int j=0; j<SIDE; j++)
board[i][j] = ' ';
}
// Fill the moves with numbers
for (int i=0; i<SIDE*SIDE; i++)
moves[i] = i;
// randomise the moves
random_shuffle(moves, moves + SIDE*SIDE);
return;
}
// A function to declare the winner of the game
void declareWinner(int whoseTurn)
{
if (whoseTurn == COMPUTER)
printf("COMPUTER has won\n");
else
printf("HUMAN has won\n");
return;
}
// A function that returns true if any of the row is crossed with the same player's move
bool rowCrossed(char board[][SIDE])
{
for (int i=0; i<SIDE; i++)
{
if (board[i][0] == board[i][1] &&
board[i][1] == board[i][2] &&
board[i][0] != ' ')
return (true);
}
return(false);
}
// A function that returns true if any of the column is crossed with the same player's move
bool columnCrossed(char board[][SIDE])
{
for (int i=0; i<SIDE; i++)
{
if (board[0][i] == board[1][i] &&
board[1][i] == board[2][i] &&
board[0][i] != ' ')
return (true);
}
return(false);
}
// A function that returns true if any of the diagonal is crossed with the same player's move
bool diagonalCrossed(char board[][SIDE])
{
if (board[0][0] == board[1][1] &&
board[1][1] == board[2][2] &&
board[0][0] != ' ')
return(true);
if (board[0][2] == board[1][1] &&
board[1][1] == board[2][0] &&
board[0][2] != ' ')
return(true);
return(false);
}
// A function that returns true if the game is over else it returns a false
bool gameOver(char board[][SIDE])
{
return(rowCrossed(board) || columnCrossed(board)
|| diagonalCrossed(board) );
}
// A function to play Tic-Tac-Toe
void playTicTacToe(int whoseTurn)
{
// A 3*3 Tic-Tac-Toe board for playing
char board[SIDE][SIDE];
int moves[SIDE*SIDE];
// Initialise the game
initialise(board, moves);
// Show the instructions before playing
showInstructions();
int moveIndex = 0, x, y;
// Keep playing till the game is over or it is a draw
while (gameOver(board) == false && moveIndex != SIDE*SIDE)
{
if (whoseTurn == COMPUTER)
{
x = moves[moveIndex] / SIDE;
y = moves[moveIndex] % SIDE;
board[x][y] = COMPUTERMOVE;
printf("COMPUTER has put a %c in cell %d\n", COMPUTERMOVE, moves[moveIndex]+1);
showBoard(board);
moveIndex ++;
whoseTurn = HUMAN;
}
else if (whoseTurn == HUMAN)
{
x = moves[moveIndex] / SIDE;
y = moves[moveIndex] % SIDE;
board[x][y] = HUMANMOVE;
printf ("HUMAN has put a %c in cell %d\n", HUMANMOVE, moves[moveIndex]+1);
showBoard(board);
moveIndex ++;
whoseTurn = COMPUTER;
}
}

// If the game has drawn


if (gameOver(board) == false && moveIndex == SIDE * SIDE)
printf("It's a draw\n");
else
{
// Toggling the user to declare the actual winner
if (whoseTurn == COMPUTER)
whoseTurn = HUMAN;
else if (whoseTurn == HUMAN)
whoseTurn = COMPUTER;
// Declare the winner
declareWinner(whoseTurn);
}
return;
}
// Driver program
int main()
{
// Let us play the game with COMPUTER starting first
playTicTacToe(COMPUTER);
return (0);
}
Output:
Tic-Tac-Toe
Choose a cell numbered from 1 to 9 as below and play

1 | 2 | 3
--------------
4 | 5 | 6
--------------
7 | 8 | 9
- - - - - - - - - -

COMPUTER has put a O in cell 6

| |
--------------
| | O
--------------
| |
HUMAN has put a X in cell 7
| |
--------------
| | O
--------------
X | |
COMPUTER has put a O in cell 5
| |
--------------
| O | O
--------------
X | |
HUMAN has put a X in cell 1
X | |
--------------
| O | O
--------------
X | |
COMPUTER has put a O in cell 9
X | |
--------------
| O | O
--------------
X | | O
HUMAN has put a X in cell 8
X | |
--------------
| O | O
--------------
X | X | O
COMPUTER has put a O in cell 4
X | |
--------------
O | O | O
--------------
X | X | O
COMPUTER has won

AI Programming Languages

• AI programming is an elevation of technology that has brought efficiency and optimum


benefits to different company’s operations and peoples lives.
• AI has brought another level of smart technology to different industries and the
prospects of its potential still grows with the expectation that it would reach the human
intelligence.
• This is because developers are willing to explore, experiment and implement its
capabilities to satisfy more of the human and organization necessities.

Java, Python, Lisp, Prolog, and C++ are major AI programming language used for
artificial intelligence capable of satisfying different needs in the development and
designing of different software.

Python
Python (official website) is among developers favorites programming
languages in AI development because of its syntax simplicity and versatility.
Python is very encouraging for machine learning for developers as it is less
complex as compared to C++ and Java. It also a very portable language as it
is used on platforms including Linux, Windows, Mac OS, and UNIX. It is
also likable from its features such as Interactive, interpreted, modular,
dynamic, portable and high level which make it more unique than Java.

Advantages

• Python has a rich and extensive variety of library and tools.


• Supports algorithm testing without having to implement them.
• Python supporting object-oriented design increases a programmer’s productivity.
• Compared to Java and C++, Python is faster in development.

Drawbacks

• Developers accustomed to using Python face difficulty in adjusting to completely


different syntax when they try using other languages for AI programming.
• Unlike C++ and Java, python works with the help of an interpreter which makes
compilation and execution slower in AI development.
• Not suitable for mobile computing. For AI meant for mobile applications, Python
unsuitable due to its weak language for mobile computing.

C++
C++ is the fastest computer language, its speed is appreciated for AI
programming projects that are time sensitive. It provides faster execution
and has less response time which is applied in search engines and
development of computer games. In addition, C++ allows extensive use of
algorithms and is efficient in using statistical AI techniques. Another
important factor is that C++ supports re-use of programs in development due to inheritance and
data-hiding thus efficient in time and cost saving.

C++ is appropriate for machine learning and neural network.

Advantages

• Good for finding solutions for complex AI problems.


• Rich in library functions and programming tools collection.
• C++ is a multi-paradigm programming that supports object-oriented principles thus
useful in achieving organized data.

Drawbacks

• Poor in multitasking; C++ is suitable only for implementing core or the base of specific
systems or algorithms.
• It follows the bottom-up approach thus, highly complex making it hard for newbies
developers at using it for writing AI programs.

Java
Java (official website) is another programming language to answer ‘which
computer language is used for artificial intelligence?’ Java is also a multi-
paradigm language that follows object-oriented principles and the principle of
Once Written Read/Run Anywhere (WORA). It is an AI programming language
that can run on any platform that supports it without the need for recompilation.

Java is one of the most commonly used and not just in AI development. It derives a major part
of its syntax from C and C++ in addition to its lesser tools that them. Java is not only appropriate
for NLP and search algorithms but also for neural networks.
Advantages
• Very portable; it is easy to implement on different platforms because of Virtual
Machine Technology.
• Unlike C++, Java is simple to use and even debug.
• Has an automatic memory manager which eases the work of the developer.
Disadvantages
• Java is, however, slower than C++, it has less speed in execution and more response
time.
• Though highly portable, on older platforms, java would require dramatic changes on
software and hardware to facilitate.
• Java is also a generally immature programming AI language as there are still some
developments ongoing such as JDK 1.1 in beta.

LISP
LISP is another language used for artificial intelligence development. It is
a family of computer programming language and is the second oldest
programming language after Fortran. LISP has developed over time to
become strong and dynamic language in coding.

Some consider LISP as the best AI programming language due to the favour of liberty
it offers developers. LISP is used in AI because of its flexibility for fast in prototyping and
experimentation which in turn facilitate LISP to grow to a standard AI language. For instance,
LISP has a unique macro system which facilitates exploration and implementation of different
levels of Intellectual Intelligence.

Advantages

• Fast and efficient in coding as it is supported by compilers instead of interpreters.


• Automatic memory manager was invented for LISP, therefore, it has a garbage
collection.
• LISP offers specific control over systems resulting to their maximum use.

Drawbacks

• Few developers are well acquainted with Lisp programming.


• Being a vintage programming language artificial intelligence, LISP requires
configuration of new software and hardware to accommodate it use.

Prolog
Prolog is also one of the oldest programming languages thus also suitable for
the development of programming AI. Like Lisp, it is also a primary computer
language for artificial intelligence. It has mechanisms that facilitate flexible
frameworks developers enjoy working with. It is a rule-based and declarative
language as it contains facts and rules that dictate its artificial intelligence
coding language.
Prolog supports basic mechanisms such as pattern matching, tree-based data structuring, and
automatic backtracking essential for AI programming. Other than its extensive use in AI
projects, Prolog is also used for creation of medical systems.

Advantages

• Prolog has a built-in list handling essential in representing tree-based data structures.
• Efficient for fast prototyping for AI programs to be released modules frequently.
• Allows database creation simultaneous with running of the program.

Drawbacks

• Despite prolog old age, it has not been fully standardized in that some features differ in
implementation making the work of the developer cumbersome.

Current Trends in AI
1) Reinforcement Learning and its real-world applications
2) Deep Learning Optimisation
3) Deep Learning Applications
4) Meta Learning
5) Sequential Modeling
6) Machine Learning Optimization
7) Generative Models Applications
8) Natural Language Generation Architectures
9) Efficient Online Learning
10) Graph based algorithms

You might also like