FJK Home | CPE/CSC 480 | Syllabus | Schedule | Lecture Notes | Assignments | Labs | Project | Other Links |
Name: | |
Status | Final |
Points: | 10 |
Deadline: | Tuesday, Nov. 7, end of lab |
This lab exercise is about games. We will use a variation of the n-in-a-row game, where you need to align pieces in horizontal or vertical connected areas. Two players take turns placing their pieces on a grid, and the first one to have n in a row wins. This is similar to the Connect Four game, but with a few differences: Pieces aligned diagonally do not count, the playing field is infinite (no boundaries), and gravity does not play a role here (the pieces don't fall down). It is derived from a game called "Simple" described by Dennis Shasha, a computer science professor at New York University, and the author of the "Puzzling Adventures" column in Scientific American.
Your task is to play the game, and discuss various aspects of it. You do not need to program anything for this lab. If somebody knows of an implementation, or a framework that could be used, let me know.
Examine possible evaluation functions for the board positions in this game. Discuss which aspects of the game are considered in the evaluation function, and how well they reflect the current status (i.e., who is at an advantage, and how significant is the advantage). Identify advantages and drawbacks, and suggest improvements. The following list gives you some ideas for factors that can influence the function:
partial solutions: number of pieces in a row/column; the closer this is to a winning position, the better
multiple partial solutions: player A may have 3 pieces in a row, and B two times two; in the short run, A has an advantage, but in the long run, B's position may be better
blocked partial solution: If A has three pieces lined up, but both ends are blocked, then they are worthless. In general, there must be enough open spaces to complete the solution.
open partial solutions: For n=4, if the player whose turn it is has a strand of two where both ends are unblocked, and at least one end has two or more free spaces to continue, the player can force a win. By expanding the two-strand to three, the other player can only block one end, and the first player can complete the strand at the other end.
dilemma situations: if player A has multiple options to complete a partial solution, it is at a significant advantage, and might even be guaranteed a win.
Finding a good evaluation function is not necessarily straightforward. Here are some rough outlines for such an evaluation function:
/* longest strands */ Eval1 = longest-strand(MAX) - longest-strand(MIN); /* add up the square of the strands (higher importance to longer strands) */ Eval2 = Eval2(MAX) - Eval2(MIN) Eval2(MAX) = sum (MAX_strand(i)*MAX_strand(i)) /* add up the square of the unblocked strands (enough space at both ends combined) */ Eval3 = Eval3(MAX) - Eval3(MIN) Eval3(MAX) = sum (MAX_unblocked-strand(i)*MAX_unblocked-strand(i)) /* add up relevant aspects with different weights */ Eval4 = Eval4(MAX) - Eval4(MIN) Eval4(MAX) = A + 2*B + 4*C + 6* D where A = number of pieces by the player B = strands length 2 C = strands length 3 D = strands lenght 2 or more with both ends open
For this game, is it possible to reduce the branching factor of the search tree by eliminating board positions that are permutations?
The objective in this version is to place three pieces in a row vertically or horizontally.
Is it possible for the first player to force a win? Explain your answer!
Construct the tree for this game based on the mini-max method. Indicate places where alpha-beta pruning can be used to eliminate branches that will not be taken by a rational player.
The objective in this version is to place four pieces in a row vertically or horizontally.
Is it possible for the first player to force a win? Explain your answer!
Construct a partial tree for this game based on the mini-max method. Indicate places where alpha-beta pruning can be used to eliminate branches that will not be taken by a rational player. Your tree should explore eight plies (levels) with the most significant moves by each player.
Please submit the answers to the questions above via handin under the L6 folder at the end of the lab on the deadline given above:
handin grade480 L6 [filename]
Plain text files are somewhat easier to grade for me, and you can use ASCII art to draw your tree. If you prefer to do it in a more sophisticated manner, feel free to do so. In the past, I've had some difficulties opening some MS Visio files. If you use that program, please try to save it in some non-proprietary format as well (e.g. HTML, PDF, jpg).
This assignment can be done as an individual, or as a team consisting of two students. If you do it as a team, make sure to put both names on the sheet.
If you have questions or comments post them on the respective Blackboard Discussion Forum. The grader and I will check that forum on a regular basis, and try to answer your questions. If you answer somebody else's question, you can earn (informal) extra credit that I will consider in situations where somebody's score is close to the next higher grade.
FJK Home | CPE/CSC 480 | Syllabus | Schedule | Lecture Notes | Assignments | Labs | Project | Other Links |
Franz Kurfess |