Pertemuan 15 Game Playing

12
1 Pertemuan 15 Game Playing Matakuliah : T0264/Intelijensia Semu Tahun : Juli 2006 Versi : 2/1

description

Pertemuan 15 Game Playing. Matakuliah: T0264/Intelijensia Semu Tahun: Juli 2006 Versi: 2/1. Learning Outcomes. Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : > >. Outline Materi. Materi 1 Materi 2 Materi 3 Materi 4 Materi 5. 12.1. Overview. - PowerPoint PPT Presentation

Transcript of Pertemuan 15 Game Playing

Page 1: Pertemuan 15 Game Playing

1

Pertemuan 15Game Playing

Matakuliah : T0264/Intelijensia Semu

Tahun : Juli 2006

Versi : 2/1

Page 2: Pertemuan 15 Game Playing

2

Learning Outcomes

Pada akhir pertemuan ini, diharapkan mahasiswa

akan mampu :

• << TIK-99 >>

• << TIK-99>>

Page 3: Pertemuan 15 Game Playing

3

Outline Materi

• Materi 1

• Materi 2

• Materi 3

• Materi 4

• Materi 5

Page 4: Pertemuan 15 Game Playing

4

12.1. Overview

• Mudah untuk menentukan ukuran kesuksesan dan kegagalan (menang atau kalah).

• Perhatikan permainan Catur (chess).• Rata-rata setiap node bercang sebanyak 35.

Tiap pemain rata-rata bergerak 50 kali. Sehingga total dalam satu pohon permainan akan terdapat posisi sebanyak 35100.

• Netoda-metoda yang digunakan dalam game : Depth-limited search. Statistic evaluation function. Credit assignment problem. Minimax search algorithm.

Page 5: Pertemuan 15 Game Playing

5

12.2. Prosedur pencarian MINIMAX

• One-Ply Search :

• Two - Ply Search :

A

B C D

(8) (3) (-2)

A

B C D

E F G H I J K

(9) (-6) (0) (0) (-2) (-4) (-3)

Page 6: Pertemuan 15 Game Playing

6

Prosedur pencarian MINIMAX

• Backing Up the Values of a Two-Ply Search

Page 7: Pertemuan 15 Game Playing

7

Algorithm : MINIMAX (Position,Depth, Player)

1. If DEEP-ENOUGH(Position, Depth), then return the structure

VALUE = STATIC(Position, Player); PATH = nil This indicates that there is no path from this node and

that its value is determined by static evaluation function.2. Otherwise,generate one more ply of the tree by calling

the function MOVEGEN(Position,Player) and setting SUCCESORS to the list it returns.

3. If SUCCESORS is empty, then there are no moves to be made, so return the structure that would have been returned if DEEP-ENOUGH had returned true.

Page 8: Pertemuan 15 Game Playing

8

Algorithm contd’

4. If SUCCESORS is not empty, then examine each element in turn and keep track of the best one. This is done as follows. Initialize BEST-SCORE to the minimum value that STATIC can return. It will be update to reflect the best score that can be achieved by an element of SUCCESORS. For each element SUCC of SUCCESORS, do the following :

a) Set RESULT- SUCC to MINIMAX(SUCC, Depht + 1, OPPOSITE(Player))

This recursive call to MINIMAX will actually carry out the exploration of SUCC.

b) Set NEW-VALUE to - VALUE(RESULT-SUCC). This will cause it to reflect the merits of the position from the opposite perspective from that of the next lower level.

c) If NEW-VALUE > BEST-SCORE, then we found a succesor that is better than any that have been examined so far. Record this by doing the following :

Page 9: Pertemuan 15 Game Playing

9

Algorithm contd’

• Set BEST-SCORE to NEW-VALUE.

• The best known path is now from CURRENT to SUCC and then on to the appropriate path down from SUCC as determined by the recursive call to MINIMAX. So set BEST-PATH to the result of attaching SUCC to the front of PATH(RESULT-SUCC).

5. Now that all the succesors have been examined, we know the value of Position as well as which path to take from it. So return the structure

VALUE = BEST-SCORE

PATH = BEST-PATH

Page 10: Pertemuan 15 Game Playing

10

Prosedur pencarian MINIMAX

B -6

A -2

C -2 D -4

E

9

F

-6

G

0

I

0

H

1

J

-2

K

-4

L

-3

MAX

MIN

Page 11: Pertemuan 15 Game Playing

11

Prosedur pencarian MINIMAX

• Pada MINIMAX terdapat 2 prosedur yang dijalankan yaitu : maximize dilakukan oleh “saya” dan minimize dilakukan oleh “lawan”.

• Diperlukan fungsi evaluasi statis yang menyatakan nilai yang mungkin didapat oelh pemain.

• Pada level pertama “saya” melakukan maximize dan pada level kedua “lawan” melakukan minimize.

• Kelemahan metoda MINIMAX adalah harus mengunjungi semua node yang ada sebelum memutuskan langkah yang diambil.

Page 12: Pertemuan 15 Game Playing

12

<< CLOSING >>

Untuk memperbaiki kelemahan metoda MINIMAX digunakan

-Cutoff atau -pruning

End of Pertemuan 15

Good Luck