richb@sunaus.oz (Rich Burridge) (12/10/90)
Just a couple of points before the patch: * Yves Galloty, the author of the computer strategy used in reve will be leaving his current job on 20th December, and going to a new job in France, which won't be so well connected to the net. We are going to get one more patch out before then. After that, any problems related to the computer strategy might take a lot longer to get fixed. * This patch is big. I've tried to test everything I've added, but with a patch of this size, I'm sure I've screwed something up. If it's not listed in the TODO file, could you please let me know, no matter how trivial you might think the problem is. /* * Official patch #3 for Reve v1.1. * * Copyright (C) 1990 - Rich Burridge & Yves Gallot. * All rights reserved. * * Permission is granted to copy this patch, for redistribution * in patch form only, provided the news headers in "substantially * unaltered format" are retained, the introductory messages are not * removed, and no monies are exchanged. * * Permission is also granted to copy this patch, without the news * headers, for the purposes of patching the Reve source and making * an executable copy by means of compilation, provided that such * copy will not be used for the purposes of competition in any othello * tournaments, without prior permission from the authors. */ CONTENTS: 1. What is reve? 2/ Changes made in this patch. 3/ How to install this patch. 4/ How to get previous patches. ---------------- 1/ What is reve? Reve is an othello game. It works under SunView, XView, X11 (Xlib) and on dumb tty terminals. Reve has nine levels of difficulty. Levels 1-3 should be useful to beginners, levels 4-6 would satisfy amateurs, and the higher levels will give experts a good game. Level 8 (30 minutes) is the tournament level. ---------------- 2/ Changes made in this patch. * Added a description of the -bestmove command line option to the manual pages. * If you were using the -last option, and the window was iconified, and there was only the initial four stones on the board, then opening Reve, would incorrectly show the "last" square. * If you were using the -number option, and the window was iconified, then when Reve was opened again, the number was not being displayed on the last stone. * The display of a single digit on a stone (with the -number option) was not centered correctly. * From Jonathan I. Kamens <jik@pit-manager.MIT.EDU> Problems with the Imakefile. The line that says "LIBDIR=$(USRLIBDIR)/reve" should be deleted, and both of the rules that say "$(LIBDIR)$(PATHSEP)reve" should actually say "$(USRLIBDIR)$(PATHSEP)reve". Also, the EDGENAMEFILE should be changed to $(USRLIBDIR)$(PATHSEP)reve$(PATHSEP)$(ETABLE) * Added in X resources support for the X11(Xlib) and XView versions. Currently, the resources read are: reve.animate: (boolean) show animation. reve.bestmove: (boolean) show computer best move so far. reve.difficulty: (integer) computer difficulty level. reve.last: (boolean) show last move (with a square). reve.log: (boolean) write computer info to log file. reve.notes: (boolean) show computer notes. reve.number: (boolean) show last move (number on stone). reve.quick: (boolean) play quick game (don't flip stones). * From Valerie Haecky <vmh@Eng.Sun.COM> Undo'ing is incorrect at the end game if the computer is playing black. * Need to allow options like -scale through on the command line. This can be done by have an init_graphics() routine that gets called right at the start, which strips off graphics specific options. * The hourglass/watch cursor is turned on, when the computer is suggesting a move. * If the bestmove option is on, and the computer suggested a move, the last bestmove square wasn't being removed. * From Valerie Haecky <vmh@Eng.Sun.COM> The show notes now also shows the current maximum depth for the computer move. * From Valerie Haecky <vmh@Eng.Sun.COM> Added to the README file, the address where people can get information about tournaments, Othello Quarterly, and "Othello Brief and Basic' * From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk> Because the default is now set not to show the last square, and notes is initially set off, I think that a status message such as 'Black has moved on square <c-5>' should be displayed, otherwise you've no idea where the computer moved. * Stones are numbered and the last square shown when a game is being loaded, if these settings are on. * From Valerie Haecky <vmh@Eng.Sun.COM> More work on the XView version. The control panel layout has been rearranged, and a property window added. The Help button has been removed from the control panel. Several options can now be set via the property sheet. A new difficulty value has been added; the ability to set a maximum computer search depth rather than the computer doing a timed move. * A new XView version has been created. This forks off a separate process to do the computer moves. This is to try to get around the server hanging problem. This still can happen, but not so frequently. Two new files have been created: common.c and reve_proc.c. The Makefile.dist, MANIFEST and FILES files have been updated. * From: robert@anucsd.anu.oz.au (Robert Cohen) It would be nice to have some idea of how far reve was looking ahead. So in the notes section for example you could report on the ply used to find the solution. If the bestmove option was set it could be shown dynamically as new solutions were found. * For the SunView and X11 versions the Done button has been replaced by a Props button. Clicking on this will toggle the display of a property window. The property window looks something like: Computer plays: White | Black | Neither | Both Difficulty: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Options: [ ] Animate Move [ ] Show Current Best Move [ ] Show Last Move [ ] Show Evaluation Info. [ ] Number Last Move [ ] Don't Show Flip This introduce two new type of "panel" item, the toggle item (P_TOGGLE) and the choice item (P_CHOICE). The cycle item has been removed. Selecting the Both field on the Computer plays: option, will display the message that this option is currently not implemented. The following changes have occured in the main reve window: The Black: and White: items are messages. The Difficulty: and Show Notes: items will disappear, freeing up a row. Setting the Computer plays: option, alters the Black: and White: options. The iteminfo structure will have five new fields: int lx ; /* X position of the label. */ int ly ; /* Y position of the label. */ char label[60] ; /* Panel item label. */ char *options ; /* Pointer to list of string choices. */ int nopts ; /* Number of options in list. */ Only certain fields are used with each type of panel "item". All items are initialised in main.c. Two new files have been added to the images directory: images/Sch_off.icon images/Sch_on.icon This solves the following problems: * From: robert@anucsd.anu.oz.au (Robert Cohen) It would be nice to be able to change all the program parameters from inside the game. For example being able to pull down a menu and turn the bestmove option on or off. * From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk> I, and most of the users here, use a combination of X11R4, twm and 1024 by 768 colour or mono displays. The new Reve window now exceeds the height of the screen minus the height of the twm title bar of the window! Hence the bottom of half of row 8 and the a to h labelling are no longer visible, even if the top of the twm title bar for the Reve window is at the top of the screen! * From Soren Hein <shein@ferdowsi.berkeley.edu> Why double switches for White, Black and Notes? Both halves of the switches do the same thing. * Incorporated a new version of the rev_eval.c evaluation fuction from Yves. There is also a complete new edge table to go with this. This should be faster on RISC systems. * XResourceManagerString, which is now used as part of the X resources support in the X11 and XView versions, appears to be an X11R4 functions. If you are trying to get the X11 version working with X11R3, then there is a new definition in the Makefile[.dist] file that you'll have to uncomment. The README file has been updated to mention this. * From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk> Using the X11 interface, when I click on Suggest and get a cross marking the suggested square, then the cross does not disappear when I click on Undo (the position is different, so the suggested square is no longer valid). This gets a bit confusing when you do a Suggest, Undo and Suggest again sequence - you end up with 2 crosses on the board. * From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk> When compiling rev_ip.c on an HP-UX 9000 Series 300 machine (68020 or 68030), the HP-UX 7.0 C compiler crashes out with the following error: C1 internal error in "tuplonges": invalid OREG in recognize_array() This problem has now been found, and the appropriate code is #ifdef'ed in rev_ip.c. ---------------- 3/ How to install this patch. To cut down on the size of this patch (yes really!!), the packing is not so straight forward as it could have been. This patch consists of nine parts. Save each one first. The first part consists of this introductory message, followed by a shar file containing the four new files: reve_proc.c common.c images/Sch_off.icon images/Sch_on.icon You should strip off all the initial lines (down to and including the CUT HERE line), and give to sh to unpack. The second part consists of a new copy of reve.edge1, and the third part contains a new copy of reve.edge2. You should strip off the initial mail headers (down to and including the CUT HERE lines), and replace the existing files. You should then use Larry Wall's patch program to apply the changes in the other six parts. Assuming the six files are called patch3-4, patch3-5, ..., patch3-9 do the following: cd reve_src # directory where your reve source files are. patch <patch3-4 patch <patch3-5 ... patch <patch3-9 Copy Makefile.dist to Makefile, and adjust for your site. See the README file for things you might have to tweak in order to get Reve to work on your machine. You will then have to do the appropriate make, to generate the graphics version you require. Do a "make help" to obtain more information on this. Finally, you should do a "make install". You will probably have to be super-user to do this. If you have any problems with Reve after applying this patch, and your problem is not listed in the TODO file, please let us know. ---------------- 4/ How to get previous patches. If you need to get patches 1 or 2, then they can be obtained from the automatic mail archive server, by sending a message to rb-archive-server@Aus.Sun.COM containing the line: send reve patchn where n is the patch number you require. You can also include a path line in these requests to indicate the mail path that the archive server should use to send the files to you. Such a path line could be: path uunet.uu.net!hostname!user Note that this is uunet.uu.net and not just uunet. Sun.COM doesn't recognise just uunet. [NOTE: When unpacking the shars generated by the automatic mail service, it is possible you will get error messages for incorrect length. Please ignore; hopefully the files should still unpack correctly]. Rich Burridge richb@Aus.Sun.COM Yves Gallot galloty@cernvax.cern.ch ------CUT HERE------patch 3 - part 1------CUT HERE------ #! /bin/sh # this is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh to create the files: # common.c # reve_proc.c # images/Sch_on.icon # images/Sch_off.icon # This archive created: Sun Dec 9 14:51:37 EST 1990 # # export PATH; PATH=/bin:$PATH # if [ -f common.c ] then echo shar: will not over-write existing file common.c else echo shar: extracting 'common.c', 2435 characters cat > common.c <<'Funky_Stuff' /* @(#)common.c 1.2 90/12/09 * * Common routine between reve and reve_proc. * * Copyright (C) 1990 - Rich Burridge & Yves Gallot. * All rights reserved. * * Permission is granted to copy this source, for redistribution * in source form only, provided the news headers in "substantially * unaltered format" are retained, the introductory messages are not * removed, and no monies are exchanged. * * Permission is also granted to copy this source, without the * news headers, for the purposes of making an executable copy by * means of compilation, provided that such copy will not be used * for the purposes of competition in any othello tournaments, without * prior permission from the authors. * * No responsibility is taken for any errors on inaccuracies inherent * either to the comments or the code of this program, but if reported * (see README file), then an attempt will be made to fix them. */ #include "reve.h" #include "extern.h" 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] ; } Funky_Stuff len=`wc -c < common.c` if [ $len != 2435 ] ; then echo error: common.c was $len bytes long, should have been 2435 fi fi # end of overwriting check if [ -f reve_proc.c ] then echo shar: will not over-write existing file reve_proc.c else echo shar: extracting 'reve_proc.c', 2755 characters cat > reve_proc.c <<'Funky_Stuff' /* @(#)reve_proc.c 1.2 90/12/09 * * Main routine for the separate play_reve program. * * Copyright (C) 1990 - Rich Burridge & Yves Gallot. * All rights reserved. * * Permission is granted to copy this source, for redistribution * in source form only, provided the news headers in "substantially * unaltered format" are retained, the introductory messages are not * removed, and no monies are exchanged. * * Permission is also granted to copy this source, without the * news headers, for the purposes of making an executable copy by * means of compilation, provided that such copy will not be used * for the purposes of competition in any othello tournaments, without * prior permission from the authors. * * No responsibility is taken for any errors on inaccuracies inherent * either to the comments or the code of this program, but if reported * (see README file), then an attempt will be made to fix them. */ #include "reve.h" struct reve_in in ; /* Input supplied on standard input. */ struct reve_out out ; /* Results written to standard output. */ int sin ; /* Size of the input buffer. */ int saveres = 0 ; /* If set, save computer results to log file. */ /* REVE global variables */ 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 */ long note ; /* Note value for current computer move. */ time_t timeleft ; /* Amount of time left for computer moves. */ /*ARGSUSED*/ main(argc, argv) int argc ; char *argv[] ; { int reply ; if (argv[1] != NULL) init_edge_table(argv[1]) ; for (;;) { sin = sizeof(struct reve_in) ; if ((reply = read(0, (char *) &in, sin)) > 0) { if (in.type == M_TIME) timeleft = in.timeleft ; else if (in.type == M_PROFMAX) max_depth = in.level ; else { play_reve(in.board, in.player, in.level, &out.move, &out.note) ; out.type = in.type ; WRITE(1, (char *) &out, sizeof(struct reve_out)) ; } } else if (reply == 0) exit(1) ; } } void show_best(move, note) int move ; long note ; { out.type = M_BEST ; out.move = move ; out.note = note ; out.depth = profmax ; WRITE(1, (char *) &out, sizeof(struct reve_out)) ; } Funky_Stuff len=`wc -c < reve_proc.c` if [ $len != 2755 ] ; then echo error: reve_proc.c was $len bytes long, should have been 2755 fi fi # end of overwriting check if [ -f images/Sch_on.icon ] then echo shar: will not over-write existing file images/Sch_on.icon else echo shar: extracting 'images/Sch_on.icon', 1933 characters cat > images/Sch_on.icon <<'Funky_Stuff' /* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0002,0x0000,0x0000,0x0000, 0x0007,0x0000,0x0000,0x0000,0x000E,0x0000,0x0000,0x0000, 0xFFFC,0x0000,0x0000,0x0000,0x8038,0x0000,0x0000,0x0000, 0x8070,0x0000,0x0000,0x0000,0x80E0,0x0000,0x0000,0x0000, 0xB1E0,0x0000,0x0000,0x0000,0xBBA0,0x0000,0x0000,0x0000, 0x9F20,0x0000,0x0000,0x0000,0x8E20,0x0000,0x0000,0x0000, 0x8420,0x0000,0x0000,0x0000,0xFFE0,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 Funky_Stuff len=`wc -c < images/Sch_on.icon` if [ $len != 1933 ] ; then echo error: images/Sch_on.icon was $len bytes long, should have been 1933 fi fi # end of overwriting check if [ -f images/Sch_off.icon ] then echo shar: will not over-write existing file images/Sch_off.icon else echo shar: extracting 'images/Sch_off.icon', 1933 characters cat > images/Sch_off.icon <<'Funky_Stuff' /* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0xFFE0,0x0000,0x0000,0x0000,0x8020,0x0000,0x0000,0x0000, 0x8020,0x0000,0x0000,0x0000,0x8020,0x0000,0x0000,0x0000, 0x8020,0x0000,0x0000,0x0000,0x8020,0x0000,0x0000,0x0000, 0x8020,0x0000,0x0000,0x0000,0x8020,0x0000,0x0000,0x0000, 0x8020,0x0000,0x0000,0x0000,0xFFE0,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 Funky_Stuff len=`wc -c < images/Sch_off.icon` if [ $len != 1933 ] ; then echo error: images/Sch_off.icon was $len bytes long, should have been 1933 fi fi # end of overwriting check