Subversion Repositories Games.Chess Giants

Rev

Rev 108 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 108 Rev 154
Line 78... Line 78...
78
 *  again and again until we reach the top of the book      *
78
 *  again and again until we reach the top of the book      *
79
 *  tree.                                                   *
79
 *  tree.                                                   *
80
 *                                                          *
80
 *                                                          *
81
 ************************************************************
81
 ************************************************************
82
 */
82
 */
83
  t_learn_value = ((float) learn_value) / 100.0f; // Pierre-Marie Baty -- added type cast
83
  t_learn_value = ((float) learn_value) / 100.0;
84
  for (i = 0; i < 64; i++)
84
  for (i = 0; i < 64; i++)
85
    if (learn_nmoves[i] > 1)
85
    if (learn_nmoves[i] > 1)
86
      nplies++;
86
      nplies++;
87
  nplies = Max(nplies, 1);
87
  nplies = Max(nplies, 1);
88
  for (i = 0; i < 64; i++) {
88
  for (i = 0; i < 64; i++) {
Line 113... Line 113...
113
      if (j >= cluster)
113
      if (j >= cluster)
114
        return;
114
        return;
115
      if (fabs(book_buffer[j].learn) < 0.0001)
115
      if (fabs(book_buffer[j].learn) < 0.0001)
116
        book_buffer[j].learn = book_learn[i];
116
        book_buffer[j].learn = book_learn[i];
117
      else
117
      else
118
        book_buffer[j].learn = (book_buffer[j].learn + book_learn[i]) / 2.0f; // Pierre-Marie Baty -- added type cast
118
        book_buffer[j].learn = (book_buffer[j].learn + book_learn[i]) / 2.0;
119
      fseek(book_file, learn_seekto[i] + 4, SEEK_SET);
119
      fseek(book_file, learn_seekto[i] + 4, SEEK_SET);
120
      if (cluster)
120
      if (cluster)
121
        BookClusterOut(book_file, cluster, book_buffer);
121
        BookClusterOut(book_file, cluster, book_buffer);
122
      fflush(book_file);
122
      fflush(book_file);
123
    }
123
    }
Line 138... Line 138...
138
 *******************************************************************************
138
 *******************************************************************************
139
 */
139
 */
140
int LearnFunction(int sv, int search_depth, int rating_difference,
140
int LearnFunction(int sv, int search_depth, int rating_difference,
141
    int trusted_value) {
141
    int trusted_value) {
142
  float multiplier;
142
  float multiplier;
143
  static const float rating_mult_t[11] = { .00625f, .0125f, .025f, .05f, .075f, .1f,
143
  static const float rating_mult_t[11] = { .00625, .0125, .025, .05, .075, .1,
144
    0.15f, 0.2f, 0.25f, 0.3f, 0.35f // Pierre-Marie Baty -- added type casts
144
    0.15, 0.2, 0.25, 0.3, 0.35
145
  };
145
  };
146
  static const float rating_mult_ut[11] = { .25f, .2f, .15f, .1f, .05f, .025f, .012f,
146
  static const float rating_mult_ut[11] = { .25, .2, .15, .1, .05, .025, .012,
147
    .006f, .003f, .001f // Pierre-Marie Baty -- added type casts
147
    .006, .003, .001
148
  };
148
  };
149
  int sd, rd, value;
149
  int sd, rd, value;
150
 
150
 
151
  sd = Max(Min(search_depth - 10, 19), 0);
151
  sd = Max(Min(search_depth - 10, 19), 0);
152
  rd = Max(Min(rating_difference / 200, 5), -5) + 5;
152
  rd = Max(Min(rating_difference / 200, 5), -5) + 5;