Implementing MiniMax Algorithm IN JAVA plus random heuristic -


i trying implement minimax algorithm scratch in java. general point known all, through tree try find best possible move. dont have crucial code show now, first give me general approach can start project , update post code.

in addition going implement random heuristic game, in random choose next move , pass game, added later on.

i adding bounty on question.

p.s.

this not duplicate, dont want copy else's code, have whole code on own.

so main thinking follow following: calculate best move given game field , rating mechanism field input field calculate ratingmechanisms mechanism rate move , return best move.

in more in depth analysis: key minimax algorithm , forth between 2 players, player "turn is" desires pick move maximum score. in turn, scores each of available moves determined opposing player deciding of available moves has minimum score. , scores opposing players moves again determined turn-taking player trying maximize score , on way down move tree end state.

a description algorithm, assuming x "turn taking player," like:

-if game over, return score x's perspective.

-otherwise list of new game states every possible move

-create scores list

-for each of these states add minimax result of state scores list

-if it's x's turn, return maximum score scores list

-if it's o's turn, return minimum score scores list

-you'll notice algorithm recursive, flips , forth between players until final score found.

in main part should use in order minimize or maximize each level (also can try adding debugging this: //system.out.println("max/min level " + i);), while getting current level of tree check if null no exceptions, , level add in max node, while parsing in min node.

in order use max , min nodes have create functions these.

the maximize part of algorithms: node biggest rating of children. warning: if no child exists, rating min.

for minimize part of algorithms. node lowest rating of children. warning: if no child exists, rating max.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -