computer simulation (2) game playing. different types of games how many players? –one –two...
Post on 19-Dec-2015
226 views
TRANSCRIPT
Computer Simulation (2)Game Playing
Different Types of Games
• How many players?– One– Two
• Element of chance?– Deterministic– Nondeterministic
• Outcome– Zero sum (what one player wins, the other loses)– Non-zero sum
Different types of Games
Tower of Hanoi Solitaire
Chess
Tic-Tac-Toe
Go
Backgammon
Poker
Deterministic Nondeterministic
One Player
TwoPlayer
Using hill climbing for one player games
17 38 49 30 68 7 4 18
17 20 8 9
15 7
12
5
18 11 9 25 7 10 32 28
13 6 6 15
12 18
11
Start
(higher = better)
Game Tree for two person game
My Turn
Your Turn
My Turn
Your Turn
Game TreeMy
Turn = ??
Your Turn
My Turn
Your Turn
+1 +1 +1 +1 +1 +1 +1 +1 -1 +1 -1 +1 +1 -1 +1 -1
a1 a2
+1 = I win -1 = you win
Perfect decisions with two player games
• Each player will make the best decisions possible:
Player A: maximize score (higher scores better for A)
Player B: minimize score (lower scores better for B)
7 6 5 68
A
B
a1 a2
b1 b2 b3 b4
The Minimax Procedure
8 13 11 25 21 5 17 19
A
B
A
B
a1 a2
b1b2 b3
b4
a1 a2 a3 a4 a5 a6 a7 a8
1) Work upwards, 2) B will always pick minimum, and 3) A will always pick maximum
What does Minimax predict A will do?
17 38 49 30 68 7 4 18 18 11 9 25 7 10 32 28
A
B
A
B
a1 a2
b1b2 b3
b4
Fighting Combinatorial Explosion
limit branching factor
pruning the search tree
Depth-First Search
A
B
Depth-First Search & Minimax
7
A
9 8 7
4
6 5 4
1
3 2 1
7
B
Alpha-Beta Pruning
7
A
9 8 7
6
6 ? ?
?
? ? ?
7
B
AT LEAST 7
AT MOST 6no need to visit other branchesbelow this node
Alpha-Beta Pruning
7
A
9 8 7
6
6 ? ?
3
3 ? ?
7
B
Some states do not need to be searched!The alpha-beta method cleverly eliminates large part of the search space
Perfect Play with Connect 4
• Play the game against the computer– http://www.farfarfar.com/games/connect_four/– http://www.pomakis.com/c4/
• Perfect play – the game of Connect 4 can be planned to the end
• the first player can force a win by starting in the middle column. Starting in the two adjacent columns allows the second player to reach a draw; starting with the border columns even allows the second player to force a win.
• Why play the game if the outcome is already known (assuming perfect play)?
(content copied from http://encyclopedia.thefreedictionary.com/Connect%20Four)
Complexity of Game Trees
• Most games cannot be planned to the end -> combinatorial explosion
• Number of states to search = (N)D
– Branching factor (N):number of legal moves at each position (on average)
– Depth (D) = number of moves till the end
Branching factor
• Chess:
Branching factor = about 35 moves/ positions
Depth = about 100 moves total
(35)100 ≈ (10)120 number of positions to search
• Intelligent Search: decrease the branching factor
(35)2=1225 (35)6=1,838,265,625 vs.:
(5)2=25 (5)6=15,625
Chess Computers
• 1997: IBM’s Deep blue played world champion Gary Kasparov
Deep blue: 250,000,000 positions/sec
Kasparov: ?? positions/sec
• Brute force vs. Intelligent search
Comparing Brains & Computers
BRAINS COMPUTERS
Neurons/organicParallel computationDistributed MemoryUnreliable partsResistant to damageNot understood
Conscious/Intelligent
Silicon/ MetallicSerial ComputationLocalized MemoryReliable partsVulnerableUnderstood
??
Ask Yourself
Do you consider your own mind to be a bunch of software programs? Probably not!
Turing's challenge was this:
Can you really say what the difference is between the mind of a human being and the artificial 'mind' of a computer which simulates a human mind?
Turing Test
1.Interrogator2.Human3.Computer Program
Interrogator tries to determine who is the human and who is theComputer program
Loebner Prize
JUDGE: Is it April or May?ENTRANT: Um. I believe it's April.JUDGE: Why do you say that?ENTRANT: That's a very good question. Because months and days and so on are arbitrary - I suppose.JUDGE: It seems you are taking a certain tone with me. An agitated, human tone.ENTRANT: Really? You are somewhat reticent yourself.JUDGE: I never said you were reticent.ENTRANT: I know.JUDGE: Smug.ENTRANT: Moi*?JUDGE: I think you might be human.
Some clever programs
– Computer therapist ELIZA: • http://www-ai.ijs.si/eliza/eliza.html• http://www.manifestation.com/neurotoys/eliza.php3
– Modern chatter boxes:• http://cogsci.ucsd.edu/~asaygin/tt/ttest.html• http://www.abenteuermedien.de/jabberwock/• http://www.turinghub.com/turinghub.html
– Computer programs that learn: 20 Questions• http://y.20q.net:8095/btest