Skip to content

Commit

Permalink
More MSVC compatibility fixes.
Browse files Browse the repository at this point in the history
This fixes nneonneo#23.
  • Loading branch information
nneonneo committed Apr 16, 2014
1 parent 49cf371 commit 3e804a4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions 2048.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
typedef std::map<board_t, float> trans_table_t;
#endif

/* MSVC compatibility: undefine max and min macros */
#if defined(max)
#undef max
#endif

#if defined(min)
#undef min
#endif

// Transpose rows/columns in a board:
// 0123 048c
// 4567 --> 159d
Expand Down Expand Up @@ -329,8 +338,8 @@ float score_toplevel_move(board_t board, int move) {
elapsed = (finish.tv_sec - start.tv_sec);
elapsed += (finish.tv_usec - start.tv_usec) / 1000000.0;

printf("Move %d: result %f: eval'd %d moves (%d cache hits, %zd cache size) in %.2f seconds (maxdepth=%d)\n", move, res,
state.moves_evaled, state.cachehits, state.trans_table.size(), elapsed, state.maxdepth);
printf("Move %d: result %f: eval'd %d moves (%d cache hits, %d cache size) in %.2f seconds (maxdepth=%d)\n", move, res,
state.moves_evaled, state.cachehits, (int)state.trans_table.size(), elapsed, state.maxdepth);

return res;
}
Expand Down

0 comments on commit 3e804a4

Please sign in to comment.