Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualpatishi

Posted 18 July 2013 - 11:45 PM

This is for me to solve,so don't answer me right now.   but just to explain my "stupidity" by using the java array list:  
I know that the total number columns in the game is 7 right..?     but not all the time all of them is playable (e.g a column can be totally full).   
so what i did is:    ArrayList moves = new ArrayList();      and then pass through all the columns from 0 to 7 (actually i am doing it from the center and outside to improve the move ordering a little bit.   I have an array   columns =  {3,2,4,1,5,0,6} )     and doing      from(i to 7)  { if ! fullColumn, than -  moves.add(i) }      and that's how i get a list that holds all the PLAYABLE columns.   (which in the alpha beta i am just playing one after the other)     

So if i want to create a normal array inside the alpha beta,  and this array has to be declared on some initial size...   let's say for example -    array moves - new int[7];
and than i can do:   from (i to 7)  if !fullColumn,   moves[i] = i;    or something like this..    but than i have an array of size 7  but some indexes can be empty  (or equal to 0, this is the default of int in java).       now,  even in this way i can say that if a columns is full than i put a -1 in the array, that's how i know that i don't need to play this index,   but i can't sort the columns by the HH that way...that's my main problem!                                 so i need to figure out how to initialize this array and how to allocate it.   I read your comment above abouto holding an variable that tells me how many elements i can use, but i didn't understand it (yet).     

If i didn't need to sort this array by the HH, than i could just do  from (i to 7)  if( !fullColumn)  make move... etc'.    but i need to first create an array of all the playable columns and sort it before i can use it.    and i can't just do  moves.add(i)  with a normal array,  only with an arraylist.  
 

I hope i can figure this out on my own..  if not i will come back


#2patishi

Posted 18 July 2013 - 11:41 PM

This is for me to solve,so don't answer me right now.   but just to explain my "stupidity" by using the java array list:  
I know that the total number columns in the game is 7 right..?     but not all the time all of them is playable (e.g a column can be totally full).   
so what i did is:    ArrayList moves = new ArrayList();      and then pass through all the columns from 0 to 7 (actually i am doing it from the center and outside to improve the move ordering a little bit.   I have an array   columns =  {3,2,4,1,5,0,6} )     and doing      from(i to 7)  { if ! fullColumn, than -  moves.add(i) }      and that's how i get a list that holds all the PLAYABLE columns.   (which in the alpha beta i am just playing one after the other)     

So if i want to create a normal array inside the alpha beta,  and this array has to be declared on some initial size...   let's say for example -    array moves - new int[7];
and than i can do:   from (i to 7)  if !fullColumn,   moves[i] = i;    or something like this..    but than i have an array of size 7  but some indexes can be empty  (or equal to 0, this is the default of int in java).       now,  even in this way i can say that if a columns is full than i put a -1 in the array, that's how i know that i don't need to play this index,   but i can't sort the columns by the HH that way...that's my main problem!                                 so i need to figure out how to initialize this array and how to allocate it.   I read your comment above abouto holding an variable that tells me how many elements i can use, but i didn't understand it (yet).     
 

I hope i can figure this out on my own..  if not i will come back


#1patishi

Posted 18 July 2013 - 11:40 PM

This is for me to solve,so don't answer me right now.   but just to explain my "stupidity" by using the java array list:  
I know that the total number columns in the game is 7 right..?     but not all the time all of them is playable (e.g a column can be totally full).   
so what i did is:    ArrayList moves = new ArrayList();      and then pass through all the columns from 0 to 7 (actually i am doing it from the center and outside to improve the move ordering a little bit.   I have an array   columns =  {3,2,4,1,5,0,6} )     and doing      from(i to 7)  { if ! fullColumns, than -  moves.add(i) }      and that's how i get a list that holds all the PLAYABLE columns.   (which in the alpha beta i am just playing one after the other)     

So if i want to create a normal array inside the alpha beta,  and this array has to be declared on some initial size...   let's say for example -    array moves - new int[7];
and than i can do:   from (i to 7)  if !fullColumn,   moves[i] = i;    or something like this..    but than i have an array of size 7  but some indexes can be empty  (or equal to 0, this is the default of int in java).       now,  even in this way i can say that if a columns is full than i put a -1 in the array, that's how i know that i don't need to play this index,   but i can't sort the columns by the HH that way...that's my main problem!                                 so i need to figure out how to initialize this array and how to allocate it.   I read your comment above abouto holding an variable that tells me how many elements i can use, but i didn't understand it (yet).     
 

I hope i can figure this out on my own..  if not i will come back


PARTNERS