Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualpatishi

Posted 27 June 2013 - 08:47 PM

Meanwhile... i have written some code for my bitboard logic.   and although i found a rather ineffiecient way of checking for four in a row combinations (i was getting a hard time understand john tromp's own code for that)  , I am satisfied with my solution so far.       
but now i am facing the problem of checking for 1,2 and 3 in a row combinations (for the eval' function).   this was so easy working with arrays, cause i had all the possible winningLines saved in arrays of size 4 (all 69 of them)  and than all i had to do is passing through each one of them and count the number of pieces i have for each player on that same line.   

But how should i do it when working with a pattern of bits?  i can't just "walk"  through it and count the bits one by one.  ofcourse i need this to be as fast and effiecient as possible so i will enjoy the benefit of working with bitboards.      any suggestions?

 

 

 

EDIT:  the only way i can think of is to save (again)  all the winning lines in arrays like before, but this time just check each bit in a certain index to see if it is 1 or 0 by using the AND (&) operation on that bitboard with another bitboard with 1L<< - the certain index i want to check..   and than count them up.           


#2patishi

Posted 27 June 2013 - 08:28 PM

Meanwhile... i have written some code for my bitboard logic.   and although i found a rather ineffiecient way of checking for four in a row combinations (i was getting a hard time understand john tromp's own code for that)  , I am satisfied with my solution so far.       
but now i am facing the problem of checking for 1,2 and 3 in a row combinations (for the eval' function).   this was so easy working with arrays, cause i had all the possible winningLines saved in arrays of size 4 (all 69 of them)  and than all i had to do is passing through each one of them and count the number of pieces i have for each player on that same line.   

But how should i do it when working with a pattern of bits?  i can't just "walk"  through it and count the bits one by one.  ofcourse i need this to be as fast and effiecient as possible so i will enjoy the benefit of working with bitboards.      any suggestions?


#1patishi

Posted 27 June 2013 - 08:23 PM

Meanwhile... i have written some code for my bitboard logic.   and although i found a rather ineffiecient way of checking for four in a row combinations (i was getting a hard time understand john tromp's own code for that)  , I am satisfied with my solution so far.       
but now i am facing the problem of checking for 1,2 and 3 in a row combinations.     this was so easy working with arrays, cause i had all the possible winningLines saved in arrays of size 4 (all 69 of them)  and than all i had to do is passing through each one of them and count the number of pieces i have for each player on that same line.   

But how should i do it when working with a pattern of bits?  i can't just "walk"  through it and count the bits one by one.     any suggestions?


PARTNERS