Connect Four - MIT - Massachusetts Institute of...

55
Introduction Solvability Rules Computer Solution Implementation Connect Four March 9, 2010 Connect Four

Transcript of Connect Four - MIT - Massachusetts Institute of...

Page 1: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Connect Four

March 9, 2010

Connect Four

Page 2: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Connect Four is a tic-tac-toe like game in which two players dropdiscs into a 7x6 board. The first player to get four in a row (eithervertically, horizontally, or diagonally) wins.

Connect Four

Page 3: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

The game was first known as “The Captain’s Mistress”, but wasreleased in its current form by Milton Bradley in 1974. In 1988Victor Allis solved the game, showing that with perfect play byboth players, the first player can always win if he plays the middlecolumn first, and if he chooses another column first the secondplayer can always force a draw.

Connect Four

Page 4: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Today we will explore the different strategies involved in playingconnect four, how a computer could emulate these strategies, andhow these techniques relate to other artificial intelligence topicsinvolved in solving games with large search spaces.

Connect Four

Page 5: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

For convenience, we will call the first player white (W) and thesecond player black (B).

Connect Four

Page 6: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I Recall: a strong solution to a game means knowing theoutcome of the game from any given board position.

I One strategy to try would be storing all possible gamepositions in a database, exploring the tree of game play fromeach position, and determining the winner in each case.

I We will see that this strategy, at least at this time, is notreally feasible for Connect Four (and even much less so formore complex games like GO and chess).

Connect Four

Page 7: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

First we look for an upper bound on the number of possibleConnect Four board positions.

I Each grid square can be in one of 3 states: black, white, orempty.

I Since there are 7x6 = 42 squares, this gives a very crudeupper bound of 342 ≥ 1020.

I A not so much closer look reveals that we can get a muchtighter upper bound by noticing that many positions wecounted before were illegal. For instance, if one square isempty in a column, then all the squares above it must also beempty. So we throw these possible positions out. Removingthese configurations gives a better upper bound of 7.1 ∗ 1013

possible positions.

Connect Four

Page 8: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

There are other types of illegal positions that are harder to detect.

I For instance, if we are assuming that white moves first, thensome game configurations, such as a stack in one columnfrom bottom up of BWBWBW is impossible, since blackwould have had to move first.

I It turns out that no one has been able to weed out all of thesepositions from databases

I The best lower bound on the number of possible positions hasbeen calculated by a computer program to be around1.6 ∗ 1013. So we would need at least that many positionsstored to do a brute force search of the game.

Connect Four

Page 9: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Instead of a brute force search, we can try a knowledge-basedapproach. Instead of searching the entire game space, we canformulate general rules that tell which player will win in whichsituations. We saw this approach fail last week for a computerplaying tic-tac-toe.

Connect Four

Page 10: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

1. If there is a winning move, take it.

2. If your opponent has a winning move, take the move so hecan’t take it.

3. Take the center square over edges and corners.

4. Take corner squares over edges.

5. Take edges if they are the only thing available.

Connect Four

Page 11: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Apparently this strategy won’t always work. In general, we mustclassify these sorts of rules into two classes:

I Rules that guarantee a certain results (and require proof thatthey do so)

I Heuristic rules that are generally advantageous but are notwithout downfall (like the strategy given above)

Connect Four

Page 12: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

We’ll explore possible strategies to follow for Connect Four below.First we’ll learn some terminology associated with describing thestrategy.

Connect Four

Page 13: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

We will number the 7 x 6 board with columns a to g left to rightand numbers 1 to 6 from bottom to top. So the coveted middlebottom square is d1.

Connect Four

Page 14: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I Threat: A threat is a square that if taken by opponent formsa game-winning group of four. For example, in the gamebelow White has threats at b1 and f1:

Connect Four

Page 15: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I Useless Threat: A useless threat is a threat that will never beable to be carried out by the opponent.

Connect Four

Page 16: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

The picture below illustrates the concept of a useless threat.

Connect Four

Page 17: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

It is clear that a threat can only be carried out if the opponent isforced to play the square below (or he allows you to play below thethreat). In analyzing threats, certain patterns show up in how thesquares are divided among players.

Connect Four

Page 18: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I Odd and Even ThreatsI The odd/evenness of a threat is determined by the row

number. So d1 is an odd threat, etc.I In normal game play, white is most likely to get odd squares,

while black is most likely to get even squares. Why?

Connect Four

Page 19: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

