Skip to content

Commit

Permalink
some tracking code
Browse files Browse the repository at this point in the history
  • Loading branch information
vollmerm committed Aug 26, 2013
1 parent fafaf3f commit 977f4ff
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
3 changes: 2 additions & 1 deletion comp.c
Expand Up @@ -440,7 +440,7 @@ MOVE Comp(void) {
printf("Trap was set, and a non-ideal move is being chosen.\n");
}

//writeTrapData(TrapSet, TrapsFound);
writeTrapData(TrapSet, TrapsFound);

/* Return the best move that we found */
return Previous;
Expand Down Expand Up @@ -1002,6 +1002,7 @@ int Search(Board *B,const int alpha, const int beta, int depth, int ply,
PrintMove(trapMove, TRUE, stdout);
printf("; Adding %d to score for ply %d move to yield %d.\n", adjEval-rawEval, ply, adjEval);
printf("---\n");
WriteBoardDataLite(Current_Board, topmove, bestmove, trapMove, rawEval, adjEval, profit);
TrapsFound++;
best = adjEval;
bestmove = trapMove;
Expand Down
26 changes: 24 additions & 2 deletions trappy.c
Expand Up @@ -113,16 +113,38 @@ float scale(float T, int best) {
}

void writeTrapData(int TrapSet, int TrapsFound) {
/*
FILE *fp;
//if (TrapsFound) return;
fp = fopen("trapresults.csv","a");
if (fp == NULL) {
printf("Could not open trapresults.dat for writing.\n");
return;
}
fprintf(fp,"%d,%d\n", TrapSet, TrapsFound);
fclose(fp);
*/
}

void WriteBoardDataLite(Board b, MOVE top, MOVE best, MOVE trap, int bestscore, int trapscore, int profit)
{
FILE *fp = fopen("litedata.dat","a");
char FEN[FILENAME_MAX];
BoardToFEN(&b, FEN);
PrintBoardFile(b, fp);
fprintf(fp, "Top move ");
PrintMove(top, TRUE, fp);
fprintf(fp, "\nBest move %d ", bestscore);
PrintMove(best, TRUE, fp);
fprintf(fp, "\nTrap move %d ", trapscore);
PrintMove(trap, TRUE, fp);
fprintf(fp, "\nProfit %d\nMax Depth %d\n\n", profit, MAX_DEPTH);
fclose(fp);
}

void WriteMarker()
{
FILE *fp = fopen("litedata.dat","a");
fprintf(fp, "********* MARKER\n");
fclose(fp);
}

void WriteBoardData(MOVE trapm, MOVE bestm, Board b, Board c, int best, int adj,
Expand Down
2 changes: 2 additions & 0 deletions trappy.h
Expand Up @@ -27,4 +27,6 @@ float scale(float T, int M);
void writeTrapData(int, int);
void WriteBoardData(MOVE trapm, MOVE bestm, Board b, Board c, int best, int adj,
int *scores, int scoresCount, int ply);
void WriteBoardDataLite(Board b, MOVE top, MOVE best, MOVE trap, int bestscore, int trapscore, int profit);
void WriteMarker();
#endif

0 comments on commit 977f4ff

Please sign in to comment.