avoiding long code question
Posted: 18 Nov 2005, 18:55
In Movei every makemove ends with the function
generatepinarray()
generatepinarray() update information about pins that may be used for pruning or generating moves in the next ply.
Note that I thought to take generatepinarray() out of makemove.
The reason is that there are some cases when I prune after makemove
without using the information that generatepinarrays() have.
I have the following problem:
In most of the cases that I call makemove I need to call immediately after it generatepinarray() so the code is longer and uglier if I replace almost every makemove by
makemove(...)
generatepinarray();
My question is what is the best way to solve it.
I can change my makemove to get another boolean parameter that is going to tell it if to generate pin information and in this case the number of lines in the code is almost the same.
I am not sure if this is the best thing to do or there is a better idea.
What is your opinion about it?
Note that my undomove ends with
if (pinnumber[ply]>0) generatepinarray();
pinnumber[ply] is the number of pinned pieces of the side to move and again I can save time by doing it only when I need it when makemove did not update the pin array and again doing it in that way is going to do the code longer.
Uri
generatepinarray()
generatepinarray() update information about pins that may be used for pruning or generating moves in the next ply.
Note that I thought to take generatepinarray() out of makemove.
The reason is that there are some cases when I prune after makemove
without using the information that generatepinarrays() have.
I have the following problem:
In most of the cases that I call makemove I need to call immediately after it generatepinarray() so the code is longer and uglier if I replace almost every makemove by
makemove(...)
generatepinarray();
My question is what is the best way to solve it.
I can change my makemove to get another boolean parameter that is going to tell it if to generate pin information and in this case the number of lines in the code is almost the same.
I am not sure if this is the best thing to do or there is a better idea.
What is your opinion about it?
Note that my undomove ends with
if (pinnumber[ply]>0) generatepinarray();
pinnumber[ply] is the number of pinned pieces of the side to move and again I can save time by doing it only when I need it when makemove did not update the pin array and again doing it in that way is going to do the code longer.
Uri