I think I understand the tree part now. The expanding part is not directly dependent on the number of simulations, for example, I can do 1000 simulations, then generate a branch. I can generate another 1000 simulations, then generate another branch. I think I can't apply this to my game since the game has a max 13 moves at the start and this drops quickly. I'd run out of moves for the tree. Your pseudocode is what I had in mind.

I'm not familiar with tichu.

here's my UCB1 code, it's a bit rough, I apologize.

http://pastebin.com/rddWUSzF

### Show differencesHistory of post edits

### #5mudslinger

Posted 11 October 2012 - 06:36 PM

I think I understand the tree part now. The expanding part is not directly dependent on the number of simulations, for example, I can do 1000 simulations, then generate a branch. I can generate another 1000 simulations, then generate another branch. I think I can't apply this to my game since the game has a max 13 moves at the start and this drops quickly. I'd run out of moves for the tree. Your pseudocode is what I had in mind.

I'm not familiar with tichu.

here's my code, it's a bit rough, I apologize.

http://pastebin.com/rddWUSzF

I'm not familiar with tichu.

here's my code, it's a bit rough, I apologize.

http://pastebin.com/rddWUSzF

### #4mudslinger

Posted 11 October 2012 - 06:36 PM

I think I understand the tree part now. The expanding part is not directly dependent on the number of simulations, for example, I can do 1000 simulations, then generate a branch. I can generate another 1000 simulations, then generate another branch. I think I can't apply this to my game since the game has a max 13 moves at the start and this drops quickly. I'd run out of moves for the tree. Your pseudocode is what I had in mind.

I'm not familiar with tichu.

here's my code, it's a bit rough, I apologize.

http://pastebin.com/rddWUSzF

I'm not familiar with tichu.

here's my code, it's a bit rough, I apologize.

http://pastebin.com/rddWUSzF

### #3mudslinger

Posted 11 October 2012 - 06:35 PM

I think I understand the tree part now. The expanding part is not directly dependent on the number of simulations, for example, I can do 1000 simulations, then generate a branch. I can generate another 1000 simulations, then generate another branch. I think I can't apply this to my game since the game has a max 13 moves at the start and this drops quickly. I'd run out of moves for the tree. Your pseudocode is what I had in mind.

I'm not familiar with tichu.

here's my code, it's a bit rough, I apologize.

[source lang="cpp"]#include <stdlib.h>#include <time.h>#include <stdio.h>#include <math.h>int f1(){ return rand()%4; // 1/4 chance}int f2(){ return rand()%50; // 1/50 chance}int f3(){ return rand()%100; // 1/100 chance}int main(){ double total[3] = {0.0},maxucb,newucb; int tried[3] = {0}; int triedf = 0; int i,j,n,maxind; srand(time(NULL)); int (*f[3])() = {f1,f2,f3}; for(j=0;j<3;j++){ if(f[j]() == 0) total[j]+=1; tried[j]++; triedf++; } for(i=0;i<10000;i++){ maxucb = total[0]/triedf + sqrt((2*(log(triedf)))/tried[0]); maxind = 0; for(n=1;n<3;n++){ newucb = total[n]/tried[n] + sqrt((2*(log(triedf)))/tried[n]); if(newucb > maxucb){ maxucb = newucb; maxind = n; } } if(f[maxind]() == 0) total[maxind]+=1;; triedf++; tried[maxind]++; } for(n=0;n<3;n++){ printf("win percentage: %f tries: %d\n",total[n]/tried[n],tried[n]); } return 0;}[/source]

I'm not familiar with tichu.

here's my code, it's a bit rough, I apologize.

[source lang="cpp"]#include <stdlib.h>#include <time.h>#include <stdio.h>#include <math.h>int f1(){ return rand()%4; // 1/4 chance}int f2(){ return rand()%50; // 1/50 chance}int f3(){ return rand()%100; // 1/100 chance}int main(){ double total[3] = {0.0},maxucb,newucb; int tried[3] = {0}; int triedf = 0; int i,j,n,maxind; srand(time(NULL)); int (*f[3])() = {f1,f2,f3}; for(j=0;j<3;j++){ if(f[j]() == 0) total[j]+=1; tried[j]++; triedf++; } for(i=0;i<10000;i++){ maxucb = total[0]/triedf + sqrt((2*(log(triedf)))/tried[0]); maxind = 0; for(n=1;n<3;n++){ newucb = total[n]/tried[n] + sqrt((2*(log(triedf)))/tried[n]); if(newucb > maxucb){ maxucb = newucb; maxind = n; } } if(f[maxind]() == 0) total[maxind]+=1;; triedf++; tried[maxind]++; } for(n=0;n<3;n++){ printf("win percentage: %f tries: %d\n",total[n]/tried[n],tried[n]); } return 0;}[/source]

### #2mudslinger

Posted 11 October 2012 - 06:35 PM

I think I understand the tree part now. The expanding part is not directly dependent on the number of simulations, for example, I can do 1000 simulations, then generate a branch. I can generate another 1000 simulations, then generate another branch. I think I can't apply this to my game since the game has a max 13 moves at the start and this drops quickly. I'd run out of moves for the tree. Your pseudocode is what I had in mind.

I'm not familiar with tichu.

here's my code, it's a bit rough, I apologize.

