Subversion Repositories Games.Chess Giants

Rev

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

Rev 33 Rev 108
Line 26... Line 26...
26
 *                                                                             *
26
 *                                                                             *
27
 *   Finally, if there is an enpassant capture possible (the last move was a   *
27
 *   Finally, if there is an enpassant capture possible (the last move was a   *
28
 *   double pawn move and there was an enemy pawn that could capture it.  The  *
28
 *   double pawn move and there was an enemy pawn that could capture it.  The  *
29
 *   square is the square the capturing pawn ends up on.                       *
29
 *   square is the square the capturing pawn ends up on.                       *
30
 *                                                                             *
30
 *                                                                             *
31
 *         K2R/PPP////q/5ppp/7k/ b - -                                         *
31
 *           K2R/PPP////q/5ppp/7k/ b - -                                       *
32
 *                                                                             *
32
 *                                                                             *
33
 *   this assumes that k represents a white king and -q represents a black     *
33
 *   this assumes that k represents a white king and -q represents a black     *
34
 *   queen.                                                                    *
34
 *   queen.                                                                    *
35
 *                                                                             *
35
 *                                                                             *
36
 *                          k  *  *  r  *  *  *  *                             *
36
 *                            k  *  *  r  *  *  *  *                           *
37
 *                          p  p  p  *  *  *  *  *                             *
37
 *                            p  p  p  *  *  *  *  *                           *
38
 *                          *  *  *  *  *  *  *  *                             *
38
 *                            *  *  *  *  *  *  *  *                           *
39
 *                          *  *  *  *  *  *  *  *                             *
39
 *                            *  *  *  *  *  *  *  *                           *
40
 *                          *  *  *  *  *  *  *  *                             *
40
 *                            *  *  *  *  *  *  *  *                           *
41
 *                         -q  *  *  *  *  *  *  *                             *
41
 *                           -q  *  *  *  *  *  *  *                           *
42
 *                          *  *  *  *  * -p -p -p                             *
42
 *                            *  *  *  *  * -p -p -p                           *
43
 *                          *  *  *  *  *  *  * -k                             *
43
 *                            *  *  *  *  *  *  * -k                           *
44
 *                                                                             *
44
 *                                                                             *
45
 *******************************************************************************
45
 *******************************************************************************
46
 */
46
 */
47
void SetBoard(TREE * tree, int nargs, char *args[], int special) {
47
void SetBoard(TREE * tree, int nargs, char *args[], int special) {
48
  int twtm, i, match, num, pos, square, tboard[64];
48
  int twtm, i, match, num, pos, square, tboard[64];
49
  int bcastle, ep, wcastle, error = 0;
49
  int bcastle, ep, wcastle, error = 0, whichsq;
50
  char input[80];
50
  char input[80];
51
  static const char bdinfo[] =
51
  static const char bdinfo[] =
52
      { 'k', 'q', 'r', 'b', 'n', 'p', '*', 'P', 'N', 'B',
52
      { 'k', 'q', 'r', 'b', 'n', 'p', '*', 'P', 'N', 'B',
53
    'R', 'Q', 'K', '*', '1', '2', '3', '4',
53
    'R', 'Q', 'K', '*', '1', '2', '3', '4',
54
    '5', '6', '7', '8', '/'
54
    '5', '6', '7', '8', '/'
55
  };
55
  };
56
  static const char status[13] =
56
  static const char status[13] =
57
      { 'K', 'Q', 'k', 'q', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
57
      { 'K', 'Q', 'k', 'q', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
58
    'h', ' '
58
    'h', ' '
59
  };
59
  };
60
  int whichsq;
-
 
61
  static const int firstsq[8] = { 56, 48, 40, 32, 24, 16, 8, 0 };
60
  static const int firstsq[8] = { 56, 48, 40, 32, 24, 16, 8, 0 };
-
 
61
 
62
  if (special)
62
  if (special)
63
    strcpy_s(input, sizeof (input), initial_position); // Pierre-Marie Baty -- use safe version
63
    strcpy(input, initial_position);
64
  else
64
  else
65
    strcpy_s(input, sizeof (input), args[0]); // Pierre-Marie Baty -- use safe version
65
    strcpy(input, args[0]);
66
  for (i = 0; i < 64; i++)
66
  for (i = 0; i < 64; i++)
67
    tboard[i] = 0;
67
    tboard[i] = 0;
68
/*
68
/*
69
 ************************************************************
69
 ************************************************************
70
 *                                                          *
70
 *                                                          *
Line 245... Line 245...
245
  game_wtm = twtm;
245
  game_wtm = twtm;
246
  error += InvalidPosition(tree);
246
  error += InvalidPosition(tree);
247
  if (!error) {
247
  if (!error) {
248
    if (log_file)
248
    if (log_file)
249
      DisplayChessBoard(log_file, tree->position);
249
      DisplayChessBoard(log_file, tree->position);
250
    tree->rep_index = 0;
250
    rep_index = 0;
251
    tree->rep_list[0] = HashKey;
251
    tree->rep_list[0] = HashKey;
252
    Reversible(0) = 0;
252
    Reversible(0) = 0;
253
    if (!special) {
253
    if (!special) {
254
      last_mate_score = 0;
254
      last_mate_score = 0;
255
      InitializeKillers();
255
      InitializeKillers();