CS 540-1 Fall 2016 CS 540-1: Introduction to Artificial Intelligence Homework Assignment # 4 Sample Answers Problem 1. Probability [45] 1. [15] Roll 2 fair 6-sided dice. What is the probability that the sum of the two dice is 7? 2. [15] John and Robert play a game with a pile of 52 cards. The player who gets the Ace of Hearts wins. John and Robert pick up a card each. John shows his card to Robert first, but John’s card is not the Heart Ace. What is the probability of Robert winning? 3. [15] 1 out of 10000 clover leaves has four leaflets. Assuming clover leaves are independent. How many clover leaves does one need to inspect in order to find a four-leaf clover with probability at least 0.5? SOLUTION: 1. 1 6 There are 6 pairs whose sum is 7: (1, 6), (2, 5), (3, 4), (4, 3), (5, 2), (6, 1) where (x, y) represents x points on the first dice and y points on the second points. The probability of having x (1 ≤ x 1 ≤6) points on a dice is 61 , hence, the probability of having a particular pair (x, y) is 16 * 16 = 36 . 1 1 Therefore, the probability of having one of 6 pairs is 6 * 36 = 6 . 2. 1 51 Since John have showed his card, there are only 51 cards left. Therefore, the probability of Robert 1 having the Ace of Hearts is 51 . 3. 6932 1 The probability for a leaf clover not being 4-leaf: x = 1 - 10000 = 0.9999. Suppose we have n leaves, so the probability for both n leaves not being 4-leaf is 0.9999n . Hence, the probability to have at least one 4-leaf clover is 1 - 0.9999n . So, we have 1 - 0.9999n ≥ 0.5, equivalent to n > 6931.1. Because n is a positive integer, so n = 6932. Problem 2. Minimax Procedure [15] Use the minimax algorithm to compute the game theoretical value at each node of the game tree below. Problem 3. Alpha-Beta Pruning [30] Use the tree in problem 2 to complete the questions below. 1. 2. [15] Perform a left-to-right alpha-beta pruning on the tree. Show the alpha and beta values at each node. Show which branches are pruned. Clearly mark the subtrees that are pruned. [15] Do the same but from right-to-left. CS 540-1 Fall 2016 Figure 1: The Minimax Tree Figure 2: The left-to-right alphabeta pruning tree CS 540-1 Fall 2016 Figure 3: The right-to-left alphabeta pruning tree
© Copyright 2024 Paperzz