Date post: | 11-Jun-2015 |
Category: |
Technology |
Upload: | jinho-d-choi |
View: | 802 times |
Download: | 0 times |
An Elementary NavigationAn Elementary NavigationSimulated in JavaSimulated in Java
Presented by Jinho D. Choi
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence- A branch of computer science dealing with the simulation of intelligent behavior in computers
Artificially Intelligent Car- A car that can move safely without human driving
Simulation- An examination of a problem often not subject to direct experimentation
Solving a mazeSolving a maze Maze
- A confusing intricate network of passages
Brain vs. Recursive Algorithm Base part
- Whether or not you reach the exit Recursive part
- Where to go in order to reach the exit
- Moving to an empty cell- Backtracking
boolean solveMaze(var maze, var location){ if (reach the goal)
return true; else {
// moving to an empty cellif ((down-cell is empty) || (right-cell is empty) || (up-cell is empty) || (left-cell is empty)){ maze[location] = ‘X’; // mark the location
if (down-cell is empty)
return solveMaze(maze, down-cell); else if (right-cell is empty)
return solveMaze(maze, right-cell); else if (up-cell is empty)
return solveMaze(maze, up-cell); else if (left-cell is empty)
return solveMaze(maze, left-cell);}// backtrackingelse if ((down-cell is marked) || (right-cell is marked) ||
(up-cell is marked) || (left-cell is marked)){ maze[location] = ‘#’; // block the location
if (down-cell is marked)
return solveMaze(maze, down-cell); else if (right-cell is marked)
return solveMaze(maze, right-cell); else if (up-cell is marked)
return solveMaze(maze, up-cell); else if (left-cell is marked)
return solveMaze(maze, left-cell); else
return false; // path does not exist}
}}
Solving a maze with the fixed entry and exitSolving a maze with the fixed entry and exit
‘Finding an empty cell’ vs. ‘Backtracking’ Right, Down direction vs. Left, Up direction
r, cr
r+ 1
r-1
c c+ 1c-1.***.....**.***....****.*.**.*.*.******...******.
boolean solveMaze(int r, int c){ if (r == MAX-1 && c == MAX-1)
return true; // reaches the exit else if (maze[r+1][c]=='.') || (maze[r-1][c]=='.') ||
(maze[r][c+1]=='.') || (maze[r][c-1]=='.')) {
maze[r][c] = '+'; // moves to an empty cell
if (maze[r+1][c] == '.') r++;else if (maze[r][c+1] == '.') c++;else if (maze[r-1][c] == '.') r--;else if (maze[r][c-1] == '.') c--;
} else {
maze[r][c] = '-'; // backtracks
if (maze[r+1][c] == '+') r++;else if (maze[r][c+1] == '+') c++;else if (maze[r-1][c] == '+') r--;else if (maze[r][c-1] == '+') c--;else return false; // no path exists
}
return solveMaze(r, c);}
Examples 1.1
Solving a maze with the unfixed entry and exitSolving a maze with the unfixed entry and exit
Unfixed Entry- Can be located at any cell before the program begins
Ordering in backtracking- Left, Up, Right, Down- Code 1.1- Example 1.2- Example 1.3
Finding the best path through a mazeFinding the best path through a maze
Priority of 4 directions- right, down, up, left- Example 1.4
Permutation of 4 numbers- Code 1.2
Convert numbers to directions- (0, 1, 2, 3) to (up, down right, left)- Code 1.3
Count the steps- Code 1.4 Example 1.5
Driving on a street I (A single Driving on a street I (A single car)car)
Map- A representation usually on a flat surface of the whole or a part of an area
Speed limit, stop signs, traffic signals
Speed limitsSpeed limits
Cruise control Physics Problems
- Acceleration & Deceleration
- Rotational Energy
- Frictions
- Example 2.1
Visiting a placeVisiting a place
Map of ‘Jinho City’- Coe, Eby, H Mart, and St. Lukes
Representations- building, null, up, right, down, and left
Database for places Code 2.1 Example 2.2
int iMap[][] = {{0, 0, 4, 1, 0, 0, 2, 0, 0},
{0, 1, 4, 1, 4, 2, 2, 1, 0},
{5, 5, 4, 5, 5, 5, 5, 5, 5},
{3, 3, 4, 3, 3, 3, 2, 3, 3},
{0, 5, 4, 0, 0, 0, 2, 1, 1},
{0, 3, 4, 0, 0, 0, 2, 5, 0},
{1, 1, 4, 0, 0, 0, 2, 3, 0},
{0, 0, 4, 2, 4, 1, 2, 0, 0},
{0, 0, 3, 3, 3, 3, 2, 1, 0}};
Stop signsStop signs
Only one object- No need for stop signs
Location of stop signs Pause for ½ second Example 2.3
Traffic signalsTraffic signals
Properties- Horizontal & Vertical- Take turns about 10 sec.- Sense 2 blocks before
Database for traffic signals- Code 2.2
Synchronization- Code 2.3
Example 2.4
Driving on a street II (Multiple Driving on a street II (Multiple cars)cars)
A good beginning for an artificial intelligent car Less flexibility vs. more safety Convenient for humans, beneficial for society
Three moving objectsThree moving objects
Object 1, Object 2, and Object 3
Database for the objects- Code 3.1
Keeps the traffic signals- Code 3.2
Example 3.1
Visiting a place against 3 other objectsVisiting a place against 3 other objects
Chance for the intersections- Code 3.3
Stop signs- Check if the street is clear- Code 3.4
Example 3.2
Day and night situationsDay and night situations
Turn on the headlights
Slow down
Example 3.3
AppendixAppendixBlackjack Chess
4 / 4 Puzzle Elephant Spinout
Thanks for coming to my Thanks for coming to my presentationpresentation
http://www.public.coe.edu/organizations/ComputerClub/