Hi everyone, i am looking for a way to generate the moves for each depth without them interfering with eachother, More explicitly i'm looking for a way to do GenerateMoves() from this algorithm http://ai-depot.com/articles/minimax-explained/2/
My first ideea was to create a list with all the moves but then i'll have to have a seperate list for each node,
my code so far: (can't paste it all so i'll just put the relevant functions for my problem)
the board is a 12x12 matrix with the first 2 and last 2 rows and columns marked as "bounds" to generate moves faster.
would really appreciate a fast answer since i need to finish this till 25th :( any ideea is welcome ! thanks for taking the time to read this and maybe help me solve it :)
My first ideea was to create a list with all the moves but then i'll have to have a seperate list for each node,
I would have thought for a chess game that each node would be a list forming a kind of permutation tree. But I am not familiar with any chess-solving algorithms.
I would have thought for a chess game that each node would be a list forming a kind of permutation tree. But I am not familiar with any chess-solving algorithms.
thats how i thaught about it aswell but as you can see from the algorithm.. the search goes depth first , and if i make it a list and check each node it will go width first.
Making a list will not result in checking width before depth. The algorithm is recursive. So while checking the top level 'width wise' it must plunge one step deeper FIRST before moving on to the next in its list.
And then while checking that 'one step deeper' game it does the same thing. It creates a list but before it traverses the list width-wise it has to plunge one more step deeper FIRST before moving on to the next in its list.
And so on until the deepest level has been reached before returning up to the previous deepest level to check its next node in the list width wise.
What i need is for the algorithm to go depth first all the way to the end state(checkmate) or till it reaches the max depth .. but i am guessing this is also doable ... i have been looking into the depth first algorithm looks suitable to tweaking it and turning it into min_max :D cheers for the help .. i'll post back if i manage to finish the algorithm , thanks for the help Galik :)
if i understand the algorithm correctly no, it must go depth first to actually have an evaluated end node in order to compare alfa and beta for pruning :)
I thought a typical chess implementation would generate every possible move to a depth
of, say, 3, then prune, then continue on with just the remaining nodes.
in order to get a min evaluation or a max evaluation you need to go depth first to evaluate that particular branch and give it a value (else it will be + / - infinity till one of the nodes are evaluated)
i've implemented a depth-first like algorithm .. that takes into account if the depth number is odd or even, so that it can decide if its a min or a max node ...
once it reaches the max depth it evaluates the board and gives the node a value but i'm short on ideeas on how to send the value trough the tree ( it must take into account if the node is min or max too each time it goes a depth back because min will choose the lowest value possible out of his childs and max the highest out of them .. ).
My question is: can i make some kind of pointer that points to all the child nodes of a particular node (the branching factor is around 40 ) ? if so can someone give me an example please
any other idea on how to approach this is welcome! cheers all.
PS : this is my node structure
1 2 3 4 5 6 7 8 9
struct lista
{
int mat[12][12]; // game board
int pozitie; // the nodes number
int tata; // the father's number
int adancime; // the depth of the node
int evaluare; // the heuristic function
struct lista *next; // pointer to the next node
}
PSS: i got a 2nd ideea, this would make me start from scratch but with a way better strategy.
if i create a pointer inside a recursive function such as
1 2 3 4 5 6
int function() {
struct name *aux;
//make this point to a move list
and for each move in the list
return function()
}
will the pointer point to a different memory zone in all the recursions or to a different one each time ?