last day (19 days later) » 

7:12 PM
0
A: Finding the best move using MinMax with Alpha-Beta pruning

CodorThis is a bit diffuclt as the given code is not an actual Java implementation; in order to achieve what you want, there must be concrete types to represent a move and position in the game tree. Usually the the game tree is not explicitly encoded but navigated in a sparse representation where the ...

 
How would you change wikipedia's pseudocodes to store the best move and not only the best value? By the way, in the source link in the question there's a java implementation which is what I'm using (I've just changed the type of the best move), you can use that one as reference
 
The implementation you refer to (Section 1.5) actually returns the best move; see the updated answer.
 
Ok. Now, given that this implementation returns the best move despite the current player (and that's why ir updates the best move in both score > alpha and score < beta cases), to get the best move for the maximizer in which of the 2 cases do I have to update the best move?
 
In both cases, as these cases correspond to the two different players evaluating alternatively. To put it more colloquially, the algorithm gets called to evaluate for player A; then it asks "what moves can I do?" - for each of these moves, hypothetically perform it, call yourself but "be player B to see what he or she would do" (which results in a board with less free positions), store the value of the move to examine it and undo to evaluate the next move. The alpha and beta values basically just eliminate checking of all possible moves as soon as a "good enough" move is found.
 
I'm sorry but I still don't get it, I updated the question, hopefully now it's clearer what I need to know
 
7:12 PM
Although this is not actually rocket science, it is not trivial as it involves optimization, recursion and tre search. The presentation from the link also uses a "non-standard" scoring for evaluation; the values 1 (player 1 wins), -1 (player 2 wins) and 0 (game not in terminal state) might be easier. Is the basic minimax algorithm clear to you? On second inspection, the code from the link seems broken. Note that the return type of minimax is int[], but gets assigned to score, which is an int.
 
Basic minmax should be clear, but I'd have the same problem that I have with alpha-beta: minmax's goal is to assign the best value to the root node, which is a maximizer, starting from the leaves. What I need is the best move though, not the best utility value that I can achieve by applying that move. So, to summarize, even if I was using plain minmax, how would I make it store the best move somewhere? (Please forgive me but I'm quite new to this stuff) EDIT: I've added my implementation to the question
 
You're almost there. Change the return type to Move, store 'currentMove' in either case and return selectedMove in the end. However this is impossible with the current types; create a type which included both the move and its value and use this type instead of Move.
 
Added the edited implementation, hoping that I wrote it correctly. I have the same problem as before though, I've wrote it in the question
 
are you there?
apparently not. try to catch me when you are there.
 
7:28 PM
I'll try to be online as much as possible, thanks for your time mate!
Btw I think it's easier if you just edit my code to make it store the best move when needed, so that I can read it and understand where I am wrong
 

  last day (19 days later) »