Gaming TreeAI Author 9717133 Huan Po Lin Computer

  • Slides: 12
Download presentation
Gaming Tree(AI對弈樹) Author : 9717133 Huan Po Lin Computer Science Department December 25 th

Gaming Tree(AI對弈樹) Author : 9717133 Huan Po Lin Computer Science Department December 25 th 2009

搜尋範例 • 紅色點(勝) • 藍色點(輸) Node 11 Node 12 Player 1 Node 21 Player

搜尋範例 • 紅色點(勝) • 藍色點(輸) Node 11 Node 12 Player 1 Node 21 Player 1 Root Node 22 Node 3 Node 23 Player 2 Node 31 Node 32

實作解題 • Problem 6: Yakumo is not AO CHIAO http: //ttcpc. nctucs. tw/files/ttcpc 09.

實作解題 • Problem 6: Yakumo is not AO CHIAO http: //ttcpc. nctucs. tw/files/ttcpc 09. pdf • 在實作上面需要做到窮舉所有情況,因此 可以採用任何一種窮舉搜尋(Exhaustive search),可以利用DFS或者是BFS來實作

程式解析 • • • • • bool cal() { if(heap[0] == 0 && heap[1]

程式解析 • • • • • bool cal() { if(heap[0] == 0 && heap[1] == 0 && heap[2] == 0) return true; //已經結束啦 for(int i = 0; i < max. N; i++) { for(int j = 1; j <= heap[i]; j++) //枚舉拿珍珠的情況 { heap[i] -= j; if( cal() == 0 ) //別人的失敗就是我的快樂 { heap[i] += j; return true; } heap[i] += j; } } } return false;