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 Deterministic Nondeterministic Tower of Hanoi Solitaire Chess Tic-Tac-Toe Go Backgammon Poker One Player Two Player 1 Using hill climbing for one player games Start 5 12 11 7 15 17 20 17 38 49 30 68 8 9 7 18 12 4 13 18 6 18 11 9 6 25 7 15 10 32 28 (higher = better) Game Tree for two person game My Turn Your Turn My Turn Your Turn +1 = I win Game Tree -1 = you win My Turn = ?? a1 a2 Your Turn My Turn Your Turn +1 +1 +1 +1 +1 +1 +1 +1 -1 +1 -1 +1 +1 -1 +1 -1 2 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) A a1 a2 b2 b3 B b1 6 7 b4 68 5 The Minimax Procedure 1) Work upwards, 2) B will always pick minimum, and 3) A will always pick maximum A a1 a2 B b2 b1 b4 b3 A a1 a2 8 a3 13 a4 11 a5 25 a6 21 a7 5 a8 17 19 B What does Minimax predict A will do? A a1 a2 B b1 b2 b4 b3 A B 17 38 49 30 68 7 4 18 18 11 9 25 7 10 32 28 3 Fighting Combinatorial Explosion Æ limit branching factor Æ pruning the search tree Depth-First Search A B Depth-First Search & Minimax A 7 9 8 7 6 5 B 1 4 7 4 3 2 1 4 Alpha-Beta Pruning AT LEAST 7 8 7 ? 6 B ? 6 7 9 AT MOST 6 no need to visit other branches below this node A 7 ? ? ? ? Alpha-Beta Pruning A 7 9 8 7 6 ? B 3 6 7 ? 3 ? ? 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) 5 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)6=15,625 (5)2=25 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 6 Comparing Brains & Computers BRAINS COMPUTERS Neurons/organic Parallel computation Distributed Memory Unreliable parts Resistant to damage Not understood Silicon/ Metallic Serial Computation Localized Memory Reliable parts Vulnerable Understood Conscious/Intelligent ?? 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.Interrogator 2.Human 3.Computer Program Interrogator tries to determine who is the human and who is the Computer program 7 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 8
© Copyright 2026 Paperzz