Subversion Repositories Games.Chess Giants

Rev

Rev 154 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 154 Rev 156
Line 291... Line 291...
291
/* this is an internal EPD glue routine */
291
/* this is an internal EPD glue routine */
292
/* check for a forced mate */
292
/* check for a forced mate */
293
  if (score >= (MATE - MAXPLY)) {
293
  if (score >= (MATE - MAXPLY)) {
294
/* convert forced mate score */
294
/* convert forced mate score */
295
    distance = (MATE - score) / 2;
295
    distance = (MATE - score) / 2;
296
    cpev = synth_mate(distance);
296
    cpev = (cpevT) synth_mate(distance); // Pierre-Marie Baty -- added type cast
297
  } else if (score <= (MAXPLY - MATE)) {
297
  } else if (score <= (MAXPLY - MATE)) {
298
/* convert forced loss score */
298
/* convert forced loss score */
299
    distance = (MATE + score) / 2;
299
    distance = (MATE + score) / 2;
300
    cpev = synth_loss(distance);
300
    cpev = (cpevT) synth_loss(distance); // Pierre-Marie Baty -- added type cast
301
  } else {
301
  } else {
302
/* convert regular score */
302
/* convert regular score */
303
    cpev = score;
303
    cpev = (cpevT) score; // Pierre-Marie Baty -- added type cast
304
  };
304
  };
305
  return cpev;
305
  return cpev;
306
}
306
}
307
 
307
 
308
/*--> EGMapFromHostMove: map move from host style to EPD style */
308
/*--> EGMapFromHostMove: map move from host style to EPD style */
Line 485... Line 485...
485
  epsq = EPDFetchEPSQ();
485
  epsq = EPDFetchEPSQ();
486
  hmvc = EPDFetchHMVC();
486
  hmvc = EPDFetchHMVC();
487
  fmvn = EPDFetchFMVN();
487
  fmvn = EPDFetchFMVN();
488
/* copy the board into the host board */
488
/* copy the board into the host board */
489
  for (sq = sq_a1; sq <= sq_h8; sq++)
489
  for (sq = sq_a1; sq <= sq_h8; sq++)
490
    tree->position.board[EGMapToHostSq(sq)] = EGMapToHostCP(rb.rbv[sq]);
490
    tree->position.board[EGMapToHostSq(sq)] = (int8_t) EGMapToHostCP(rb.rbv[sq]); // Pierre-Marie Baty -- added type cast
491
/* copy the active color */
491
/* copy the active color */
492
  game_wtm = EGMapToHostColor(actc);
492
  game_wtm = EGMapToHostColor(actc);
493
/* copy the castling availibility */
493
/* copy the castling availibility */
494
  tree->status[0].castle[1] = 0;
494
  tree->status[0].castle[1] = 0;
495
  if (cast & cf_wk)
495
  if (cast & cf_wk)
Line 503... Line 503...
503
    tree->status[0].castle[0] += 2;
503
    tree->status[0].castle[0] += 2;
504
/* copy the en passant target square */
504
/* copy the en passant target square */
505
  if (epsq == sq_nil)
505
  if (epsq == sq_nil)
506
    tree->status[0].enpassant_target = 0;
506
    tree->status[0].enpassant_target = 0;
507
  else
507
  else
508
    tree->status[0].enpassant_target = EGMapToHostSq(epsq);
508
    tree->status[0].enpassant_target = (uint8_t) EGMapToHostSq(epsq); // Pierre-Marie Baty -- added type cast
509
/* copy the halfmove clock */
509
/* copy the halfmove clock */
510
  tree->status[0].reversible = hmvc;
510
  tree->status[0].reversible = (uint8_t) hmvc; // Pierre-Marie Baty -- added type cast
511
/* copy the fullmove number */
511
/* copy the fullmove number */
512
  move_number = fmvn;
512
  move_number = fmvn;
513
/* set secondary host data items */
513
/* set secondary host data items */
514
  SetChessBitBoards(tree);
514
  SetChessBitBoards(tree);
515
  rep_index = 0;
515
  rep_index = 0;
Line 654... Line 654...
654
      s = EPDPGNHistory(default_gamptr);
654
      s = EPDPGNHistory(default_gamptr);
655
      if (s == NULL)
655
      if (s == NULL)
656
        *flagptr = 0;
656
        *flagptr = 0;
