mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
include some requested modifications
This commit is contained in:
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include <Winsock2.h>
|
#include <Winsock2.h>
|
||||||
#include <direct.h> /* for _getcwd() and _chdir() */
|
#include <direct.h> /* for _getcwd() and _chdir() */
|
||||||
#include <getopt.h>
|
#include "getopt.h"
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <process.h> /* for getpid() and the exec..() family */
|
#include <process.h> /* for getpid() and the exec..() family */
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <getopt.h>
|
#include "getopt.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
35
src/go.c
35
src/go.c
@ -10,7 +10,8 @@
|
|||||||
|
|
||||||
int inverted = 1;
|
int inverted = 1;
|
||||||
int noi = 1;
|
int noi = 1;
|
||||||
static const unsigned int n_ind = 5;
|
//static const unsigned int n_ind = 5;
|
||||||
|
#define n_ind 5
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char **data;
|
char **data;
|
||||||
@ -357,7 +358,7 @@ int generate_move(network net, int player, float *board, int multi, float thresh
|
|||||||
predict_move(net, board, move, multi);
|
predict_move(net, board, move, multi);
|
||||||
if (player < 0) flip_board(board);
|
if (player < 0) flip_board(board);
|
||||||
|
|
||||||
|
|
||||||
for(i = 0; i < 19; ++i){
|
for(i = 0; i < 19; ++i){
|
||||||
for(j = 0; j < 19; ++j){
|
for(j = 0; j < 19; ++j){
|
||||||
if (!legal_go(board, ko, player, i, j)) move[i*19 + j] = 0;
|
if (!legal_go(board, ko, player, i, j)) move[i*19 + j] = 0;
|
||||||
@ -392,7 +393,7 @@ int generate_move(network net, int player, float *board, int multi, float thresh
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(suicide_go(board, player, row, col)){
|
if(suicide_go(board, player, row, col)){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(suicide_go(board, player, index/19, index%19)) index = max;
|
if(suicide_go(board, player, index/19, index%19)) index = max;
|
||||||
return index;
|
return index;
|
||||||
@ -461,17 +462,17 @@ void engine_go(char *filename, char *weightfile, int multi)
|
|||||||
} else if (!strcmp(buff, "known_command")){
|
} else if (!strcmp(buff, "known_command")){
|
||||||
char comm[256];
|
char comm[256];
|
||||||
scanf("%s", comm);
|
scanf("%s", comm);
|
||||||
int known = (!strcmp(comm, "protocol_version") ||
|
int known = (!strcmp(comm, "protocol_version") ||
|
||||||
!strcmp(comm, "name") ||
|
!strcmp(comm, "name") ||
|
||||||
!strcmp(comm, "version") ||
|
!strcmp(comm, "version") ||
|
||||||
!strcmp(comm, "known_command") ||
|
!strcmp(comm, "known_command") ||
|
||||||
!strcmp(comm, "list_commands") ||
|
!strcmp(comm, "list_commands") ||
|
||||||
!strcmp(comm, "quit") ||
|
!strcmp(comm, "quit") ||
|
||||||
!strcmp(comm, "boardsize") ||
|
!strcmp(comm, "boardsize") ||
|
||||||
!strcmp(comm, "clear_board") ||
|
!strcmp(comm, "clear_board") ||
|
||||||
!strcmp(comm, "komi") ||
|
!strcmp(comm, "komi") ||
|
||||||
!strcmp(comm, "final_status_list") ||
|
!strcmp(comm, "final_status_list") ||
|
||||||
!strcmp(comm, "play") ||
|
!strcmp(comm, "play") ||
|
||||||
!strcmp(comm, "genmove"));
|
!strcmp(comm, "genmove"));
|
||||||
if(known) printf("=%s true\n\n", ids);
|
if(known) printf("=%s true\n\n", ids);
|
||||||
else printf("=%s false\n\n", ids);
|
else printf("=%s false\n\n", ids);
|
||||||
@ -575,7 +576,7 @@ void engine_go(char *filename, char *weightfile, int multi)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(f, "final_status_list dead\n");
|
fprintf(f, "final_status_list dead\n");
|
||||||
fclose(f);
|
fclose(f);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
FILE *p = _popen("./gnugo --mode gtp < game.txt", "r");
|
FILE *p = _popen("./gnugo --mode gtp < game.txt", "r");
|
||||||
#else
|
#else
|
||||||
@ -716,7 +717,7 @@ float score_game(float *board)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(f, "final_score\n");
|
fprintf(f, "final_score\n");
|
||||||
fclose(f);
|
fclose(f);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
FILE *p = _popen("./gnugo --mode gtp < game.txt", "r");
|
FILE *p = _popen("./gnugo --mode gtp < game.txt", "r");
|
||||||
#else
|
#else
|
||||||
@ -841,5 +842,3 @@ void run_go(int argc, char **argv)
|
|||||||
else if(0==strcmp(argv[2], "test")) test_go(cfg, weights, multi);
|
else if(0==strcmp(argv[2], "test")) test_go(cfg, weights, multi);
|
||||||
else if(0==strcmp(argv[2], "engine")) engine_go(cfg, weights, multi);
|
else if(0==strcmp(argv[2], "engine")) engine_go(cfg, weights, multi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <cuda_runtime.h>
|
#include <cuda_runtime.h>
|
||||||
#include <curand.h>
|
#include <curand.h>
|
||||||
#include <cublas_v2.h>
|
#include <cublas_v2.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef USE_CMAKE_LIBS
|
||||||
|
#pragma warning(disable: 4996)
|
||||||
|
#endif
|
||||||
|
|
||||||
double what_time_is_it_now()
|
double what_time_is_it_now()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user