richb@sunaus.oz (Rich Burridge) (12/10/90)
------CUT HERE------ patch3 - part6 ------CUT HERE------ ------- main.c ------- *** /tmp/da07594 Sun Dec 9 15:14:38 1990 --- main.c Sat Dec 8 19:41:09 1990 *************** *** 25,37 **** #include "reve.h" #include "color.h" #include "patchlevel.h" ! #ifdef SYSV ! #include <string.h> ! #include <sys/times.h> ! #else ! #include <strings.h> ! #include <sys/time.h> ! #endif /*SYSV*/ #ifdef X11 #include <X11/Xos.h> --- 25,31 ---- #include "reve.h" #include "color.h" #include "patchlevel.h" ! #include <ctype.h> #ifdef X11 #include <X11/Xos.h> *************** *** 45,58 **** #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 } ; char *player_values[] = { "human", "computer", NULL } ; enum cantype cmode, last_cmode ; enum disp_type dtype ; enum dpy_type cur_dpyno ; enum set_type direction ; /* Incremental direction for cycle item. */ int tx, ty, tw, th ; /* Position and size of text field. */ --- 39,65 ---- #endif /*NO_TIMEVAL*/ /* Text values for the cyclic buttons. */ ! char *comp_plays[] = { "white", "black", "neither", "both" } ; ! char *diff_values[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL } ; ! char *notes_values[] = { "off", "on", NULL } ; char *player_values[] = { "human", "computer", NULL } ; + char *resources[] = { /* Reve X resources read. */ + "animate", /* Boolean: show animation. */ + "bestmove", /* Boolean: show computer best move so far. */ + "difficulty", /* Integer: difficulty level. */ + "last", /* Boolean: show last move (with a square). */ + "log", /* Boolean: write computer info to log file. */ + "notes", /* Boolean: show computer notes. */ + "number", /* Boolean: show last move (number on stone). */ + "quick" /* Boolean: play quick game (don't flip stones). */ + } ; + enum cantype cmode, last_cmode ; enum disp_type dtype ; enum dpy_type cur_dpyno ; enum set_type direction ; /* Incremental direction for cycle item. */ + enum win_type curwin ; /* Window the current event for in. */ int tx, ty, tw, th ; /* Position and size of text field. */ *************** *** 59,75 **** 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. */ 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. */ --- 66,79 ---- int piece_x ; /* Current X position of moving piece. */ int piece_y ; /* Current Y position of moving piece */ 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 cmove_depth ; /* Depth of the current best computer move. */ int color ; /* Current color value. */ int cur_ch ; /* Current character pressed. */ int curx ; /* Current mouse X position. */ int cury ; /* Current mouse Y position. */ 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. */ *************** *** 94,103 **** 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. */ int suggest_y ; /* Y position of suggested move. */ --- 98,107 ---- 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 processing ; /* If set, computer is procesing a move. */ ! int props_showing ; /* If set, the property window is visible. */ int saveres = 0 ; /* If set, save computer results to log file. */ int show_moves ; /* If set, all possible moves are being shown. */ int suggestion = -1 ; /* Positive if a suggested move. */ int suggest_x ; /* X position of suggested move. */ int suggest_y ; /* Y position of suggested move. */ *************** *** 127,186 **** BOARD moves[64] ; /* Complete array of board moves. */ ! struct iteminfo items[MAXITEMS] = { /* Panel items. */ ! /* type x y width height text value function */ ! { P_BUTTON, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "load", 0, draw_textfield }, ! { P_BUTTON, BBORDER + (1*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "moves?", 0, show_all_moves }, ! { P_BUTTON, BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "new game", 0, new_game }, ! { P_BUTTON, BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "save", 0, draw_textfield }, ! { P_BUTTON, BBORDER + (4*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "suggest", 0, suggest }, ! { P_BUTTON, BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), ! 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 }, ! { P_BUTTON, BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "quit", 0, quit }, ! { P_CYCLE, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)), ! CWIDTH, CHEIGHT, "Black:", 0, init_player }, ! { P_CYCLE, BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)), ! CWIDTH, CHEIGHT, "White:", 1, init_player }, ! { P_CYCLE, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (3*(BHEIGHT+BGAP)), ! CWIDTH, CHEIGHT, "Difficulty:", INIT_DEPTH, difficulty }, ! { P_CYCLE, BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (3*(BHEIGHT+BGAP)), ! CWIDTH, CHEIGHT, "Notes:", FALSE, init_notes }, ! { 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 }, } ; char geometry[MAXDPY][MAXLINE] ; /* X11 geometry information. */ --- 131,376 ---- BOARD moves[64] ; /* Complete array of board moves. */ ! struct iteminfo items[MAXITEMS] = { /* Panel items. */ ! /* wtype type lx ly Main window items. ! * label ! * x y ! * width height text value ! * options nopts ! * function ! */ ! { /* load button. */ ! W_MAIN, P_BUTTON, 0, 0, ! "", ! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "load", 0, ! (char **) NULL, 0, ! draw_textfield ! }, ! { /* moves? button. */ ! W_MAIN, P_BUTTON, 0, 0, ! "", ! BBORDER + (1*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "moves?", 0, ! (char **) NULL, 0, ! show_all_moves ! }, ! { /* new game button. */ ! W_MAIN, P_BUTTON, 0, 0, ! "", ! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "new game", 0, ! (char **) NULL, 0, ! new_game ! }, ! { /* save button. */ ! W_MAIN, P_BUTTON, 0, 0, ! "", ! BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "save", 0, ! (char **) NULL, 0, ! draw_textfield ! }, ! ! { /* suggest button. */ ! W_MAIN, P_BUTTON, 0, 0, ! "", ! BBORDER + (4*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "suggest", 0, ! (char **) NULL, 0, ! suggest ! }, ! ! { /* undo button. */ ! W_MAIN, P_BUTTON, 0, 0, ! "", ! BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "undo", 0, ! (char **) NULL, 0, ! undo ! }, ! ! { /* props button. */ ! W_MAIN, P_BUTTON, 0, 0, ! "", ! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "props", 0, ! (char **) NULL, 0, ! do_props ! }, ! { /* cancel button. */ ! W_MAIN, P_BUTTON, 0, 0, ! "", ! -1, -1, /* Not normally active. */ ! BWIDTH, BHEIGHT, "cancel", 0, ! (char **) NULL, 0, ! remove_textfield ! }, ! ! { /* quit button. */ ! W_MAIN, P_BUTTON, 0, 0, ! "", ! BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), ! BWIDTH, BHEIGHT, "quit", 0, ! (char **) NULL, 0, ! quit ! }, ! ! { /* Black player message item. */ ! W_MAIN, P_MESSAGE, ! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)), ! "Black:", ! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)), ! CWIDTH, CHEIGHT, "", 0, ! (char **) NULL, 0, ! NULL ! }, ! ! { /* White player message item. */ ! W_MAIN, P_MESSAGE, ! BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)), ! "White:", ! BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)), ! CWIDTH, CHEIGHT, "", 1, ! (char **) NULL, 0, ! NULL ! }, ! { /* Panel message item. */ ! W_MAIN, P_MESSAGE, 0, 0, ! "", ! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (3*(BHEIGHT+BGAP)), ! 0, 0, "Use left mouse button to move", 0, ! (char **) NULL, 0, ! NULL ! }, ! { /* Notes message item. */ ! W_MAIN, P_MESSAGE, 0, 0, ! "", ! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (4*(BHEIGHT+BGAP)), ! 0, 0, "", 0, ! (char **) NULL, 0, ! NULL ! }, ! { /* Score message item. */ ! W_MAIN, P_MESSAGE, 0, 0, ! "", ! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (5*(BHEIGHT+BGAP)), ! 0, 0, "White: 2, Black: 2", 0, ! (char **) NULL, 0, ! NULL ! }, ! { /* Turn message item. */ ! W_MAIN, P_MESSAGE, 0, 0, ! "", ! BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (5*(BHEIGHT+BGAP)), ! 0, 0, "", 0, ! (char **) NULL, 0, ! NULL ! }, ! /* wtype type Property window items. ! * lx ly ! * label ! * x y ! * width height text value ! * options nopts ! * function ! */ ! { /* Computer plays choice item. */ ! W_PROPS, P_CHOICE, ! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), ! "Computer plays:", ! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), ! 0, 0, "", 0, ! (char **) comp_plays, 4, ! set_option ! }, ! { /* Difficulty choice item. */ ! W_PROPS, P_CHOICE, ! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), ! "Difficulty:", ! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), ! 0, 0, "", 0, ! (char **) diff_values, 9, ! set_option ! }, ! { /* Set search depth cycle item. */ ! W_PROPS, P_CYCLE, ! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)), ! "Set search depth:", ! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)), ! 0, 0, "", INIT_DEPTH, ! (char **) NULL, 0, ! set_option ! }, ! { /* Options (Animate Move) item. */ ! W_PROPS, P_TOGGLE, ! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (3*(BHEIGHT+BGAP)), ! "Options:", ! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (3*(BHEIGHT+BGAP)), ! TICKWIDTH, TICKHEIGHT, "Animate Move", 0, ! (char **) NULL, 0, ! set_option ! }, ! { /* Options (Show Current Best Move) item. */ ! W_PROPS, P_TOGGLE, 0, 0, ! "", ! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (4*(BHEIGHT+BGAP)), ! TICKWIDTH, TICKHEIGHT, "Show Current Best Move", 0, ! (char **) NULL, 0, ! set_option ! }, ! { /* Options (Show Last Move) item. */ ! W_PROPS, P_TOGGLE, 0, 0, ! "", ! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (5*(BHEIGHT+BGAP)), ! TICKWIDTH, TICKHEIGHT, "Show Last Move", 0, ! (char **) NULL, 0, ! set_option ! }, ! { /* Options (Show Evaluation Info.) item. */ ! W_PROPS, P_TOGGLE, 0, 0, ! "", ! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (6*(BHEIGHT+BGAP)), ! TICKWIDTH, TICKHEIGHT, "Show Evaluation Info.", 0, ! (char **) NULL, 0, ! set_option ! }, ! ! { /* Options (Number Last Move) item. */ ! W_PROPS, P_TOGGLE, 0, 0, ! "", ! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (7*(BHEIGHT+BGAP)), ! TICKWIDTH, TICKHEIGHT, "Number Last Move", 0, ! (char **) NULL, 0, ! set_option ! }, ! ! { /* Options (Don't Show Flip) item. */ ! W_PROPS, P_TOGGLE, 0, 0, ! "", ! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (8*(BHEIGHT+BGAP)), ! TICKWIDTH, TICKHEIGHT, "Don't Show Flip", 0, ! (char **) NULL, 0, ! set_option ! }, } ; char geometry[MAXDPY][MAXLINE] ; /* X11 geometry information. */ *************** *** 197,202 **** --- 387,393 ---- int damier[NIVEAUMAX][64] ; /* Boards at different depth level */ int tacouleur, macouleur ; /* Your and my colors during evaluation */ int mnb, profmax ; /* Number of moves played, current max. depth */ + int max_depth = 2 ; /* Computer strategy - maximum depth. */ int vp0, vo0 ; /* Current mobility components */ long c1, c2, c3 ; /* Constants used in evaluation function */ long edges[6561] ; /* Edges Stability Table */ *************** *** 213,221 **** --- 404,419 ---- STRCPY(progname, argv[0]) ; /* Save program name for later use. */ STRCPY(gamefile, "reve.game") ; SPRINTF(line, " Reve. V1.1.%1d", PATCHLEVEL) ; + init_graphics(&argc, argv) ; initialise() ; /* Initialise variables used by reve. */ + load_resources() ; /* Get resources from various places. */ + read_resources() ; /* Read resources from merged database. */ get_options(argc, argv) ; /* Read command line options. */ + + #ifndef XVIEW init_edge_table(edgefile) ; /* Load reve edge table values. */ + #endif /*XVIEW*/ + set_display_types() ; /* Work out what displays to initialise. */ if (init_ws_type()) /* Determine window system type. */ { *************** *** 231,236 **** --- 429,448 ---- void + do_computer_move(player) + int player ; + { + 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) ; + } + + + void generate_graphics(argc, argv, dpyno) enum dpy_type dpyno ; int argc ; *************** *** 241,255 **** make_frame(argc, argv) ; /* Create reve window/icon. */ make_canvas() ; /* Create drawing canvas. */ init_fonts() ; /* Load normal and bold fonts. */ - create_menu(BLACK_PLAYS, player_values) ; - create_menu(WHITE_PLAYS, player_values) ; - create_menu(DIFFICULTY, diff_values) ; - create_menu(NOTES, notes_values) ; initboard() ; set_cursor(CANVASCUR) ; } void get_options(argc, argv) /* Read and process command line options. */ int argc ; --- 453,492 ---- make_frame(argc, argv) ; /* Create reve window/icon. */ make_canvas() ; /* Create drawing canvas. */ init_fonts() ; /* Load normal and bold fonts. */ initboard() ; set_cursor(CANVASCUR) ; } + get_bool_resource(rtype, boolval) /* Get boolean resource from the server. */ + enum res_type rtype ; + int *boolval ; + { + char *val, tempstr[MAXLINE] ; + int n ; + + if ((val = get_resource(rtype)) == NULL) return(0) ; + STRCPY(tempstr, val) ; + for (n = 0; n < strlen(tempstr); n++) + if (isupper(tempstr[n])) tempstr[n] = tolower(tempstr[n]) ; + if (EQUAL(tempstr, "true")) *boolval = TRUE ; + else *boolval = FALSE ; + return(1) ; + } + + + get_int_resource(rtype, intval) /* Get integer resource from the server. */ + enum res_type rtype ; + int *intval ; + { + char *val ; + + if ((val = get_resource(rtype)) == NULL) return(0) ; + *intval = atoi(val) ; + return(1) ; + } + + void get_options(argc, argv) /* Read and process command line options. */ int argc ; *************** *** 265,273 **** 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 ; --- 502,510 ---- 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 ; *************** *** 284,290 **** getparam(next, argv, "-d needs difficulty") ; level = atoi(next) ; if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ; ! items[(int) DIFFICULTY].value = level - 1 ; break ; case 'e' : INC ; getparam(edgefile, argv, "-e needs an edgetable file") ; --- 521,527 ---- getparam(next, argv, "-d needs difficulty") ; level = atoi(next) ; if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ; ! items[(int) DIFF_CHOICE].value = level - 1 ; break ; case 'e' : INC ; getparam(edgefile, argv, "-e needs an edgetable file") ; *************** *** 295,301 **** 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. */ --- 532,539 ---- 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], "-log")) saveres = TRUE ; else if (EQUAL(argv[0], "-load")) { INC ; /* Reve game file to load. */ *************** *** 306,322 **** 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() ; --- 544,554 ---- 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 ; ! else if (EQUAL(argv[0], "-number")) DO_NUMBER = TRUE ; break ; ! case 'q' : if (EQUAL(argv[0], "-quick")) QUICKGAME = TRUE ; break ; case '?' : case 'v' : usage() ; *************** *** 387,392 **** --- 619,636 ---- } + get_str_resource(rtype, strval) /* Get a string resource from the server. */ + enum res_type rtype ; + char *strval ; + { + char *val ; + + if ((val = get_resource(rtype)) == NULL) return(0) ; + STRCPY(strval, val) ; + return(1) ; + } + + void getparam(s, argv, errmes) char *s, *argv[], *errmes ; *************** *** 407,418 **** int adjust, d, i, n, x, y ; d = (int) cur_dpyno ; ! color_area(0, 0, TOTAL_WIDTH, TOTAL_HEIGHT, C_WHITE) ; if (iscolor[d]) { ! color_area(0, 0, TOTAL_WIDTH, CY, C_BEIGE) ; ! color_area(0, CY, TOTAL_WIDTH, TOTAL_WIDTH, C_DBROWN) ; ! color_area(0 + BBORDER, CY + BBORDER, BOARD_SIZE * CELL_SIZE, BOARD_SIZE * CELL_SIZE, C_LBROWN) ; } make_panel() ; /* Create panel and panel items. */ --- 651,662 ---- int adjust, d, i, n, x, y ; d = (int) cur_dpyno ; ! color_area(W_MAIN, 0, 0, TOTAL_WIDTH, TOTAL_HEIGHT, C_WHITE) ; if (iscolor[d]) { ! color_area(W_MAIN, 0, 0, TOTAL_WIDTH, CY, C_BEIGE) ; ! color_area(W_MAIN, 0, CY, TOTAL_WIDTH, TOTAL_WIDTH, C_DBROWN) ; ! color_area(W_MAIN, 0 + BBORDER, CY + BBORDER, BOARD_SIZE * CELL_SIZE, BOARD_SIZE * CELL_SIZE, C_LBROWN) ; } make_panel() ; /* Create panel and panel items. */ *************** *** 426,435 **** if (n == 0 || n == BOARD_SIZE) color = C_BLACK ; if (color == C_LGREY) adjust = 1 ; else adjust = 0 ; ! draw_line((n*CELL_SIZE)+BBORDER, CY+BBORDER+adjust, /* Vertical. */ ! (n*CELL_SIZE)+BBORDER, CY+BBORDER+(BOARD_SIZE*CELL_SIZE)-adjust, RSRC, color) ; ! draw_line(BBORDER+adjust, CY+BBORDER+(n*CELL_SIZE), /* Horizontal. */ BBORDER+(BOARD_SIZE*CELL_SIZE)-adjust, CY+BBORDER+(n*CELL_SIZE), RSRC, color) ; } --- 670,680 ---- if (n == 0 || n == BOARD_SIZE) color = C_BLACK ; if (color == C_LGREY) adjust = 1 ; else adjust = 0 ; ! draw_line(W_MAIN, (n*CELL_SIZE)+BBORDER, /* Vertical. */ ! CY+BBORDER+adjust, (n*CELL_SIZE)+BBORDER, CY+BBORDER+(BOARD_SIZE*CELL_SIZE)-adjust, RSRC, color) ; ! draw_line(W_MAIN, BBORDER+adjust, /* Horizontal. */ ! CY+BBORDER+(n*CELL_SIZE), BBORDER+(BOARD_SIZE*CELL_SIZE)-adjust, CY+BBORDER+(n*CELL_SIZE), RSRC, color) ; } *************** *** 439,460 **** { color = (iscolor[d]) ? C_WHITE : C_BLACK ; SPRINTF(s1, "%c", 'a' + i) ; ! draw_text(BBORDER + (i * CELL_SIZE) + (CELL_SIZE / 2) - 2, CY + BBORDER - 4, BFONT, color, s1) ; ! draw_text(BBORDER + (i * CELL_SIZE) + (CELL_SIZE / 2) - 2, CY + (2 * BBORDER) + (BOARD_SIZE * CELL_SIZE) - 4, BFONT, color, s1) ; SPRINTF(sa, "%c", '1' + i) ; ! draw_text(BBORDER / 2 - 2, CY + BBORDER + (i * CELL_SIZE) + (CELL_SIZE / 2) + 2, BFONT, color, sa) ; ! draw_text(BBORDER + (BOARD_SIZE * CELL_SIZE) + (BBORDER / 2) - 2, CY + BBORDER + (i * CELL_SIZE) + (CELL_SIZE / 2) + 2, BFONT, color, sa) ; } batch(IS_OFF) ; - show_last(last_move, IS_ON) ; - show_number(last_move, IS_ON) ; - show_suggestion() ; batch(IS_ON) ; FOR_BOARD(i) if (board.square[i]) --- 684,702 ---- { color = (iscolor[d]) ? C_WHITE : C_BLACK ; SPRINTF(s1, "%c", 'a' + i) ; ! draw_text(W_MAIN, BBORDER + (i * CELL_SIZE) + (CELL_SIZE / 2) - 2, CY + BBORDER - 4, BFONT, color, s1) ; ! draw_text(W_MAIN, BBORDER + (i * CELL_SIZE) + (CELL_SIZE / 2) - 2, CY + (2 * BBORDER) + (BOARD_SIZE * CELL_SIZE) - 4, BFONT, color, s1) ; SPRINTF(sa, "%c", '1' + i) ; ! draw_text(W_MAIN, BBORDER / 2 - 2, CY + BBORDER + (i * CELL_SIZE) + (CELL_SIZE / 2) + 2, BFONT, color, sa) ; ! draw_text(W_MAIN, BBORDER + (BOARD_SIZE * CELL_SIZE) + (BBORDER / 2) - 2, CY + BBORDER + (i * CELL_SIZE) + (CELL_SIZE / 2) + 2, BFONT, color, sa) ; } batch(IS_OFF) ; batch(IS_ON) ; FOR_BOARD(i) if (board.square[i]) *************** *** 462,470 **** get_xy(i, &x, &y) ; draw_piece(board.square[i], x, CY+y, RSRC) ; } ! batch(IS_OFF) ; set_score() ; message(TURN_MES, "Black to move.") ; if (loadgame) { --- 704,715 ---- get_xy(i, &x, &y) ; draw_piece(board.square[i], x, CY+y, RSRC) ; } ! if (DO_LAST) show_last(last_move, IS_ON) ; ! if (DO_NUMBER) show_number(last_move, 60 - board.moves_left, IS_ON) ; ! show_suggestion() ; set_score() ; message(TURN_MES, "Black to move.") ; + batch(IS_OFF) ; if (loadgame) { *************** *** 490,510 **** 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 ; level = INIT_DEPTH ; ! items[(int) DIFFICULTY].value = level - 1 ; black_dpy = NULL ; /* X11 black piece display information. */ white_dpy = NULL ; /* X11 white piece display information. */ --- 735,757 ---- 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 ; ! processing = FALSE ; /* No computer move initially. */ ! props_showing = FALSE ; ! QUICKGAME = FALSE ; validkey = 0 ; cmode = BLACK_START ; show_moves = FALSE ; ! SHOW_NOTES = FALSE ; isblack = 0 ; iswhite = 0 ; level = INIT_DEPTH ; ! items[(int) DIFF_CHOICE].value = level - 1 ; black_dpy = NULL ; /* X11 black piece display information. */ white_dpy = NULL ; /* X11 white piece display information. */ *************** *** 515,572 **** void ! init_edge_table(edgefile) /* Load reve edge table values. */ ! char *edgefile ; { ! char buf[MAXLINE], *getenv(), name[MAXLINE], *paths, *ptr ; ! int i, line ; ! FILE *fp = NULL ; ! i = 0 ; ! if ((fp = fopen(edgefile, "r")) == NULL) ! { ! paths = getenv("PATH") ; ! if ((ptr = paths) && edgefile[0] != '/') ! for (;;) ! if (*ptr == ':' || *ptr == 0) ! { ! if (*ptr == 0) break ; ! name[i++] = '/' ; ! name[i] = 0 ; ! STRCAT(name, edgefile) ; ! if ((fp = fopen(name, "r")) != NULL) break ; ! if (*ptr == '\0') break ; ! ptr++ ; ! i = 0 ; ! } ! else name[i++] = *ptr++ ; ! } ! if (fp == NULL) { ! FPRINTF(stderr, "Cannot open Edge Stability Table file\n") ; ! exit(1) ; } ! line = 0 ; ! while (fgets(buf, MAXLINE, fp) != NULL) ! { ! line++ ; ! if (buf[0] == '\n' || buf[0] == '#') continue ; ! if ((ptr = index(buf, '[')) == NULL) ! { ! FPRINTF(stderr, "Cannot read edge table file at line %d\n", line) ; ! exit(1) ; ! } ! SSCANF(ptr+1, "%d", &i) ; ! if ((ptr = index(buf, '=')) == NULL) ! { ! FPRINTF(stderr, "Cannot read edge table file at line %d\n", line) ; ! exit(1) ; ! } ! SSCANF(ptr+1, "%ld", &edges[i]) ; ! } ! FCLOSE(fp) ; ! for (i = 0 ; i < 3281; i++) edges[6560 - i] = - edges[i] ; } --- 762,786 ---- void ! read_resources() /* Read all possible resources from database. */ { ! int boolval, intval ; ! if (get_bool_resource(R_ANIMATE, &boolval)) ANIMATION = boolval ; ! if (get_bool_resource(R_BESTMOVE, &boolval)) DO_BESTMOVE = boolval ; ! if (get_int_resource(R_DIFFICULTY, &intval)) { ! level = intval ; ! if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ; ! items[(int) DIFF_CHOICE].value = level - 1 ; } ! ! if (get_bool_resource(R_LAST, &boolval)) DO_LAST = boolval ; ! if (get_bool_resource(R_LOG, &boolval)) saveres = boolval ; ! if (get_bool_resource(R_NOTES, &boolval)) SHOW_NOTES = boolval ; ! if (get_bool_resource(R_NUMBER, &boolval)) DO_NUMBER = boolval ; ! if (get_bool_resource(R_QUICK, &boolval)) QUICKGAME = boolval ; } *************** *** 593,598 **** --- 807,814 ---- void set_display_types() { + int val ; + if (isblack && iswhite) play_computer = 0 ; if (isblack && iswhite) dtype = XBOTH ; else if (isblack) dtype = XBLACK ; *************** *** 625,632 **** if (dtype == XBLACK) isblack = 1 ; else if (dtype == XWHITE) iswhite = first_move = 1 ; else if (dtype == XTWO || dtype == XBOTH) isblack = iswhite = 1 ; ! items[(int) BLACK_PLAYS].value = (isblack == 0) ; ! items[(int) WHITE_PLAYS].value = (iswhite == 0) ; } --- 841,854 ---- if (dtype == XBLACK) isblack = 1 ; else if (dtype == XWHITE) iswhite = first_move = 1 ; else if (dtype == XTWO || dtype == XBOTH) isblack = iswhite = 1 ; ! ! val = (isblack == 0) ; ! items[(int) BLACK_PLAYS].value = val ; ! STRCPY(items[(int) BLACK_PLAYS].text, player_values[val]) ; ! ! val = (iswhite == 0) ; ! items[(int) WHITE_PLAYS].value = val ; ! STRCPY(items[(int) WHITE_PLAYS].text, player_values[val]) ; } *************** *** 638,651 **** 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) ; } --- 860,871 ---- move = TRUE ; /* Make sure the computer clock is decremented. */ best_cmove = -1 ; message(EVAL_MES, "") ; + #ifdef XVIEW + write_to_reve(M_MOVE, board.square, player, level, &move, ¬e) ; + #else play_reve(board.square, player, level, &move, ¬e) ; ! do_computer_move(player) ; ! #endif /*XVIEW*/ } ------- procs.c ------- *** /tmp/da07597 Sun Dec 9 15:14:39 1990 --- procs.c Sat Dec 8 19:41:37 1990 *************** *** 29,37 **** void ! difficulty() { ! level = next_setting(DIFFICULTY, diff_values) + 1 ; } --- 29,39 ---- void ! do_props() { ! props_showing = !props_showing ; ! if (props_showing == TRUE) open_frame(W_PROPS) ; ! else close_frame(W_PROPS) ; } *************** *** 48,60 **** 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 ; --- 50,62 ---- 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 ; *************** *** 64,126 **** void ! done() { ! iconic = 1 ; ! close_frame() ; ! } ! ! void ! init_notes() ! { ! show_notes = next_setting(NOTES, notes_values) ; ! if (show_notes == FALSE) message(EVAL_MES, "") ; ! } ! ! ! void ! init_player() ! { ! enum panel_type item, other ; ! int curi, curo ; ! ! /* XXX: Currently computer vs computer is not implemented, because of the ! * inability to break out of it, once started, with some of the ! * graphics versions. If the user has asked for this, then force it ! * to toggle the other player, so this situation can't happen. ! */ ! ! if (curx < (BBORDER + (3*(BWIDTH+BGAP)))) { ! item = BLACK_PLAYS ; ! other = WHITE_PLAYS ; } - else - { - item = WHITE_PLAYS ; - other = BLACK_PLAYS ; - } - curo = items[(int) other].value ; - curi = next_setting(item, player_values) ; - if (curi == COMPUTER && curo == COMPUTER) - { - curi = HUMAN ; - set_cycle(item, player_values[curi]) ; - items[(int) item].value = curi ; - message(PANEL_MES, "Computer can't play both players.") ; - } - if (curi == HUMAN && curo == COMPUTER) - dtype = (item == BLACK_PLAYS) ? XBLACK : XWHITE ; - else if (curi == COMPUTER && curo == HUMAN) - dtype = (item == BLACK_PLAYS) ? XWHITE : XBLACK ; - else if (curi == HUMAN && curo == HUMAN) - dtype = (dtype == XTWO) ? XTWO : XBOTH ; ! if (curi == COMPUTER) ! if ((item == BLACK_PLAYS && cmode == BLACK_START) || ! (item == WHITE_PLAYS && cmode == WHITE_START)) ! computer_move(next_player) ; } --- 66,95 ---- void ! do_suggest(player, suggestion, note, state) ! int player, suggestion, note ; ! enum bltype state ; { ! set_cursor(CANVASCUR) ; ! if (suggestion == -1) return ; ! if (best_cmove != -1 && DO_BESTMOVE == TRUE) { ! draw_square(best_cmove, IS_OFF, 2) ; ! if (DO_NUMBER) show_number(best_cmove, cmove_depth, IS_OFF) ; } ! suggest_x = BBORDER + ((suggestion & 7) + 1) * CELL_SIZE - CELL_SIZE / 2 ; ! suggest_y = BBORDER + ((suggestion >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ; ! if (state == IS_OFF) ! color = (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE ; ! else color = C_BLACK ; ! ! draw_line(W_MAIN, suggest_x-5, CY+suggest_y-5, ! suggest_x+5, CY+suggest_y+5, RSRC, color) ; ! draw_line(W_MAIN, suggest_x-5, CY+suggest_y+5, ! suggest_x+5, CY+suggest_y-5, RSRC, color) ; ! if (SHOW_NOTES && state == IS_ON) set_eval(player, suggestion, note) ; } *************** *** 160,199 **** init_canvas() ; message(EVAL_MES, "") ; message(PANEL_MES, "Use left mouse button to move") ; ! draw_button(NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ; } ! next_setting(item, choices) ! enum panel_type item ; ! char *choices[] ; { ! switch (direction) { ! case INCREMENT : if (choices[++item_value] != NULL) ! items[(int) item].value++ ; ! else items[(int) item].value = item_value = 0 ; ! break ; ! case DECREMENT : if (--item_value == -1) ! { ! while (choices[++item_value] != NULL) continue ; ! item_value-- ; ! items[(int) item].value = item_value ; ! } ! else items[(int) item].value-- ; ! break ; ! case NONE : /* Handled elsewhere. */ ; } ! set_cycle(item, choices[item_value]) ; ! return(items[(int) item].value) ; } void ! quit() { ! destroy_frame() ; ! exit(0) ; } --- 129,258 ---- init_canvas() ; message(EVAL_MES, "") ; message(PANEL_MES, "Use left mouse button to move") ; ! draw_button(W_MAIN, NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ; } ! void ! quit() { ! destroy_frame() ; ! exit(0) ; ! } ! ! ! void ! set_computer(val) ! int val ; ! { ! int color, curi ; ! ! if (val == CP_WHITE) { ! dtype = XBLACK ; ! play_computer = TRUE ; ! items[(int) BLACK_PLAYS].value = HUMAN ; ! STRCPY(items[(int) BLACK_PLAYS].text, player_values[HUMAN]) ; ! items[(int) WHITE_PLAYS].value = COMPUTER ; ! STRCPY(items[(int) WHITE_PLAYS].text, player_values[COMPUTER]) ; } ! else if (val == CP_BLACK) ! { ! dtype = XWHITE ; ! play_computer = TRUE ; ! items[(int) BLACK_PLAYS].value = COMPUTER ; ! STRCPY(items[(int) BLACK_PLAYS].text, player_values[COMPUTER]) ; ! items[(int) WHITE_PLAYS].value = HUMAN ; ! STRCPY(items[(int) WHITE_PLAYS].text, player_values[HUMAN]) ; ! } ! else if (val == CP_NEITHER) ! { ! dtype = XTWO ; ! play_computer = FALSE ; ! items[(int) BLACK_PLAYS].value = HUMAN ; ! STRCPY(items[(int) BLACK_PLAYS].text, player_values[HUMAN]) ; ! items[(int) WHITE_PLAYS].value = HUMAN ; ! STRCPY(items[(int) WHITE_PLAYS].text, player_values[HUMAN]) ; ! } ! ! color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ; ! draw_choice(W_PROPS, COMP_CHOICE, color) ; ! ! val = items[(int) BLACK_PLAYS].value ; ! val = items[(int) WHITE_PLAYS].value ; ! ! if (next_player == BLACK) curi = items[(int) BLACK_PLAYS].value ; ! else curi = items[(int) WHITE_PLAYS].value ; ! if (curi == COMPUTER) ! if ((next_player == BLACK && cmode == BLACK_START) || ! (next_player == WHITE && cmode == WHITE_START)) ! computer_move(next_player) ; } void ! set_option() { ! char str[4] ; ! int color, d, maxw, n, val ; ! ! d = (int) cur_dpyno ; ! switch (itemno) ! { ! case COMP_CHOICE : maxw = items[itemno].width / items[itemno].nopts ; ! val = (curx - items[itemno].x) / maxw ; ! if (val != CP_BOTH) ! { ! items[itemno].value = val ; ! set_computer(val) ; ! } ! else message(PANEL_MES, ! "Computer plays both is not implemented yet.") ; ! break ; ! ! case DIFF_CHOICE : maxw = items[itemno].width / items[itemno].nopts ; ! val = (curx - items[itemno].x) / maxw ; ! level = val + 1 ; ! items[itemno].value = val ; ! color = (iscolor[d]) ? C_BEIGE : C_WHITE ; ! draw_choice(W_PROPS, DIFF_CHOICE, color) ; ! break ; ! ! case MAX_DEPTH : val = items[itemno].value ; ! if (direction == INCREMENT && val < MAX_PROFMAX) ! items[itemno].value++ ; ! else if (direction == DECREMENT && val > INIT_DEPTH) ! items[itemno].value-- ; ! SPRINTF(str, "%d", items[itemno].value) ; ! color = (iscolor[d]) ? C_LGREY : C_WHITE ; ! set_cycle(W_PROPS, MAX_DEPTH, str) ; ! profmax = items[itemno].value ; ! level = 1 ; ! break ; ! ! case OPT_ANIM : ANIMATION = !ANIMATION ; ! break ; ! ! case OPT_BEST : DO_BESTMOVE = !DO_BESTMOVE ; ! break ; ! ! case OPT_LAST : DO_LAST = !DO_LAST ; ! n = 63 - board.moves_left ; ! show_last(moves[n].move, DO_LAST) ; ! break ; ! ! case OPT_EVAL : SHOW_NOTES = !SHOW_NOTES ; ! if (!SHOW_NOTES) message(EVAL_MES, "") ; ! break ; ! ! case OPT_NUM : DO_NUMBER = !DO_NUMBER ; ! n = 63 - board.moves_left ; ! show_number(moves[n].move, 60 - board.moves_left, ! DO_NUMBER, DO_NUMBER) ; ! break ; ! ! case OPT_FLIP : QUICKGAME = !QUICKGAME ; ! } } *************** *** 212,229 **** long note ; if (cmode == GAME_OVER) return ; if (cmode == WHITE_START) player = WHITE ; else player = BLACK ; suggestion = FALSE ; /* Make sure the computer clock isn't decremented. */ play_reve(&board.square[0], player, level, &suggestion, ¬e) ; ! ! suggest_x = BBORDER + ((suggestion & 7) + 1) * CELL_SIZE - CELL_SIZE / 2 ; ! suggest_y = BBORDER + ((suggestion >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ; ! draw_line(suggest_x-5, CY+suggest_y-5, ! 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) ; } --- 271,286 ---- long note ; if (cmode == GAME_OVER) return ; + set_cursor(HOURGLASS) ; if (cmode == WHITE_START) player = WHITE ; else player = BLACK ; suggestion = FALSE ; /* Make sure the computer clock isn't decremented. */ + #ifdef XVIEW + write_to_reve(M_SUGGESTION, board.square, player, level, &move, ¬e) ; + #else play_reve(&board.square[0], player, level, &suggestion, ¬e) ; ! do_suggest(player, suggestion, note, IS_ON) ; ! #endif /*XVIEW*/ } *************** *** 252,266 **** undo_move(player) int player ; { ! int i, n, x, y ; ! n = 62 - board.moves_left ; ! while (moves[n-1].player == player) n-- ; ! 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]) --- 309,325 ---- undo_move(player) int player ; { ! int i, limit, n, x, y ; ! n = 63 - board.moves_left ; ! while (moves[n].player != player) n-- ; ! limit = (items[(int) BLACK_PLAYS].value == COMPUTER) ? 4 : 3 ; ! if (n >= limit) { ! if (DO_LAST) show_last(last_move, IS_OFF) ; ! if (DO_NUMBER) show_number(last_move, 60 - board.moves_left, IS_OFF) ; ! do_suggest(player, suggestion, note, IS_OFF) ; FOR_BOARD(i) { if (moves[n].square[i] != board.square[i]) *************** *** 267,273 **** { 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) ; } --- 326,332 ---- { get_xy(i, &x, &y) ; if (moves[n].square[i] == FREE) ! color_area(W_MAIN, x, CY+y, PSIZE, PSIZE, (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE) ; else draw_piece(moves[n].square[i], x, CY+y, RSRC) ; } *************** *** 290,295 **** --- 349,358 ---- timeleft = board.timeleft ; + #ifdef XVIEW + reset_time(timeleft) ; + #endif /*XVIEW*/ + if (OPPONENT(player) == BLACK) cmode = BLACK_START ; else cmode = WHITE_START ; message(PANEL_MES, "") ; *************** *** 296,304 **** 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) ; --- 359,367 ---- if (n > 3) { ! if (DO_LAST) show_last(last_move, IS_ON) ; ! if (DO_NUMBER) show_number(last_move, 60 - board.moves_left, IS_ON) ; ! if (SHOW_NOTES) set_eval(board.player, board.move, board.note) ; } else message(EVAL_MES, "") ; next_player = OPPONENT(board.player) ;