657
      else {
657
      else {
658
/* append game to PGN output file */
658
/* append game to PGN output file */
659
        sprintf(tv, "c%05hd.pgn", ((siT) getpid()));
659
        sprintf(tv, "c%05hd.pgn", ((siT) _getpid())); // Pierre-Marie Baty -- ISO C++ name conformance fix
660
        fptr = fopen(tv, "a");
660
        fptr = fopen(tv, "a");
661
        if (fptr == NULL)
661
        if (fptr == NULL)
662
          *flagptr = 0;
662
          *flagptr = 0;
663
        else {
663
        else {
664
          fprintf(fptr, "%s", s);
664
          fprintf(fptr, "%s", s);
Line 669... Line 669...
669
/* clean up and remove the temporary history file */
669
/* clean up and remove the temporary history file */
670
      if (history_file != NULL) {
670
      if (history_file != NULL) {
671
        fclose(history_file);
671
        fclose(history_file);
672
        history_file = NULL;
672
        history_file = NULL;
673
      };
673
      };
674
      sprintf(tv, "h%05hd.pml", ((siT) getpid()));
674
      sprintf(tv, "h%05hd.pml", ((siT) _getpid())); // Pierre-Marie Baty -- ISO C++ name conformance fix
675
      remove(tv);
675
      remove(tv);
676
/* close the game structure */
676
/* close the game structure */
677
      if (default_gamptr != NULL) {
677
      if (default_gamptr != NULL) {
678
        EPDGameClose(default_gamptr);
678
        EPDGameClose(default_gamptr);
679
        default_gamptr = NULL;
679
        default_gamptr = NULL;
Line 684... Line 684...
684
/* clean up and remove the temporary history file */
684
/* clean up and remove the temporary history file */
685
      if (history_file != NULL) {
685
      if (history_file != NULL) {
686
        fclose(history_file);
686
        fclose(history_file);
687
        history_file = NULL;
687
        history_file = NULL;
688
      };
688
      };
689
      sprintf(tv, "h%05hd.pml", ((siT) getpid()));
689
      sprintf(tv, "h%05hd.pml", ((siT) _getpid())); // Pierre-Marie Baty -- ISO C++ name conformance fix
690
      remove(tv);
690
      remove(tv);
691
/* ensure game structure is closed */
691
/* ensure game structure is closed */
692
      if (default_gamptr != NULL) {
692
      if (default_gamptr != NULL) {
693
        EPDGameClose(default_gamptr);
693
        EPDGameClose(default_gamptr);
694
        default_gamptr = NULL;
694
        default_gamptr = NULL;
Line 822... Line 822...
822
/* open the temporary history file */
822
/* open the temporary history file */
823
      if (history_file != NULL) {
823
      if (history_file != NULL) {
824
        fclose(history_file);
824
        fclose(history_file);
825
        history_file = NULL;
825
        history_file = NULL;
826
      };
826
      };
827
      sprintf(tv, "h%05hd.pml", ((siT) getpid()));
827
      sprintf(tv, "h%05hd.pml", ((siT) _getpid())); // Pierre-Marie Baty -- ISO C++ name conformance fix
828
      remove(tv);
828
      remove(tv);
829
      history_file = fopen(tv, "w+");
829
      history_file = fopen(tv, "w+");
830
/* open the current game structure */
830
/* open the current game structure */
831
      if (default_gamptr != NULL)
831
      if (default_gamptr != NULL)
832
        EPDGameClose(default_gamptr);
832
        EPDGameClose(default_gamptr);
Line 1075... Line 1075...
1075
      column = 0;
1075
      column = 0;
1076
      EPDSortSAN();
1076
      EPDSortSAN();
1077
      for (index = 0; index < count; index++) {
1077
      for (index = 0; index < count; index++) {
1078
        m = *EPDFetchMove(index);
1078
        m = *EPDFetchMove(index);
1079
        EPDSANEncode(&m, san);
1079
        EPDSANEncode(&m, san);
1080
        length = strlen(san);
1080
        length = (siT) strlen(san); // Pierre-Marie Baty -- added type cast
1081
        if ((column + 1 + length) < columnL) {
1081
        if ((column + 1 + length) < columnL) {
1082
          sprintf(tbufv, " %s", san);
1082
          sprintf(tbufv, " %s", san);
1083
          EGPrintTB();
1083
          EGPrintTB();
1084
          column += 1 + length;
1084
          column += 1 + length;
1085
        } else {
1085
        } else {
Line 1735... Line 1735...
1735
          if (host_acd == 0)
1735
          if (host_acd == 0)
1736
            host_acd = 1;
1736
            host_acd = 1;
1737
/* insert analysis count: depth */
1737
/* insert analysis count: depth */
1738
          EPDAddOpInt(epdptr, epdso_acd, host_acd);
1738
          EPDAddOpInt(epdptr, epdso_acd, host_acd);
1739
/* extract analysis count: nodes */
1739
/* extract analysis count: nodes */
1740
          host_acn = tree->nodes_searched;
1740
          host_acn = (liT) tree->nodes_searched; // Pierre-Marie Baty -- added type cast
1741
          if (host_acn == 0)
1741
          if (host_acn == 0)
1742
            host_acn = 1;
1742
            host_acn = 1;
1743
/* insert analysis count: nodes */
1743
/* insert analysis count: nodes */
1744
          EPDAddOpInt(epdptr, epdso_acn, host_acn);
1744
          EPDAddOpInt(epdptr, epdso_acn, host_acn);
1745
/* extract analysis count: seconds */
1745
/* extract analysis count: seconds */
1746
          host_acs = time(NULL) - start_time;
1746
          host_acs = (liT) (time(NULL) - start_time); // Pierre-Marie Baty -- added type cast
1747
          if (host_acs == 0)
1747
          if (host_acs == 0)
1748
            host_acs = 1;
1748
            host_acs = 1;
1749
/* insert analysis count: seconds */
1749
/* insert analysis count: seconds */
1750
          EPDAddOpInt(epdptr, epdso_acs, host_acs);
1750
          EPDAddOpInt(epdptr, epdso_acs, host_acs);
1751
/* extract centipawn evaluation */
1751
/* extract centipawn evaluation */