문제

I read this answer, and it just confused me: TicTacToe AI Making Incorrect Decisions

Could somebody help me understand how I could apply this to Tictactoe?

  1. How would I "work my way up through the tree?
  2. How do I even create a tree of moves?

Note: I currently have a Board class which stores state about the game (e.g. Is the game complete with the current moves?, Is there a winner?, etc.) Each move on the current board is stored as 1 - 9 (top left to bottom right in rows). I can make copies of the current board state with ease. I can return a list of current moves for "X" and "O", as well as available moves from a Board.

도움이 되었습니까?

해결책

Solving Tic-Tac-Toe: Game Tree Basics
Category: Game Theory
Posted on: July 30, 2008 11:38 AM, by Mark C. Chu-Carroll

alt text

The picture pretty much says it all, but here is a link to the blog post: http://scienceblogs.com/goodmath/2008/07/30/solving-tictactoe-game-tree-ba/

다른 팁

I can answer your question "2", and hopefully this should help you figure out question "1":

Every node in the tree represents the current state of the game after some number of moves. So the root of the tree represents the game at the start (i.e. no pieces played so far). It has nine children (one for each possible first move). Each child in turn has 8 children (one for each possible second move). And so on, until you reach points where the game has been won or drawn. These are the leaf nodes.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top