In general, we see the following patterns:

I White has an odd threat, Black even: White wins

I White and Black both have even threats: there is no columnwhere an odd number of squares can be played, so bothplayers will get their normal squares (as defined above), andBlack will be able to refute Whites threat and win.

I White has an even threat, Black an odd threat: draw.

I White and Black both have odd threats: usually neither ofthese threats end up working and depend on other threats.

In a careful analysis of threats it is important to make sure thattaking care of one threat does not allow another threat to becreated.

Connect Four

Page 20: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I Zugzwang:I The formal definition of this strange German word: a situation

where a player is forced to make a move when he would rathermake no move at all.

I In connect four, a player is able to “control the zugzwang” ifthe player is able to guide the way odd and even squares aredivided up among players.

I As an example, we look at the following game situation (Allis26), where White is about to move:

Connect Four

Page 21: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Connect Four

Page 22: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Note that all columns contain an even number of pieces, so Whitewill never fill up a column since it must take only odd squares. SoBlack can just play “follow-up” and mimic Whites every move.This will result in the following position:

Connect Four

Page 23: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Connect Four

Page 24: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Now White must play either b1 or f1, which Black will follow, andwin the game with a group of four on the second row.

Connect Four

Page 25: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

So in conclusion, Zugzwang involves being able to divide up howeven and odd squares are distributed to the two players. Blackwanted only even squares because eventually it would be able tofulfill its threat at either b2 or f2. But if it had wanted oddsquares, it could have just stopped playing follow up and played ina different column.

Connect Four

Page 26: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

As an example of using a knowledge based approach to teach acomputer to play a game, the following rules were used inprogramming VICTOR to win connect four.

I Each rule classifies threats and gives solutions to some ofthem.

I Each rule is valid for the player that controls the Zugzwang,which is assumed to be black in the following examples. Eachof these “rules” is a possible winning connection for the player.

Connect Four

Page 27: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I Claimeven:I Controller of zugzwang can get all empty even squares which

are not directly playable by letting the opponent play all emtpyodd squares.

I Required: Two squares, directly above each other. Bothsquares are empty, the upper square must be even.

I Solutions: All groups which contain the upper square.

Connect Four

Page 28: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Connect Four

Page 29: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I Baseinverse:I Based on the fact that a player cannot play two directly

playable squares in one turn.I Required: Two directly playable squaresI Solutions: All groups which contain both squares.

Connect Four

Page 30: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Connect Four

Page 31: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I Vertical:I Based on the face that a player cannot play two men in the

same column in one turn, while by playing one man in thecolumn, the square directly above becomes immediatelyplayable.

I Required: two squares directly above each other. Both squaresempty, upper square must be odd.

I Solutions: all groups which contain both squares

Connect Four

Page 32: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Connect Four

Page 33: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I Aftereven:I Side-effect of one or more claimevens. If a player in control of

zugzwang can complete a group using squares from claimeven,he will eventually be able to finish the group.

I Required: a group which can be completed by the controller ofthe zugzwang, using only squares of a set of claimevens.

I Solutions: all groups which have at least one square in allaftereven columns above the empty aftereven group in thatcolumn. Also, all groups which are solved by the claimevens.

Connect Four

Page 34: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Connect Four

Page 35: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I Lowinverse:I Based on the fact that the sum of two odd numbers is even.I Required: two different columns, each with 2 squares lying

directly above each other. All must be empty and the uppersquare must be odd.

I Solution: All groups which contain both upper squares, allgroups which are solved by verticals.

Connect Four

Page 36: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Connect Four

Page 37: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I Highinverse:I Based on the same principle as lowinverse:I Required: Two columns with 3 empty squares each, upper

square is even.

Connect Four

Page 38: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Solutions: all groups which contain the two upper squares, groupswhich contain the two middle squares, all vertical groups whichcontain the two highest squares of one of the highinverse columns

I If the lower square of the first columns i directly playable: allgroups which contain both the lower square of the firstcolumn and the upper square of the second.

I If the lower square of the second column is directly playable:all groups which contain both the lower square of the secondcolumn and the upper square of the first column.

Connect Four

Page 39: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I Baseclaim:I Combination of two baseinverses and a claimeven.I Required: Three directly playable squares and the square above

the second playable square.I The non-playable square must be even.I Solutions:

I All groups which contain the first playable square and thesquare above the second playable square.

I All groups which contain the second and third playable square.

Connect Four