[source lang="cpp"]#include <stdlib.h>#include <time.h>#include <stdio.h>#include <math.h>int f1(){ return rand()%4; // 1/4 chance}int f2(){ return rand()%50; // 1/50 chance}int f3(){ return rand()%100; // 1/100 chance}int main(){ double total[3] = {0.0},maxucb,newucb; int tried[3] = {0}; int triedf = 0; int i,j,n,maxind; srand(time(NULL)); int (*f[3])() = {f1,f2,f3}; for(j=0;j<3;j++){ if(f[j]() == 0) total[j]+=1; tried[j]++; triedf++; } for(i=0;i<10000;i++){ maxucb = total[0]/triedf + sqrt((2*(log(triedf)))/tried[0]); maxind = 0; for(n=1;n<3;n++){ newucb = total[n]/tried[n] + sqrt((2*(log(triedf)))/tried[n]); if(newucb > maxucb){ maxucb = newucb; maxind = n; } } if(f[maxind]() == 0) total[maxind]+=1;; triedf++; tried[maxind]++; } for(n=0;n<3;n++){ printf("win percentage: %f tries: %d\n",total[n]/tried[n],tried[n]); } return 0;}[/source]

I'm not familiar with tichu.

here's my code, it's a bit rough, I apologize.

[source lang="cpp"]#include <stdlib.h>#include <time.h>#include <stdio.h>#include <math.h>int f1(){ return rand()%4; // 1/4 chance}int f2(){ return rand()%50; // 1/50 chance}int f3(){ return rand()%100; // 1/100 chance}int main(){ double total[3] = {0.0},maxucb,newucb; int tried[3] = {0}; int triedf = 0; int i,j,n,maxind; srand(time(NULL)); int (*f[3])() = {f1,f2,f3}; for(j=0;j<3;j++){ if(f[j]() == 0) total[j]+=1; tried[j]++; triedf++; } for(i=0;i<10000;i++){ maxucb = total[0]/triedf + sqrt((2*(log(triedf)))/tried[0]); maxind = 0; for(n=1;n<3;n++){ newucb = total[n]/tried[n] + sqrt((2*(log(triedf)))/tried[n]); if(newucb > maxucb){ maxucb = newucb; maxind = n; } } if(f[maxind]() == 0) total[maxind]+=1;; triedf++; tried[maxind]++; } for(n=0;n<3;n++){ printf("win percentage: %f tries: %d\n",total[n]/tried[n],tried[n]); } return 0;}[/source]

### #1mudslinger

Posted 11 October 2012 - 06:31 PM

I think I understand the tree part now. The expanding part is not directly dependent on the number of simulations, for example, I can do 1000 simulations, then generate a branch. I can generate another 1000 simulations, then generate another branch. I think I can't apply this to my game since the game has a max 13 moves at the start and this drops quickly. I'd run out of moves for the tree. Your pseudocode is what I had in mind.

I'm not familiar with tichu.

here's my code, it's a bit rough, I apologize.

[source lang="cpp"]#include <stdlib.h>#include <time.h>#include <stdio.h>#include <math.h>int f1(){ return rand()%4; // 1/4 chance}int f2(){ return rand()%50; // 1/50 chance}int f3(){ return rand()%100; // 1/100 chance}int main(){ double total[3] = {0.0},maxucb,newucb; int tried[3] = {0}; int triedf = 0; int i,j,n,maxind; srand(time(NULL)); int (*f[3])() = {f1,f2,f3}; for(j=0;j<3;j++){ if(f[j]() == 0) total[j]+=1; tried[j]++; triedf++; } for(i=0;i<10000;i++){ maxucb = total[0]/triedf + sqrt((2*(log(triedf)))/tried[0]); maxind = 0; for(n=1;n<3;n++){ newucb = total[n]/tried[n] + sqrt((2*(log(triedf)))/tried[n]); if(newucb > maxucb){ maxucb = newucb; maxind = n; } } if(f[maxind]() == 0) total[maxind]+=1;; triedf++; tried[maxind]++; } for(n=0;n<3;n++){ printf("win percentage: %f tries: %d\n",total[n]/tried[n],tried[n]); } return 0; }[/source]

I'm not familiar with tichu.

here's my code, it's a bit rough, I apologize.

[source lang="cpp"]#include <stdlib.h>#include <time.h>#include <stdio.h>#include <math.h>int f1(){ return rand()%4; // 1/4 chance}int f2(){ return rand()%50; // 1/50 chance}int f3(){ return rand()%100; // 1/100 chance}int main(){ double total[3] = {0.0},maxucb,newucb; int tried[3] = {0}; int triedf = 0; int i,j,n,maxind; srand(time(NULL)); int (*f[3])() = {f1,f2,f3}; for(j=0;j<3;j++){ if(f[j]() == 0) total[j]+=1; tried[j]++; triedf++; } for(i=0;i<10000;i++){ maxucb = total[0]/triedf + sqrt((2*(log(triedf)))/tried[0]); maxind = 0; for(n=1;n<3;n++){ newucb = total[n]/tried[n] + sqrt((2*(log(triedf)))/tried[n]); if(newucb > maxucb){ maxucb = newucb; maxind = n; } } if(f[maxind]() == 0) total[maxind]+=1;; triedf++; tried[maxind]++; } for(n=0;n<3;n++){ printf("win percentage: %f tries: %d\n",total[n]/tried[n],tried[n]); } return 0; }[/source]