Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!sunaus.oz!richb From: richb@sunaus.oz (Rich Burridge) Newsgroups: comp.sources.games.bugs Subject: Official patch #2 for reve v1.1 (Part 2 of 3). Message-ID: <1990Nov28.002226.8539@sunaus.oz> Date: 28 Nov 90 00:22:26 GMT Organization: Sun Microsystems - Australia Lines: 1386 ------CUT HERE------patch 2 - part 2------CUT HERE------ ------- main.c ------- *** /tmp/da02127 Wed Nov 28 11:00:27 1990 --- main.c Wed Nov 28 10:40:26 1990 *************** *** 27,40 **** #include "patchlevel.h" #ifdef SYSV #include #else #include - #endif /*SYSV*/ #include #ifdef X11 #include #endif /*X11*/ /* Text values for the cyclic buttons. */ char *diff_values[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL } ; char *notes_values[] = { "off", "on", NULL } ; --- 27,49 ---- #include "patchlevel.h" #ifdef SYSV #include + #include #else #include #include + #endif /*SYSV*/ + #ifdef X11 #include #endif /*X11*/ + #ifdef NO_TIMEVAL + struct timeval { + long tv_sec ; /* Seconds */ + long tv_usec ; /* Microseconds */ + } ; + #endif /*NO_TIMEVAL*/ + /* Text values for the cyclic buttons. */ char *diff_values[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL } ; char *notes_values[] = { "off", "on", NULL } ; *************** *** 50,55 **** --- 59,66 ---- int piece_x ; /* Current X position of moving piece. */ int piece_y ; /* Current Y position of moving piece */ + int animation ; /* If set, show computer move glide and piece drag. */ + int best_cmove ; /* Best computer move so far. */ int bfont_height ; /* Height in pixels for bold font. */ int but_inverted ; /* Value of panel item inverted. */ int color ; /* Current color value. */ *************** *** 56,61 **** --- 67,75 ---- int cur_ch ; /* Current character pressed. */ int curx ; /* Current mouse X position. */ int cury ; /* Current mouse Y position. */ + int do_bestmove ; /* If set, continuously update computers best move. */ + int do_last ; /* If set, don't show last move. */ + int do_number ; /* If set, the last stone placed is numbered. */ int down ; /* Indicates is a mouse button is down. */ int first_move = 0 ; /* Set if computer plays first move. */ int iconic ; /* Set if window is currently iconic. */ *************** *** 68,73 **** --- 82,88 ---- int ix ; /* Initial X position of the icon. */ int iy ; /* Initial Y position of the icon. */ int last_move ; /* Last valid computer move. */ + int last_outline ; /* Position of last piece outline whilst dragging. */ int level ; /* Current level of difficulty for computer moves. */ int loadgame = 0 ; /* Set if there is a game file to load. */ int lsval = 0 ; /* Set to 'l' or 's', if loading or saving. */ *************** *** 79,86 **** int nfont_height ; /* Height in pixels for normal font. */ int play_computer ; /* Set if playing against the computer. */ int posspec ; /* Set if -Wp or -g option is present (for X11) */ int saveres = 0 ; /* If set, save computer results to log file. */ ! int show_moves = 0 ; /* If set, all possible moves are being shown. */ int show_notes ; /* If set, display notes value from play_reve. */ int suggestion = -1 ; /* Positive if a suggested move. */ int suggest_x ; /* X position of suggested move. */ --- 94,102 ---- int nfont_height ; /* Height in pixels for normal font. */ int play_computer ; /* Set if playing against the computer. */ int posspec ; /* Set if -Wp or -g option is present (for X11) */ + int quickgame ; /* If set, don't flash turning stones. */ int saveres = 0 ; /* If set, save computer results to log file. */ ! int show_moves ; /* If set, all possible moves are being shown. */ int show_notes ; /* If set, display notes value from play_reve. */ int suggestion = -1 ; /* Positive if a suggested move. */ int suggest_x ; /* X position of suggested move. */ *************** *** 134,140 **** BWIDTH, BHEIGHT, "undo", 0, undo }, { P_BUTTON, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "done", 0, done }, { P_BUTTON, -1, -1, /* Not normally active. */ BWIDTH, BHEIGHT, "cancel", 0, remove_textfield }, --- 150,156 ---- BWIDTH, BHEIGHT, "undo", 0, undo }, { P_BUTTON, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "iconify", 0, done }, { P_BUTTON, -1, -1, /* Not normally active. */ BWIDTH, BHEIGHT, "cancel", 0, remove_textfield }, *************** *** 157,169 **** { P_MESSAGE, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (4*(BHEIGHT+BGAP)), 0, 0, "Use left mouse button to move", 0, NULL }, ! { P_MESSAGE, BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (4*(BHEIGHT+BGAP)), 0, 0, "", 0, NULL }, ! { P_MESSAGE, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (5*(BHEIGHT+BGAP)), 0, 0, "White: 2, Black: 2", 0, NULL }, ! { P_MESSAGE, BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (5*(BHEIGHT+BGAP)), 0, 0, "", 0, NULL }, } ; --- 173,185 ---- { P_MESSAGE, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (4*(BHEIGHT+BGAP)), 0, 0, "Use left mouse button to move", 0, NULL }, ! { P_MESSAGE, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (5*(BHEIGHT+BGAP)), 0, 0, "", 0, NULL }, ! { P_MESSAGE, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (6*(BHEIGHT+BGAP)), 0, 0, "White: 2, Black: 2", 0, NULL }, ! { P_MESSAGE, BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (6*(BHEIGHT+BGAP)), 0, 0, "", 0, NULL }, } ; *************** *** 248,258 **** if (argv[0][0] == '-') switch (argv[0][1]) { ! case 'b' : isblack = 1 ; ! if (*(argv+1) != NULL && argv[1][0] != '-') { ! INC ; ! black_dpy = *argv ; } break ; case 'c' : play_computer = 1 ; /* Play against the computer. */ --- 264,281 ---- if (argv[0][0] == '-') switch (argv[0][1]) { ! case 'a' : /* Allow computer glide and piece dragging. */ ! if (EQUAL(argv[0], "-animate")) animation = TRUE ; ! break ; ! case 'b' : if (EQUAL(argv[0], "-bestmove")) do_bestmove = TRUE ; ! else if (EQUAL(argv[0], "-black")) { ! isblack = 1 ; ! if (*(argv+1) != NULL && argv[1][0] != '-') ! { ! INC ; ! black_dpy = *argv ; ! } } break ; case 'c' : play_computer = 1 ; /* Play against the computer. */ *************** *** 272,297 **** break ; case 'i' : inv_video = 1 ; /* Display in inverse video. */ break ; ! case 'l' : INC ; /* Reve game file to load. */ ! getparam(gamefile, argv, "-l needs a game file") ; ! loadgame = 1 ; /* Game file to load. */ break ; case 'm' : monochrome = 1 ; /* Force display to mono. */ for (i = 0; i < MAXDPY; i++) iscolor[i] = 0 ; break ; ! case 'n' : show_notes = 1 ; /* Display computer notes. */ ! items[(int) NOTES].value = 1 ; break ; case 'r' : saveres = 1 ; /* Save computer results to file. */ break ; case '?' : case 'v' : usage() ; ! case 'w' : iswhite = 1 ; ! if (*(argv+1) != NULL && argv[1][0] != '-') { ! INC ; ! white_dpy = *argv ; } break ; --- 295,333 ---- break ; case 'i' : inv_video = 1 ; /* Display in inverse video. */ break ; ! case 'l' : if (EQUAL(argv[0], "-last")) do_last = TRUE ; ! else if (EQUAL(argv[0], "-load")) ! { ! INC ; /* Reve game file to load. */ ! getparam(gamefile, argv, "-l needs a game file") ; ! loadgame = 1 ; /* Game file to load. */ ! } break ; case 'm' : monochrome = 1 ; /* Force display to mono. */ for (i = 0; i < MAXDPY; i++) iscolor[i] = 0 ; break ; ! case 'n' : if (EQUAL(argv[0], "-notes")) ! { ! show_notes = TRUE ; ! items[(int) NOTES].value = 1 ; ! } ! else if (EQUAL(argv[0], "-number")) do_number = TRUE ; break ; + case 'q' : if (EQUAL(argv[0], "-quick")) quickgame = TRUE ; + break ; case 'r' : saveres = 1 ; /* Save computer results to file. */ break ; case '?' : case 'v' : usage() ; ! case 'w' : if (EQUAL(argv[0], "-white")) { ! iswhite = 1 ; ! if (*(argv+1) != NULL && argv[1][0] != '-') ! { ! INC ; ! white_dpy = *argv ; ! } } break ; *************** *** 417,422 **** --- 453,459 ---- } batch(IS_OFF) ; show_last(last_move, IS_ON) ; + show_number(last_move, IS_ON) ; show_suggestion() ; batch(IS_ON) ; FOR_BOARD(i) *************** *** 451,460 **** --- 488,505 ---- play_computer = 1 ; /* Default is human vs computer. */ iconic = 0 ; /* Initially an open window. */ last_move = -1 ; + last_outline = -1 ; next_player = BLACK ; + animation = FALSE ; + best_cmove = -1 ; but_inverted = -1 ; + do_bestmove = FALSE ; + do_last = FALSE ; + do_number = FALSE ; + quickgame = FALSE ; validkey = 0 ; cmode = BLACK_START ; + show_moves = FALSE ; show_notes = FALSE ; isblack = 0 ; iswhite = 0 ; *************** *** 463,469 **** black_dpy = NULL ; /* X11 black piece display information. */ white_dpy = NULL ; /* X11 white piece display information. */ ! STRCPY(geometry, "") ; /* X11 geometry information. */ STRCPY(edgefile, EDGENAME) ; } --- 508,515 ---- black_dpy = NULL ; /* X11 black piece display information. */ white_dpy = NULL ; /* X11 white piece display information. */ ! STRCPY(geometry[(int) DPY1], "") ; /* X11 geometry information. */ ! STRCPY(geometry[(int) DPY2], "") ; STRCPY(edgefile, EDGENAME) ; } *************** *** 590,598 **** { set_cursor(HOURGLASS) ; move = TRUE ; /* Make sure the computer clock is decremented. */ play_reve(board.square, player, level, &move, ¬e) ; set_cursor(CANVASCUR) ; ! animate_move(move) ; do_move(player) ; last_move = move ; cmode = (enum cantype) (OPPONENT(player) + 1) ; --- 636,648 ---- { set_cursor(HOURGLASS) ; move = TRUE ; /* Make sure the computer clock is decremented. */ + best_cmove = -1 ; + message(EVAL_MES, "") ; play_reve(board.square, player, level, &move, ¬e) ; set_cursor(CANVASCUR) ; ! if (animation == TRUE) animate_move(move) ; ! if (best_cmove != -1 && do_bestmove == TRUE) ! draw_square(best_cmove, IS_OFF, 2) ; do_move(player) ; last_move = move ; cmode = (enum cantype) (OPPONENT(player) + 1) ; *************** *** 603,612 **** usage() { FPRINTF(stderr, "%s version 1.1.%1d\n\n", progname, PATCHLEVEL) ; ! FPRINTF(stderr, "Usage: %s: [-b [display] ] [-c]\n", progname) ; ! FPRINTF(stderr, "\t[-d difficulty] [-e edgefile] [-g geometry]\n") ; ! FPRINTF(stderr, "\t[-l gamefile] [-v] [-w [display] ] [-?] [-Wi]\n") ; ! FPRINTF(stderr, "\t[-Wp x y] [-WP x y]\n") ; } --- 653,663 ---- usage() { FPRINTF(stderr, "%s version 1.1.%1d\n\n", progname, PATCHLEVEL) ; ! FPRINTF(stderr, "Usage: %s: [-animate] [-bestmove]\n", progname) ; ! FPRINTF(stderr, "\t[-black [display] ] [-c] [-d difficulty]\n") ; ! FPRINTF(stderr, "\t[-e edgefile] [-g geometry] [-last]\n") ; ! FPRINTF(stderr, "\t[-load gamefile] [-number] [-notes] [-v]\n") ; ! FPRINTF(stderr, "\t[-w [display] ] [-?] [-Wi] [-Wp x y] [-WP x y]\n") ; } *************** *** 614,624 **** --- 665,682 ---- usleep(x) /* Suspend execution for interval in microseconds. */ unsigned x ; { + #ifdef NOSELECT + unsigned seconds = x / 1000 ; + + if (x > 0) sleep(x) ; + #else + struct timeval st_delay ; st_delay.tv_usec = x ; st_delay.tv_sec = 0 ; (void) select(32, NULL, NULL, NULL, &st_delay) ; + #endif /*NOSELECT*/ } #endif /*NO_USLEEP*/ ------- procs.c ------- *** /tmp/da02133 Wed Nov 28 11:00:29 1990 --- procs.c Fri Nov 23 07:12:47 1990 *************** *** 41,57 **** { int cx, cy ; set_cursor(CANVASCUR) ; if (state == LEFT_DOWN) { ! draw_piece(next_player, piece_x, piece_y, RINV) ; cmode = (enum cantype) ((int) cmode - 1) ; } else { ! draw_piece(next_player, piece_x, piece_y, RINV) ; ! cx = (piece_x + PIECE_RAD - BBORDER) / CELL_SIZE ; ! cy = (piece_y + PIECE_RAD - CY - BBORDER) / CELL_SIZE ; move = cy * BOARD_SIZE + cx ; make_move() ; } --- 41,62 ---- { int cx, cy ; + cx = (piece_x + PIECE_RAD - BBORDER) / CELL_SIZE ; + cy = (piece_y + PIECE_RAD - CY - BBORDER) / CELL_SIZE ; + set_cursor(CANVASCUR) ; if (state == LEFT_DOWN) { ! draw_outline(cy * BOARD_SIZE + cx, IS_ON) ; ! if (animation == TRUE) ! draw_piece(next_player, piece_x, piece_y, RINV) ; cmode = (enum cantype) ((int) cmode - 1) ; } else { ! if (animation == TRUE) ! draw_piece(next_player, piece_x, piece_y, RINV) ; ! draw_outline(last_outline, IS_OFF) ; move = cy * BOARD_SIZE + cx ; make_move() ; } *************** *** 171,177 **** break ; case DECREMENT : if (--item_value == -1) { ! while (choices[++item_value] != NULL) ; item_value-- ; items[(int) item].value = item_value ; } --- 176,182 ---- break ; case DECREMENT : if (--item_value == -1) { ! while (choices[++item_value] != NULL) continue ; item_value-- ; items[(int) item].value = item_value ; } *************** *** 218,223 **** --- 223,229 ---- suggest_x+5, CY+suggest_y+5, RSRC, C_BLACK) ; draw_line(suggest_x-5, CY+suggest_y+5, suggest_x+5, CY+suggest_y-5, RSRC, C_BLACK) ; + if (show_notes) set_eval(player, suggestion, note) ; } *************** *** 254,260 **** if (n >= 3) { show_last(last_move, IS_OFF) ; ! FOR_BOARD(i) board.square[i] = moves[n].square[i] ; board.moves_left = moves[n].moves_left ; board.player = moves[n].player ; board.move = moves[n].move ; --- 260,278 ---- if (n >= 3) { show_last(last_move, IS_OFF) ; ! show_number(last_move, IS_OFF) ; ! FOR_BOARD(i) ! { ! if (moves[n].square[i] != board.square[i]) ! { ! get_xy(i, &x, &y) ; ! if (moves[n].square[i] == FREE) ! color_area(x, CY+y, PSIZE, PSIZE, ! (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE) ; ! else draw_piece(moves[n].square[i], x, CY+y, RSRC) ; ! } ! board.square[i] = moves[n].square[i] ; ! } board.moves_left = moves[n].moves_left ; board.player = moves[n].player ; board.move = moves[n].move ; *************** *** 276,290 **** else cmode = WHITE_START ; message(PANEL_MES, "") ; ! FOR_BOARD(i) { ! get_xy(i, &x, &y) ; ! if (board.square[i] == FREE) ! color_area(x, CY+y, PSIZE, PSIZE, ! (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE) ; ! else draw_piece(board.square[i], x, CY+y, RSRC) ; } ! if (n > 3) show_last(last_move, IS_ON) ; next_player = OPPONENT(board.player) ; } else message(PANEL_MES, "No moves to undo.") ; --- 294,306 ---- else cmode = WHITE_START ; message(PANEL_MES, "") ; ! if (n > 3) { ! show_last(last_move, IS_ON) ; ! show_number(last_move, IS_ON) ; ! if (show_notes) set_eval(board.player, board.move, board.note) ; } ! else message(EVAL_MES, "") ; next_player = OPPONENT(board.player) ; } else message(PANEL_MES, "No moves to undo.") ; ------- rev_eval.c ------- *** /tmp/da02136 Wed Nov 28 11:00:29 1990 --- rev_eval.c Tue Nov 20 10:31:35 1990 *************** *** 36,42 **** * - Potential Mobility, looking at squares contacts * And then Eval = c1 * ES + c2 * ( CM + cx * XV ) + c3 * PM * Eval is replaced by - Eval if Black is replaced by White. Eval is positive ! * if macouleur ( my color ) has a good position and negatif if tacouleur * position is good. * If we are "near" the end of the game, then Eval is equal to final disc * differential. --- 36,42 ---- * - Potential Mobility, looking at squares contacts * And then Eval = c1 * ES + c2 * ( CM + cx * XV ) + c3 * PM * Eval is replaced by - Eval if Black is replaced by White. Eval is positive ! * if macouleur ( my color ) has a good position and negative if tacouleur * position is good. * If we are "near" the end of the game, then Eval is equal to final disc * differential. *************** *** 83,88 **** --- 83,94 ---- } note = edges[i] ; + if (((i == 2191) && (d[13] == macouleur)) || + ((i == 2917) && (d[10] == macouleur)) || + ((i == 3643) && (d[10] == tacouleur)) || + ((i == 4369) && (d[13] == tacouleur))) + note -= edges[i] ; + i = 0 ; for (p = &d[56]; p < &d[64]; p++) { *************** *** 92,97 **** --- 98,109 ---- } note += edges[i] ; + if (((i == 2191) && (d[53] == macouleur)) || + ((i == 2917) && (d[50] == macouleur)) || + ((i == 3643) && (d[50] == tacouleur)) || + ((i == 4369) && (d[53] == tacouleur))) + note -= edges[i] ; + i = 0 ; for (p = &d[0]; p < &d[64]; p += 8) { *************** *** 101,106 **** --- 113,124 ---- } note += edges[i] ; + if (((i == 2191) && (d[41] == macouleur)) || + ((i == 2917) && (d[17] == macouleur)) || + ((i == 3643) && (d[17] == tacouleur)) || + ((i == 4369) && (d[41] == tacouleur))) + note -= edges[i] ; + i = 0 ; for (p = &d[7]; p < &d[64]; p += 8) { *************** *** 109,114 **** --- 127,138 ---- else if (*p == macouleur) i += 2 ; } note += edges[i] ; + + if (((i == 2191) && (d[46] == macouleur)) || + ((i == 2917) && (d[22] == macouleur)) || + ((i == 3643) && (d[22] == tacouleur)) || + ((i == 4369) && (d[46] == tacouleur))) + note -= edges[i] ; cx = 8 * (50 - mnb - profmax) ; ------- rev_ip.c ------- *** /tmp/da02139 Wed Nov 28 11:00:30 1990 --- rev_ip.c Fri Nov 23 23:17:29 1990 *************** *** 23,29 **** --- 23,34 ---- #include #include #include + #ifdef SYSV + #include + #else #include + #endif /*SYSV*/ + #include "reve.h" extern int saveres ; *************** *** 166,172 **** if (((k == 1) && (mnb < 52)) || (mnb == 1)) { ! for (cp = 0; d0[cpk[cp]] != JPJ; cp++) ; cpi[0] = cpi[cp] ; cpj[0] = cpj[cp] ; cpk[0] = cpk[cp] ; --- 171,177 ---- if (((k == 1) && (mnb < 52)) || (mnb == 1)) { ! for (cp = 0; d0[cpk[cp]] != JPJ; cp++) continue ; cpi[0] = cpi[cp] ; cpj[0] = cpj[cp] ; cpk[0] = cpk[cp] ; *************** *** 219,229 **** allotime = timeleft * 3 / (61 - mnb) ; firsttime = time((time_t *) NULL) ; ! signal(SIGALRM, catcher) ; if (setjmp(jumper) != 0) { ! if (cpmax == 0) note = oldnote ; profmax = -profmax ; goto trap ; } --- 224,236 ---- allotime = timeleft * 3 / (61 - mnb) ; firsttime = time((time_t *) NULL) ; ! cpmaxi[0] = cpmaxi[1] = cpmaxi[2] = cpmaxi[3] = 0 ; + SIGNAL(SIGALRM, catcher) ; + if (setjmp(jumper) != 0) { ! if (note == -1000000000) note = oldnote ; profmax = -profmax ; goto trap ; } *************** *** 233,239 **** oldnote = note ; note = -1000000000 ; ! if ((int) (allotime - timeused) > 2) alarm(allotime - timeused) ; c1 = 312 + 6 * (mnb + profmax) ; if (mnb + profmax < 25) --- 240,247 ---- oldnote = note ; note = -1000000000 ; ! if ((int) (allotime - timeused) > 2) ! ALARM((unsigned) (allotime - timeused)) ; c1 = 312 + 6 * (mnb + profmax) ; if (mnb + profmax < 25) *************** *** 247,254 **** if (profmax > 53 - mnb) { profmax = 61 - mnb ; ! allotime = timeleft * 3 / 5 ; ! if ((int) (allotime - timeused) > 2) alarm(allotime - timeused) ; } for (cp = 0; cp <= 60 - mnb; cp++) --- 255,263 ---- if (profmax > 53 - mnb) { profmax = 61 - mnb ; ! allotime = timeleft * 2 / 3 ; ! if ((int) (allotime - timeused) > 2) ! ALARM((unsigned) (allotime - timeused)) ; } for (cp = 0; cp <= 60 - mnb; cp++) *************** *** 267,283 **** { note = lnote ; cpmax = cp ; } } } ! alarm(0) ; cpmaxi[0] = cpmax ; if ((mnb < 57) && (cpmaxi[0] != cpmaxi[1]) && (cpmaxi[1] != cpmaxi[2]) && (cpmaxi[0] != cpmaxi[2])) { - if (cpmax == 0) count++ ; else count = 1 ; for (cp = 0; cp <= 60 - mnb; cp++) cpf[cp] = TRUE ; for (k = 0; k < 3; k++) { --- 276,294 ---- { note = lnote ; cpmax = cp ; + show_best(cpk[cpmax], lnote) ; } } } ! ALARM(0) ; cpmaxi[0] = cpmax ; + if (cpmax == 0) count += 2 ; + else count = 1 ; if ((mnb < 57) && (cpmaxi[0] != cpmaxi[1]) && (cpmaxi[1] != cpmaxi[2]) && (cpmaxi[0] != cpmaxi[2])) { for (cp = 0; cp <= 60 - mnb; cp++) cpf[cp] = TRUE ; for (k = 0; k < 3; k++) { *************** *** 318,324 **** timeused = time((time_t *) NULL) - firsttime ; if ((mnb == 4) && (profmax == 3)) break ; } ! while ((timeused * count < allotime * 5 / 4) && (profmax != 61 - mnb)) ; trap: timeused = time((time_t *) NULL) - firsttime ; if (timeused == 0) timeused = 1 ; --- 329,335 ---- timeused = time((time_t *) NULL) - firsttime ; if ((mnb == 4) && (profmax == 3)) break ; } ! while ((timeused * count < allotime * 4 / 5) && (profmax != 61 - mnb)) ; trap: timeused = time((time_t *) NULL) - firsttime ; if (timeused == 0) timeused = 1 ; *************** *** 354,361 **** long alpha, beta ; { register int *d0, *d1 ; ! register int k, cp, cpmax ; register long lnote, note ; d0 = damier[niv] ; d1 = damier[niv + 1] ; --- 365,373 ---- long alpha, beta ; { register int *d0, *d1 ; ! register int k, cp ; register long lnote, note ; + register int cpmax = 0 ; d0 = damier[niv] ; d1 = damier[niv + 1] ; *************** *** 402,409 **** long alpha, beta ; { register int *d0, *d1 ; ! register int k, cp, cpmax ; register long lnote, note ; d0 = damier[niv] ; d1 = damier[niv + 1] ; --- 414,422 ---- long alpha, beta ; { register int *d0, *d1 ; ! register int k, cp ; register long lnote, note ; + register int cpmax = 0 ; d0 = damier[niv] ; d1 = damier[niv + 1] ; ------- rev_iycp.c ------- *** /tmp/da02142 Wed Nov 28 11:00:31 1990 --- rev_iycp.c Tue Nov 20 10:53:09 1990 *************** *** 60,66 **** for (x = posx + 1; (x < 7) && (d[(x << 3) + posy] == tacouleur); ! x++) ; if ((x != posx + 1) && (d[(x << 3) + posy] == macouleur)) { flag = TRUE ; --- 60,66 ---- for (x = posx + 1; (x < 7) && (d[(x << 3) + posy] == tacouleur); ! x++) continue ; if ((x != posx + 1) && (d[(x << 3) + posy] == macouleur)) { flag = TRUE ; *************** *** 71,77 **** for (x = posx - 1; (x > 0) && (d[(x << 3) + posy] == tacouleur); ! x--) ; if ((x != posx - 1) && (d[(x << 3) + posy] == macouleur)) { flag = TRUE ; --- 71,77 ---- for (x = posx - 1; (x > 0) && (d[(x << 3) + posy] == tacouleur); ! x--) continue ; if ((x != posx - 1) && (d[(x << 3) + posy] == macouleur)) { flag = TRUE ; *************** *** 82,88 **** for (y = posy + 1; (y < 7) && (d[pos8x + y] == tacouleur); ! y++) ; if ((y != posy + 1) && (d[pos8x + y] == macouleur)) { flag = TRUE ; --- 82,88 ---- for (y = posy + 1; (y < 7) && (d[pos8x + y] == tacouleur); ! y++) continue ; if ((y != posy + 1) && (d[pos8x + y] == macouleur)) { flag = TRUE ; *************** *** 93,99 **** for (y = posy - 1; (y > 0) && (d[pos8x + y] == tacouleur); ! y--) ; if ((y != posy - 1) && (d[pos8x + y] == macouleur)) { flag = TRUE ; --- 93,99 ---- for (y = posy - 1; (y > 0) && (d[pos8x + y] == tacouleur); ! y--) continue ; if ((y != posy - 1) && (d[pos8x + y] == macouleur)) { flag = TRUE ; *************** *** 104,110 **** for (x = posx + 1, y = posy + 1; (x < 7) && (y < 7) && (d[(x << 3) + y] == tacouleur); ! x++, y++) ; if ((x != posx + 1) && (d[(x << 3) + y] == macouleur)) { flag = TRUE ; --- 104,110 ---- for (x = posx + 1, y = posy + 1; (x < 7) && (y < 7) && (d[(x << 3) + y] == tacouleur); ! x++, y++) continue ; if ((x != posx + 1) && (d[(x << 3) + y] == macouleur)) { flag = TRUE ; *************** *** 115,121 **** for (x = posx - 1, y = posy + 1; (x > 0) && (y < 7) && (d[(x << 3) + y] == tacouleur); ! x--, y++) ; if ((x != posx - 1) && (d[(x << 3) + y] == macouleur)) { flag = TRUE ; --- 115,121 ---- for (x = posx - 1, y = posy + 1; (x > 0) && (y < 7) && (d[(x << 3) + y] == tacouleur); ! x--, y++) continue ; if ((x != posx - 1) && (d[(x << 3) + y] == macouleur)) { flag = TRUE ; *************** *** 126,132 **** for (x = posx + 1, y = posy - 1; (x < 7) && (y > 0) && (d[(x << 3) + y] == tacouleur); ! x++, y--) ; if ((x != posx + 1) && (d[(x << 3) + y] == macouleur)) { flag = TRUE ; --- 126,132 ---- for (x = posx + 1, y = posy - 1; (x < 7) && (y > 0) && (d[(x << 3) + y] == tacouleur); ! x++, y--) continue ; if ((x != posx + 1) && (d[(x << 3) + y] == macouleur)) { flag = TRUE ; *************** *** 137,143 **** for (x = posx - 1, y = posy - 1; (x > 0) && (y > 0) && (d[(x << 3) + y] == tacouleur); ! x--, y--) ; if ((x != posx - 1) && (d[(x << 3) + y] == macouleur)) { flag = TRUE ; --- 137,143 ---- for (x = posx - 1, y = posy - 1; (x > 0) && (y > 0) && (d[(x << 3) + y] == tacouleur); ! x--, y--) continue ; if ((x != posx - 1) && (d[(x << 3) + y] == macouleur)) { flag = TRUE ; *************** *** 152,165 **** } ! jejoueen(px, py, niv) ! int px, py, niv ; { register int *d ; ! register int x, y, posx, posy, pos8x ; - posx = px ; - posy = py ; pos8x = posx << 3 ; d = damier[niv] ; --- 152,163 ---- } ! jejoueen(posx, posy, niv) ! int posx, posy, niv ; { register int *d ; ! register int x, y, pos8x ; pos8x = posx << 3 ; d = damier[niv] ; *************** *** 166,172 **** d[pos8x + posy] = macouleur ; ! for (x = posx + 1; (x < 7) && (d[(x << 3) + posy] == tacouleur); x++) ; if ((x != posx + 1) && (d[(x << 3) + posy] == macouleur)) { for (x = posx + 1; d[(x << 3) + posy] == tacouleur; x++) --- 164,171 ---- d[pos8x + posy] = macouleur ; ! for (x = posx + 1; ! (x < 7) && (d[(x << 3) + posy] == tacouleur); x++) continue ; if ((x != posx + 1) && (d[(x << 3) + posy] == macouleur)) { for (x = posx + 1; d[(x << 3) + posy] == tacouleur; x++) *************** *** 173,179 **** d[(x << 3) + posy] = macouleur ; } ! for (x = posx - 1; (x > 0) && (d[(x << 3) + posy] == tacouleur); x--) ; if ((x != posx - 1) && (d[(x << 3) + posy] == macouleur)) { for (x = posx - 1; d[(x << 3) + posy] == tacouleur; x--) --- 172,179 ---- d[(x << 3) + posy] = macouleur ; } ! for (x = posx - 1; ! (x > 0) && (d[(x << 3) + posy] == tacouleur); x--) continue ; if ((x != posx - 1) && (d[(x << 3) + posy] == macouleur)) { for (x = posx - 1; d[(x << 3) + posy] == tacouleur; x--) *************** *** 180,186 **** d[(x << 3) + posy] = macouleur ; } ! for (y = posy + 1; (y < 7) && (d[pos8x + y] == tacouleur); y++) ; if ((y != posy + 1) && (d[pos8x + y] == macouleur)) { for (y = posy + 1; d[pos8x + y] == tacouleur; y++) --- 180,187 ---- d[(x << 3) + posy] = macouleur ; } ! for (y = posy + 1; ! (y < 7) && (d[pos8x + y] == tacouleur); y++) continue ; if ((y != posy + 1) && (d[pos8x + y] == macouleur)) { for (y = posy + 1; d[pos8x + y] == tacouleur; y++) *************** *** 187,193 **** d[pos8x + y] = macouleur ; } ! for (y = posy - 1; (y > 0) && (d[pos8x + y] == tacouleur); y--) ; if ((y != posy - 1) && (d[pos8x + y] == macouleur)) { for (y = posy - 1; d[pos8x + y] == tacouleur; y--) --- 188,195 ---- d[pos8x + y] = macouleur ; } ! for (y = posy - 1; ! (y > 0) && (d[pos8x + y] == tacouleur); y--) continue ; if ((y != posy - 1) && (d[pos8x + y] == macouleur)) { for (y = posy - 1; d[pos8x + y] == tacouleur; y--) *************** *** 195,201 **** } for (x = posx + 1, y = posy + 1; ! (x < 7) && (y < 7) && (d[(x << 3) + y] == tacouleur); x++, y++) ; if ((x != posx + 1) && (d[(x << 3) + y] == macouleur)) { for (x = posx + 1, y = posy + 1; d[(x << 3) + y] == tacouleur; x++, y++) --- 197,204 ---- } for (x = posx + 1, y = posy + 1; ! (x < 7) && (y < 7) && (d[(x << 3) + y] == tacouleur); ! x++, y++) continue ; if ((x != posx + 1) && (d[(x << 3) + y] == macouleur)) { for (x = posx + 1, y = posy + 1; d[(x << 3) + y] == tacouleur; x++, y++) *************** *** 203,209 **** } for (x = posx - 1, y = posy + 1; ! (x > 0) && (y < 7) && (d[(x << 3) + y] == tacouleur); x--, y++) ; if ((x != posx - 1) && (d[(x << 3) + y] == macouleur)) { for (x = posx - 1, y = posy + 1; d[(x << 3) + y] == tacouleur; x--, y++) --- 206,213 ---- } for (x = posx - 1, y = posy + 1; ! (x > 0) && (y < 7) && (d[(x << 3) + y] == tacouleur); ! x--, y++) continue ; if ((x != posx - 1) && (d[(x << 3) + y] == macouleur)) { for (x = posx - 1, y = posy + 1; d[(x << 3) + y] == tacouleur; x--, y++) *************** *** 211,217 **** } for (x = posx + 1, y = posy - 1; ! (x < 7) && (y > 0) && (d[(x << 3) + y] == tacouleur); x++, y--) ; if ((x != posx + 1) && (d[(x << 3) + y] == macouleur)) { for (x = posx + 1, y = posy - 1; d[(x << 3) + y] == tacouleur; x++, y--) --- 215,222 ---- } for (x = posx + 1, y = posy - 1; ! (x < 7) && (y > 0) && (d[(x << 3) + y] == tacouleur); ! x++, y--) continue ; if ((x != posx + 1) && (d[(x << 3) + y] == macouleur)) { for (x = posx + 1, y = posy - 1; d[(x << 3) + y] == tacouleur; x++, y--) *************** *** 219,225 **** } for (x = posx - 1, y = posy - 1; ! (x > 0) && (y > 0) && (d[(x << 3) + y] == tacouleur); x--, y--) ; if ((x != posx - 1) && (d[(x << 3) + y] == macouleur)) { for (x = posx - 1, y = posy - 1; d[(x << 3) + y] == tacouleur; x--, y--) --- 224,231 ---- } for (x = posx - 1, y = posy - 1; ! (x > 0) && (y > 0) && (d[(x << 3) + y] == tacouleur); ! x--, y--) continue ; if ((x != posx - 1) && (d[(x << 3) + y] == macouleur)) { for (x = posx - 1, y = posy - 1; d[(x << 3) + y] == tacouleur; x--, y--) *************** *** 249,255 **** { for (x = posx + 1; (x < 7) && (d[(x << 3) + posy] == macouleur); ! x++) ; if ((x != posx + 1) && (d[(x << 3) + posy] == tacouleur)) { flag = TRUE ; --- 255,261 ---- { for (x = posx + 1; (x < 7) && (d[(x << 3) + posy] == macouleur); ! x++) continue ; if ((x != posx + 1) && (d[(x << 3) + posy] == tacouleur)) { flag = TRUE ; *************** *** 260,266 **** for (x = posx - 1; (x > 0) && (d[(x << 3) + posy] == macouleur) ; ! x--) ; if ((x != posx - 1) && (d[(x << 3) + posy] == tacouleur)) { flag = TRUE ; --- 266,272 ---- for (x = posx - 1; (x > 0) && (d[(x << 3) + posy] == macouleur) ; ! x--) continue ; if ((x != posx - 1) && (d[(x << 3) + posy] == tacouleur)) { flag = TRUE ; *************** *** 271,277 **** for (y = posy + 1; (y < 7) && (d[pos8x + y] == macouleur); ! y++) ; if ((y != posy + 1) && (d[pos8x + y] == tacouleur)) { flag = TRUE ; --- 277,283 ---- for (y = posy + 1; (y < 7) && (d[pos8x + y] == macouleur); ! y++) continue ; if ((y != posy + 1) && (d[pos8x + y] == tacouleur)) { flag = TRUE ; *************** *** 282,288 **** for (y = posy - 1; (y > 0) && (d[pos8x + y] == macouleur); ! y--) ; if ((y != posy - 1) && (d[pos8x + y] == tacouleur)) { flag = TRUE ; --- 288,294 ---- for (y = posy - 1; (y > 0) && (d[pos8x + y] == macouleur); ! y--) continue ; if ((y != posy - 1) && (d[pos8x + y] == tacouleur)) { flag = TRUE ; *************** *** 293,299 **** for (x = posx + 1, y = posy + 1; (x < 7) && (y < 7) && (d[(x << 3) + y] == macouleur); ! x++, y++); if ((x != posx + 1) && (d[(x << 3) + y] == tacouleur)) { flag = TRUE ; --- 299,305 ---- for (x = posx + 1, y = posy + 1; (x < 7) && (y < 7) && (d[(x << 3) + y] == macouleur); ! x++, y++) continue ; if ((x != posx + 1) && (d[(x << 3) + y] == tacouleur)) { flag = TRUE ; *************** *** 304,310 **** for (x = posx - 1, y = posy + 1; (x > 0) && (y < 7) && (d[(x << 3) + y] == macouleur); ! x--, y++) ; if ((x != posx - 1) && (d[(x << 3) + y] == tacouleur)) { flag = TRUE ; --- 310,316 ---- for (x = posx - 1, y = posy + 1; (x > 0) && (y < 7) && (d[(x << 3) + y] == macouleur); ! x--, y++) continue ; if ((x != posx - 1) && (d[(x << 3) + y] == tacouleur)) { flag = TRUE ; *************** *** 315,321 **** for (x = posx + 1, y = posy - 1; (x < 7) && (y > 0) && (d[(x << 3) + y] == macouleur); ! x++, y--) ; if ((x != posx + 1) && (d[(x << 3) + y] == tacouleur)) { flag = TRUE ; --- 321,327 ---- for (x = posx + 1, y = posy - 1; (x < 7) && (y > 0) && (d[(x << 3) + y] == macouleur); ! x++, y--) continue ; if ((x != posx + 1) && (d[(x << 3) + y] == tacouleur)) { flag = TRUE ; *************** *** 326,332 **** for (x = posx - 1, y = posy - 1; (x > 0) && (y > 0) && (d[(x << 3) + y] == macouleur) ; ! x--, y-- ) ; if ((x != posx - 1) && (d[(x << 3) + y] == tacouleur)) { flag = TRUE ; --- 332,338 ---- for (x = posx - 1, y = posy - 1; (x > 0) && (y > 0) && (d[(x << 3) + y] == macouleur) ; ! x--, y-- ) continue ; if ((x != posx - 1) && (d[(x << 3) + y] == tacouleur)) { flag = TRUE ; *************** *** 341,360 **** } ! tujouesen(px, py, niv) ! int px, py, niv ; { register int *d ; ! register int x, y, posx, posy, pos8x ; - posx = px ; - posy = py ; - pos8x = posx << 3 ; d = damier[niv] ; d[pos8x + posy] = tacouleur ; ! for (x = posx + 1; (x < 7) && (d[(x << 3) + posy] == macouleur); x++) ; if ((x != posx + 1) && (d[(x << 3) + posy] == tacouleur)) { for (x = posx + 1; d[(x << 3) + posy] == macouleur; x++) --- 347,364 ---- } ! tujouesen(posx, posy, niv) ! int posx, posy, niv ; { register int *d ; ! register int x, y, pos8x ; pos8x = posx << 3 ; d = damier[niv] ; d[pos8x + posy] = tacouleur ; ! for (x = posx + 1; ! (x < 7) && (d[(x << 3) + posy] == macouleur); x++) continue ; if ((x != posx + 1) && (d[(x << 3) + posy] == tacouleur)) { for (x = posx + 1; d[(x << 3) + posy] == macouleur; x++) *************** *** 361,367 **** d[(x << 3) + posy] = tacouleur ; } ! for (x = posx - 1; (x > 0) && (d[(x << 3) + posy] == macouleur); x--) ; if ((x != posx - 1) && (d[(x << 3) + posy] == tacouleur)) { for (x = posx - 1; d[(x << 3) + posy] == macouleur; x--) --- 365,372 ---- d[(x << 3) + posy] = tacouleur ; } ! for (x = posx - 1; ! (x > 0) && (d[(x << 3) + posy] == macouleur); x--) continue ; if ((x != posx - 1) && (d[(x << 3) + posy] == tacouleur)) { for (x = posx - 1; d[(x << 3) + posy] == macouleur; x--) *************** *** 368,374 **** d[(x << 3) + posy] = tacouleur ; } ! for (y = posy + 1; (y < 7) && (d[pos8x + y] == macouleur); y++) ; if ((y != posy + 1) && (d[pos8x + y] == tacouleur)) { for (y = posy + 1; d[pos8x + y] == macouleur; y++) --- 373,380 ---- d[(x << 3) + posy] = tacouleur ; } ! for (y = posy + 1; ! (y < 7) && (d[pos8x + y] == macouleur); y++) continue ; if ((y != posy + 1) && (d[pos8x + y] == tacouleur)) { for (y = posy + 1; d[pos8x + y] == macouleur; y++) *************** *** 375,381 **** d[pos8x + y] = tacouleur ; } ! for (y = posy - 1; (y > 0) && (d[pos8x + y] == macouleur); y--) ; if ((y != posy - 1) && (d[pos8x + y] == tacouleur)) { for (y = posy - 1; d[pos8x + y] == macouleur; y--) --- 381,388 ---- d[pos8x + y] = tacouleur ; } ! for (y = posy - 1; ! (y > 0) && (d[pos8x + y] == macouleur); y--) continue ; if ((y != posy - 1) && (d[pos8x + y] == tacouleur)) { for (y = posy - 1; d[pos8x + y] == macouleur; y--) *************** *** 384,390 **** for (x = posx + 1, y = posy + 1; (x < 7) && (y < 7) && (d[(x << 3) + y] == macouleur); ! x++, y++) ; if ((x != posx + 1) && (d[(x << 3) + y] == tacouleur)) { for (x = posx + 1, y = posy + 1; d[(x << 3) + y] == macouleur; x++, y++) --- 391,397 ---- for (x = posx + 1, y = posy + 1; (x < 7) && (y < 7) && (d[(x << 3) + y] == macouleur); ! x++, y++) continue ; if ((x != posx + 1) && (d[(x << 3) + y] == tacouleur)) { for (x = posx + 1, y = posy + 1; d[(x << 3) + y] == macouleur; x++, y++) *************** *** 393,399 **** for (x = posx - 1, y = posy + 1; (x > 0) && (y < 7) && (d[(x << 3) + y] == macouleur); ! x--, y++) ; if ((x != posx - 1) && (d[(x << 3) + y] == tacouleur)) { for (x = posx - 1, y = posy + 1; d[(x << 3) + y] == macouleur; x--, y++) --- 400,406 ---- for (x = posx - 1, y = posy + 1; (x > 0) && (y < 7) && (d[(x << 3) + y] == macouleur); ! x--, y++) continue ; if ((x != posx - 1) && (d[(x << 3) + y] == tacouleur)) { for (x = posx - 1, y = posy + 1; d[(x << 3) + y] == macouleur; x--, y++) *************** *** 402,408 **** for (x = posx + 1, y = posy - 1; (x < 7) && (y > 0) && (d[(x << 3) + y] == macouleur); ! x++, y--) ; if ((x != posx + 1) && (d[(x << 3) + y] == tacouleur)) { for (x = posx + 1, y = posy - 1; d[(x << 3) + y] == macouleur; x++, y--) --- 409,415 ---- for (x = posx + 1, y = posy - 1; (x < 7) && (y > 0) && (d[(x << 3) + y] == macouleur); ! x++, y--) continue ; if ((x != posx + 1) && (d[(x << 3) + y] == tacouleur)) { for (x = posx + 1, y = posy - 1; d[(x << 3) + y] == macouleur; x++, y--) *************** *** 411,417 **** for (x = posx - 1, y = posy - 1; (x > 0) && (y > 0) && (d[(x << 3) + y] == macouleur); ! x--, y--) ; if ((x != posx - 1) && (d[(x << 3) + y] == tacouleur)) { for (x = posx - 1, y = posy - 1; d[(x << 3) + y] == macouleur; x--, y--) --- 418,424 ---- for (x = posx - 1, y = posy - 1; (x > 0) && (y > 0) && (d[(x << 3) + y] == macouleur); ! x--, y--) continue ; if ((x != posx - 1) && (d[(x << 3) + y] == tacouleur)) { for (x = posx - 1, y = posy - 1; d[(x << 3) + y] == macouleur; x--, y--)