Page 40: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Connect Four

Page 41: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I Before:I Based on a combination of claimevens and verticalsI Required: A group without men of the opponent, which is

called the Before group. All empty squares of the Before groupshould not lie in the upper row of the board.

I Solutions: All groups which contain all squares which aresuccessors of empty squares in the Before group.

I All groups which are solved by the Verticals which are part ofthe Before.

I All groups which are solved by the Claimevens which are partof the Before

Connect Four

Page 42: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Connect Four

Page 43: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I Specialbefore:I A version of the beforeI Required:

I A group without men of the opponent, which is called theSpecialbefore group.

I A directly playable square in another column.I All empty squares of the Specialbefore group should not lie in

the upper row of the board.I One empty square of the Before group must be playable.

I Solutions: All groups which contain all successors of emptysquares of the Specialbefore group and the extra playablesquare.

I All groups which contain the two playable squares.I All groups which are solved by one of the Claimevens.I All groups which are solved by one of the Verticals.

Connect Four

Page 44: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Connect Four

Page 45: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Victor Allis’s program VICTOR developed a method of finding anoptimal strategy based on the 9 rules given above. The positionevaluator (white or black) is given a description of the board andcomes up with an optimal next move.

Connect Four

Page 46: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

First all possible instances of the nine rules above are found andchecked against all 69 possibilities to connect winning groups. Therule applications that solve at least one problem are stored in a listof solutions with a list of the groups solved by the solution and alist of other solutions that can be used to solve the problem.

Connect Four

Page 47: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

The next step is finding which solutions can work together. Firstall solutions are assembled as nodes into an undirected graph,where two nodes are connected if and only if they can’t be usedsimultaneously. These connections are stored in an adjacencymatrix. Then, the problems (threats) are added as nodes, andsolutions are connected with problems if they solve the problem(no problems are connected).

Connect Four

Page 48: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Note that two rules might not necessarily be able to be used at thesame time. The following table describes the relationships betweenrules (taken from Allis, section 7.4):

Connect Four

Page 49: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Connect Four

Page 50: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Then we solve the following problem:Given: Two sets of nodes, S(olutions) and P(roblems). Try to findan independent subset C of S with the property that P iscontained in the set of all neighbors of C , B(C ). (Note this is apotentially NP-complete problem)

Connect Four

Page 51: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

The following recursive algorithm was used by Allis:FindChosenSet(P, S) {

if (P == EmptySet) {Eureka() /* We have found a subset C meets

all constraints. */} else {MostDifficultNode =

NodeWithLeastNumberOfNeighbours(P);for (all neighbours of MostDifficultNode) {FindChosenSet(P - { MostDifficultNode },S - AllNeighboursOf(ChosenNeighbour));

}}

}

Connect Four

Page 52: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

One method used to solve game trees is conspiracy-numbersearch.

I In the instance of connect four, consider three types of nodes:-1 black can at least draw the game, 1 the game is a win forwhite, or 0 the game is as yet undecided.

I Now any node that has as a child a node with a value of 1can be colored 1. Any node that has all nodes colored -1 canbe colored -1.

I Note it is much easier to change a node to a 1 than a -1.

Connect Four

Page 53: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

I The conspiracy number of a node is a tuple of counts for thenumber of children needed to “conspire” to change the valueof the node to each of the possible values.

I Let (x , y) be the conspiracy number of a node, with x thenumber of nodes that need to conspire to change the value to1, and y to -1.

I We know x will always be 1, since we only need one childe ofvalue 1 to change our value to 1.

I But y is the number of ons of the node yet to be evaluated ifall those evaluated so far have been -1.

I If sons have already been evaluated to 1, then y is ∞.

Connect Four

Page 54: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

The purpose of conpsiracy number search is to evaluated as fewnodes as possible to find the result of the game tree. Therefore, wetry to avoid evaluating nodes with large conspiracy numbers. If wewant to evaluate a node at the top of the tree, we choose theneighbors with the lowest conspiracy numbers to evaluate until weare sure of their value. We move up the tree in this way, wheneverpossible avoiding evalutating nodes with large conspiracy numbers.

Connect Four

Page 55: Connect Four - MIT - Massachusetts Institute of Technologyweb.mit.edu/sp.268/www/2010/connectFourSlides.pdf ·  · 2011-02-02really feasible for Connect Four (and even much less

IntroductionSolvability

RulesComputer Solution Implementation

Connect Four tournament!

Connect Four