mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
Play along w/ alphago
This commit is contained in:
parent
e3ee7b7cd6
commit
a392bbd0c9
12
src/go.c
12
src/go.c
@ -8,6 +8,8 @@
|
|||||||
#include "opencv2/highgui/highgui_c.h"
|
#include "opencv2/highgui/highgui_c.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int inverted = 0;
|
||||||
|
|
||||||
void train_go(char *cfgfile, char *weightfile)
|
void train_go(char *cfgfile, char *weightfile)
|
||||||
{
|
{
|
||||||
data_seed = time(0);
|
data_seed = time(0);
|
||||||
@ -139,7 +141,7 @@ void print_board(float *board, int swap, int *indexes)
|
|||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
for(j = 0; j < 19; ++j){
|
for(j = 0; j < 19; ++j){
|
||||||
printf("%2d ", 19-j);
|
printf("%2d ", (inverted) ? 19-j : j+1);
|
||||||
for(i = 0; i < 19; ++i){
|
for(i = 0; i < 19; ++i){
|
||||||
int index = j*19 + i;
|
int index = j*19 + i;
|
||||||
if(indexes){
|
if(indexes){
|
||||||
@ -156,7 +158,7 @@ void print_board(float *board, int swap, int *indexes)
|
|||||||
}
|
}
|
||||||
if(board[index]*-swap > 0) printf("\u25C9 ");
|
if(board[index]*-swap > 0) printf("\u25C9 ");
|
||||||
else if(board[index]*-swap < 0) printf("\u25EF ");
|
else if(board[index]*-swap < 0) printf("\u25EF ");
|
||||||
else printf("\uFF0b");
|
else printf(" ");
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
@ -216,7 +218,7 @@ void test_go(char *filename, char *weightfile)
|
|||||||
int index = indexes[i];
|
int index = indexes[i];
|
||||||
row = index / 19;
|
row = index / 19;
|
||||||
col = index % 19;
|
col = index % 19;
|
||||||
printf("Suggested: %c %d, %.2f%%\n", col + 'A' + 1*(col > 7), 19 - row, move[index]*100);
|
printf("Suggested: %c %d, %.2f%%\n", col + 'A' + 1*(col > 7), (inverted)?19 - row : row+1, move[index]*100);
|
||||||
}
|
}
|
||||||
int index = indexes[0];
|
int index = indexes[0];
|
||||||
int rec_row = index / 19;
|
int rec_row = index / 19;
|
||||||
@ -241,13 +243,13 @@ void test_go(char *filename, char *weightfile)
|
|||||||
}else{
|
}else{
|
||||||
char g;
|
char g;
|
||||||
num = sscanf(line, "%c %c %d", &g, &c, &row);
|
num = sscanf(line, "%c %c %d", &g, &c, &row);
|
||||||
row = 19 - row;
|
row = (inverted)?19 - row : row+1;
|
||||||
col = c - 'A';
|
col = c - 'A';
|
||||||
if (col > 7) col -= 1;
|
if (col > 7) col -= 1;
|
||||||
if (num == 3) board[row*19 + col] = 0;
|
if (num == 3) board[row*19 + col] = 0;
|
||||||
}
|
}
|
||||||
} else if(num == 2){
|
} else if(num == 2){
|
||||||
row = 19 - row;
|
row = (inverted)?19 - row : row+1;
|
||||||
col = c - 'A';
|
col = c - 'A';
|
||||||
if (col > 7) col -= 1;
|
if (col > 7) col -= 1;
|
||||||
board[row*19 + col] = 1;
|
board[row*19 + col] = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user