CS 109_Fall2016-HW4

CS 109_Fall2016-HW4 - CS 109 Introduction to Computer...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 109: Introduction to Computer Science Sukhatme Fall 2016 Homework Assignment 4 Assigned: 11/14/16 via Blackboard Due: 2359 (i.e. 11:59:00 pm) on 12/1/16 via Blackboard Notes: a. This is the fourth (and final) homework assignment of CS 109. It is worth 8% of your overall grade for this class. You must solve all problems correctly to obtain full credit. b. You are free to discuss the problems on this assignment with your classmates. However, to receive credit, you must write up and submit solutions completely on your own. You are responsible for understanding your answers. The purpose of discussing the questions with your classmates is to deepen your understanding of the material – not simply to obtain answers from them. To get the most out of the class, you are strongly encouraged to make a serious effort to understand and solve the problems on your own before discussing them with others. c. On the work you turn in, you must list the names of everyone with whom you discussed the assignment. d. All answers must be typed, not handwritten (other than pictures of hand drawn figures that you may embed in your PDF). The homework must be turned in as a single PDF document on Blackboard. Other formats will not be graded.
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Question 1: Minimax and game trees [10 points] One way to program a computer to play a game against an opponent is to use the Minimax algorithm. In this question, we will first work through a helpful example using the algorithm, and then ask you to apply it to the game of Tic-Tac-Toe. Each state of the board in a game is given a score, with high score states assumed to be ‘good’ for the computer, and low score states ‘good’ for the opponent. When it is the computer’s turn to play, it picks the move that leads to a board state with the highest score. When it is the opponent’s turn to play, we assume that the opponent picks its best move (i.e. that leads to a board state with the lowest score). Assume the leaves of the following tree represent outcomes of the game. Assume it is the computer’s turn to make a move in board state a . Let’s use Minimax to determine the score of the current position and choose whether to make a move leading to state b or c. Working backwards, we first compute the scores for the game-ending board states d , e , f , and g . Since it is the computer’s turn in state a , states b and c are the opponent’s turn, and it will be the computer’s turn in d , e , f , and g . In each case, the computer has two choices. For example, in state d , the computer can choose a move that leads to a state with score 20 (good for the computer) or a move that leads to a state with score -10 (bad for the computer). According to the Minimax algorithm, the computer should choose the move that leads to a “max” score state, i.e. score 20. This is shown below.
Image of page 2
Similarly, the computer would choose the move that maximizes the score in states e, f, g. These three are shown filled in below.
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern