Einzelnen Beitrag anzeigen

TribleXXX

Registriert seit: 7. Mai 2005
14 Beiträge
 
#2

Re: TICTACTOE KI mit BACKTRACKING (Recursion) need HELP

  Alt 12. Jun 2005, 10:56
NegaMax:
Input arguments "player" and "board".

1. If the "player" wins on "board" as it is now return 1.
2. If the other "player" wins on "board" as it is now return -1.
3. Set the temporary variable "best" to an arbitrary negative number.
4. For every possible move do 4.1 to 4.4.
4.1. Go recursively to 1. with the "player" set to the opponent player, and "board" changed according to the move to test.
4.2. Set the temporary variable "value" to the negative value of the returned value from the recursion in 4.1.
4.3. If "value" is higher than "best", set "best" to "value".
4.4. Reset "board" and "player" to how it looked before 4.
5. Reset "board" and "player" as in 4.4.
6. If "best" has the same arbitrary negative number as assigned in 3. then return 0.
7. Else return "best".

Look for the function NegaMax in "tgui.cxx" in my source for an C implementation.


habe jetzt hier so nen algorithmus gefunden? kann mir das mal einer erklären?
  Mit Zitat antworten Zitat