quiz 1 - cdn.cs50.netcdn.cs50.net/2015/fall/lectures/11/m/week11m.pdfquiz 1! last lecture!! friday...

35
Quiz 1

Upload: dinhlien

Post on 18-Aug-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

Quiz 1!

Last Lecture!!

Friday 11/20 at Yale!Monday 11/23 at Harvard !

Search!(Solving problems with brute-force approaches)!

Boston!

San!Francisco!

Boston!

San!Francisco!

New York!

Miami!

Chicago!

Boston!

San!Francisco!

New York!

Miami!

Chicago!

Nashville!

Austin!

Denver!

Phoenix!

Search Trees!Boston!

New York! Miami!Chicago!

San!Francisco!

Phoenix!

Austin!Nashville!Denver! Nashville!

San!Francisco!

Phoenix!

Austin!

San!Francisco!

Phoenix!

Austin!

San!Francisco!

Phoenix!

Austin!

San!Francisco!

Search Trees!Boston!

New York! Miami!Chicago!

San!Francisco!

Phoenix!

Austin!Nashville!Denver! Nashville!

San!Francisco!

Phoenix!

Austin!

San!Francisco!

Phoenix!

Austin!

San!Francisco!

Phoenix!

Austin!

San!Francisco!

Metric: Distance!

Search Trees!Boston!

New York! Miami!Chicago!

San!Francisco!

Phoenix!

Austin!Nashville!Denver! Nashville!

San!Francisco!

Phoenix!

Austin!

San!Francisco!

Phoenix!

Austin!

San!Francisco!

Phoenix!

Austin!

San!Francisco!

Metric: Cost!

Search Trees!Boston!

New York! Miami!Chicago!

San!Francisco!

Phoenix!

Austin!Nashville!Denver! Nashville!

San!Francisco!

Phoenix!

Austin!

San!Francisco!

Phoenix!

Austin!

San!Francisco!

Phoenix!

Austin!

San!Francisco!

Metric: Best Food Options!

Adversarial Search!(how to play games and make it look like research)!

X! X!X!X! X! X!

X! X! X!

O!X!

O!X!

O!X! O! X! X! O! X!

O!X!O!

X!O!

X!O! X!

X!O! X! O! X! X! O! X!

X!O! X!

X!

X!O! X!

O! X!O! X!

X!O! X! O!

X!O! X!O!

X!O! X!

O!

O! X!O! X!

X!O! X!

O!

O! X!X!

X plays!

X plays!

O plays!

O plays!

Minimax Strategy:!!

Choose the move which leaves your opponent with the worst set of possibilities!

Minimax Algorithm!Generate the entire game tree

Evaluate each terminal node (high values are good for your side)

Filter values from the terminal nodes up through the tree:

At nodes controlled by your opponent, choose the minimum value of the children

At nodes controlled by you, choose the maximum value of the children

When you reach the top of the tree, you have an optimal solution

Minimax!

8! 7! 2! 9! 1! 6! 2! 4! 1! 1! 3! 5! 3! 9! 2! 6! 5! 2! 1! 3!2! 9! 7! 2! 11! 6! 4!

8!

MAX!

MIN! MIN!

MAX! MAX!9! 4! 5! 9! 6! 3! 9! 11!

4! 5! 3!

5!

Tic-Tac-Toe!

https://xkcd.com/832/!

What happens when we cannot compute the complete tree?!

Evaluation Function!

The alpha-beta principle!!

If you have an idea that is bad, !don’t waste time seeing how truly awful it is!

Minimax with Alpha-Beta!

8! 7! 2! 9! 1! 6! 2! 4! 1! 1! 3! 5! 3! 9! 2! 6! 5! 2! 1! 3!2! 9! 7! 2! 11! 6! 4!

≥8!=8!

≤8!

≥9! ≥2!

=5!

≥4!

=4!

=4!≥4! ≥6!≥9!≥3!

≤5!

=5!≥3!≥1!

≤3!

=5!

=3!≥2!≥1!

≥5!MAX!

MIN! MIN!

MAX! MAX!

In this example, only 16 out of 27 terminal states are evaluated!

Game Complexity!Board !Size!

Branching Factor!

Number of Leaves! First Machine Champion!

Tic-Tac-Toe! 3x3! 4! 10^5! -- trivial --!

Connect-4! 6x7! 4! 10^21! -- solved --!

Checkers! 8x8 (halved)! 2.8! 10^31! Chinook defeats !Marion Tinsley (1992)!

Chess! 8x8! 35! 10^123! Deep Blue defeats !Garry Kasparov (1995)!

Go! 19x19! 250! 10^360! none!

Traditional Board Games!

Perfect information !

Static environment!

Discrete action space!

Deterministic actions !

Beyond Board Games!

doi:10.1038/nature14236!

Modern AI Opponents!

4X Computer Games!

Limited information !

Dynamic environment!

Discrete action space!

Deterministic actions !

!

First-Person Computer Games!

Limited information !

Dynamic environment!

Continuous action space!

Sometimes Stochastic actions !

!

Robotics!

Limited information !

Dynamic environment!

Continuous action space!

Stochastic actions !

!

Robotics & Game Playing Agent Architectures!

Baxter!