home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
games
/
volume11
/
reve
/
patch1b
/
patches01b
Wrap
Text File
|
1990-12-11
|
52KB
|
1,527 lines
------- color.h -------
*** /tmp/da28728 Fri Nov 9 10:28:40 1990
--- color.h Mon Nov 5 09:10:15 1990
***************
*** 6,16 ****
* Copyright (C) 1990 - Rich Burridge & Yves Gallot.
* All rights reserved.
*
! * Permission is given to distribute these sources, as long as the
! * introductory messages are not removed, and no monies are exchanged.
*
! * You are forbidden from using Reve as is, or in a modified state, in
! * any tournaments, without the permission of the authors.
*
* No responsibility is taken for any errors or inaccuracies inherent
* either to the comments or the code of this program, but if reported
--- 6,21 ----
* 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 or inaccuracies inherent
* either to the comments or the code of this program, but if reported
------- events.c -------
*** /tmp/da28731 Fri Nov 9 10:28:41 1990
--- events.c Wed Nov 7 21:09:27 1990
***************
*** 7,17 ****
* Copyright (C) 1990 - Rich Burridge & Yves Gallot.
* All rights reserved.
*
! * Permission is given to distribute these sources, as long as the
! * introductory messages are not removed, and no monies are exchanged.
*
! * You are forbidden from using Reve as is, or in a modified state, in
! * any tournaments, without the permission of 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
--- 7,22 ----
* 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
***************
*** 18,24 ****
* (see README file), then an attempt will be made to fix them.
*/
- #include <stdio.h>
#include "reve.h"
#include "color.h"
#include "extern.h"
--- 23,28 ----
***************
*** 166,172 ****
switch (item)
{
case BLACK_PLAYS :
! WHITE_PLAYS : if (item == BLACK_PLAYS) curx = 0 ;
else curx = BBORDER + (3*(BWIDTH+BGAP)) ;
switch (ch)
{
--- 170,176 ----
switch (item)
{
case BLACK_PLAYS :
! case WHITE_PLAYS : if (item == BLACK_PLAYS) curx = 0 ;
else curx = BBORDER + (3*(BWIDTH+BGAP)) ;
switch (ch)
{
***************
*** 247,254 ****
nextc == RIGHT_DOWN)
{
set_cursor(NOCURSOR) ;
! piece_x = curx - BBORDER - (PIECE_RAD) ;
! piece_y = cury - BBORDER - (PIECE_RAD) ;
draw_piece(next_player, piece_x, piece_y, RINV) ;
cmode = (enum cantype) ((int) cmode + 1) ;
}
--- 251,258 ----
nextc == RIGHT_DOWN)
{
set_cursor(NOCURSOR) ;
! piece_x = curx - PIECE_RAD ;
! piece_y = cury - PIECE_RAD ;
draw_piece(next_player, piece_x, piece_y, RINV) ;
cmode = (enum cantype) ((int) cmode + 1) ;
}
***************
*** 319,325 ****
case 'W' : do_cycle_key(WHITE_PLAYS, nextc) ;
break ;
! case 'l' : last() ; /* Button items. */
break ;
case 'L' : curx = 0 ;
draw_textfield() ;
--- 323,329 ----
case 'W' : do_cycle_key(WHITE_PLAYS, nextc) ;
break ;
! case 'A' : show_all_moves() ; /* Button items. */
break ;
case 'L' : curx = 0 ;
draw_textfield() ;
------- extern.h -------
*** /tmp/da28734 Fri Nov 9 10:28:42 1990
--- extern.h Wed Nov 7 14:57:04 1990
***************
*** 6,16 ****
* Copyright (C) 1990 - Rich Burridge & Yves Gallot.
* All rights reserved.
*
! * Permission is given to distribute these sources, as long as the
! * introductory messages are not removed, and no monies are exchanged.
*
! * You are forbidden from using Reve as is, or in a modified state, in
! * any tournaments, without the permission of 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
--- 6,21 ----
* 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
***************
*** 23,29 ****
extern int cur_ch ; /* Current character pressed. */
extern int curx ; /* Current mouse X position. */
extern int cury ; /* Current mouse Y position. */
- extern int depth ; /* Depth of search for computers move. */
extern int down ; /* Indicates is a mouse button is down. */
extern int first_move ; /* Set if computer plays first move. */
extern int iconic ; /* Start as an icon if set. */
--- 28,33 ----
***************
*** 34,41 ****
--- 38,47 ----
extern int ix ; /* Initial X position of the icon. */
extern int iy ; /* Initial Y position of the icon. */
extern int last_move ; /* Last valid computer move. */
+ extern int level ; /* Current difficulty level for computer moves. */
extern int loadgame ; /* Set if there is a game file to load. */
extern int lsval ; /* Set to 'l' or 's', if loading or saving. */
+ extern int monochrome ; /* If set, display will be in monochrome. */
extern int move ; /* Current move being evaluated. */
extern int move_delta ; /* Delta for piece animation. */
extern int nextc ; /* Current event identifier. */
***************
*** 51,56 ****
--- 57,63 ----
extern int s_player ;
extern int s_row ;
extern int s_col ;
+ extern int show_moves ; /* If set, all possible moves are being shown. */
extern int show_notes ; /* If set, display notes value from play_reve. */
extern int suggestion ; /* Positive if a suggested move. */
extern int suggest_x ; /* X position of suggested move. */
***************
*** 62,67 ****
--- 69,75 ----
extern int wx ; /* Initial X position of the window. */
extern int wy ; /* Initial Y position of the window. */
+ extern time_t timeleft ; /* Amount of time left for computer moves. */
extern long note ; /* Note value for current computer move. */
extern char *diff_values[] ; /* Values for cyclic difficulty button. */
***************
*** 74,81 ****
extern char progname[] ; /* The name of this program. */
extern char revtable[] ; /* Table for reversing bits in a byte. */
! extern char black_dpy[] ; /* Black piece display information. */
! extern char white_dpy[] ; /* White piece display information. */
extern FILE *rem_fp ;
extern struct timeval tp ; /* Used by the nap_upto routine. */
--- 82,89 ----
extern char progname[] ; /* The name of this program. */
extern char revtable[] ; /* Table for reversing bits in a byte. */
! extern char *black_dpy ; /* Black piece display information. */
! extern char *white_dpy ; /* White piece display information. */
extern FILE *rem_fp ;
extern struct timeval tp ; /* Used by the nap_upto routine. */
***************
*** 85,90 ****
--- 93,99 ----
extern BOARD board ; /* The current reve board. */
extern BOARD old_board ; /* The previous reve board. */
extern BOARD *s_pos ;
+ extern BOARD s_all ; /* List of valid positions for this move. */
extern BOARD moves[64] ; /* Complete array of board moves. */
extern enum cantype cmode, last_cmode ;
------- images.h -------
*** /tmp/da28737 Fri Nov 9 10:28:42 1990
--- images.h Tue Nov 6 18:21:08 1990
***************
*** 6,16 ****
* Copyright (C) 1990 - Rich Burridge & Yves Gallot.
* All rights reserved.
*
! * Permission is given to distribute these sources, as long as the
! * introductory messages are not removed, and no monies are exchanged.
*
! * You are forbidden from using Reve as is, or in a modified state, in
! * any tournaments, without the permission of the authors.
*
* No responsibility is taken for any errors or inaccuracies inherent
* either to the comments or the code of this program, but if reported
--- 6,21 ----
* 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 or inaccuracies inherent
* either to the comments or the code of this program, but if reported
***************
*** 18,48 ****
*/
unsigned short button_stencil_image[] = {
! #include "images/button.stencil.icon"
} ;
unsigned short button_invert_image[] = {
! #include "images/button.invert.icon"
} ;
unsigned short button_normal_image[] = {
! #include "images/button.normal.icon"
} ;
unsigned short cycle_glyph_image[] = {
! #include "images/cycle.glyph.icon"
} ;
unsigned short cycle_stencil_image[] = {
! #include "images/cycle.stencil.icon"
} ;
unsigned short cycle_linvert_image[] = {
! #include "images/cycle.linvert.icon"
} ;
unsigned short cycle_rinvert_image[] = {
! #include "images/cycle.rinvert.icon"
} ;
unsigned short icon_image[] = {
--- 23,53 ----
*/
unsigned short button_stencil_image[] = {
! #include "images/Sbutton.icon"
} ;
unsigned short button_invert_image[] = {
! #include "images/Ibutton.icon"
} ;
unsigned short button_normal_image[] = {
! #include "images/Nbutton.icon"
} ;
unsigned short cycle_glyph_image[] = {
! #include "images/Ncycle.icon"
} ;
unsigned short cycle_stencil_image[] = {
! #include "images/Scycle.icon"
} ;
unsigned short cycle_linvert_image[] = {
! #include "images/Lcycle.icon"
} ;
unsigned short cycle_rinvert_image[] = {
! #include "images/Rcycle.icon"
} ;
unsigned short icon_image[] = {
***************
*** 50,56 ****
} ;
unsigned short cicon_image[] = {
! #include "images/reve.color.icon"
} ;
unsigned short hglass_image[] = {
--- 55,61 ----
} ;
unsigned short cicon_image[] = {
! #include "images/Creve.icon"
} ;
unsigned short hglass_image[] = {
------- items.c -------
*** /tmp/da28740 Fri Nov 9 10:28:43 1990
--- items.c Mon Nov 5 09:05:39 1990
***************
*** 7,17 ****
* Copyright (C) 1990 - Rich Burridge & Yves Gallot.
* All rights reserved.
*
! * Permission is given to distribute these sources, as long as the
! * introductory messages are not removed, and no monies are exchanged.
*
! * You are forbidden from using Reve as is, or in a modified state, in
! * any tournaments, without the permission of 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
--- 7,22 ----
* 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
***************
*** 18,30 ****
* (see README file), then an attempt will be made to fix them.
*/
- #include <stdio.h>
- #include <strings.h>
- #include "color.h"
#include "reve.h"
#include "extern.h"
void
draw_button(item, color, image) /* Draw a panel button. */
enum panel_type item ;
--- 23,39 ----
* (see README file), then an attempt will be made to fix them.
*/
#include "reve.h"
+ #include "color.h"
#include "extern.h"
+ #ifdef SYSV
+ #include "string.h"
+ #else
+ #include <strings.h>
+ #endif /*SYSV*/
+
void
draw_button(item, color, image) /* Draw a panel button. */
enum panel_type item ;
***************
*** 107,139 ****
void
- draw_piece(piece, x, y, op) /* Draw an othello piece on the board. */
- int piece, x, y ;
- enum optype op ;
- {
- switch (piece)
- {
- case BLACK : draw_stencil(x, y, PSIZE, PSIZE, op, C_BLACK,
- P_BLACK, P_BLACK) ;
- break ;
- case WHITE : draw_stencil(x, y, PSIZE, PSIZE, op, C_BLACK,
- P_BLACK, P_WHITE) ;
- }
- }
-
-
- void
- draw_rect(x1, y1, x2, y2)
- int x1, y1, x2, y2 ;
- {
- draw_line(x1, y1, x2, y1, RSRC, C_BLACK) ;
- draw_line(x1, y1, x1, y2, RSRC, C_BLACK) ;
- draw_line(x2, y1, x2, y2, RSRC, C_BLACK) ;
- draw_line(x1, y2, x2, y2, RSRC, C_BLACK) ;
- }
-
-
- void
draw_textfield()
{
int x1, y1 ;
--- 116,121 ----
***************
*** 142,148 ****
x1 = BBORDER + BWIDTH + (BGAP / 2) ;
y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
color_area(x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP, C_WHITE) ;
! draw_rect(x1, y1, x1 + (4 * (BWIDTH + BGAP)) - 1, y1 + BHEIGHT + BGAP - 1) ;
draw_text(BBORDER + BWIDTH + BGAP, BBORDER + BHEIGHT + BGAP +
(nfont_height + (BHEIGHT - nfont_height) / 2) - 5,
BFONT, C_BLACK, "File:") ;
--- 124,131 ----
x1 = BBORDER + BWIDTH + (BGAP / 2) ;
y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
color_area(x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP, C_WHITE) ;
! draw_rect(x1, y1, x1 + (4 * (BWIDTH + BGAP)) - 1,
! y1 + BHEIGHT + BGAP - 1, RSRC, C_BLACK) ;
draw_text(BBORDER + BWIDTH + BGAP, BBORDER + BHEIGHT + BGAP +
(nfont_height + (BHEIGHT - nfont_height) / 2) - 5,
BFONT, C_BLACK, "File:") ;
***************
*** 210,219 ****
void
make_panel()
{
- draw_button(LAST_BUT, C_LGREY, BUT_NORMAL) ;
draw_button(LOAD_BUT, C_LGREY, BUT_NORMAL) ;
draw_button(NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
draw_button(SAVE_BUT, C_LGREY, BUT_NORMAL) ;
draw_button(SUGGEST_BUT, C_LGREY, BUT_NORMAL) ;
draw_button(UNDO_BUT, C_LGREY, BUT_NORMAL) ;
--- 193,202 ----
void
make_panel()
{
draw_button(LOAD_BUT, C_LGREY, BUT_NORMAL) ;
draw_button(NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
draw_button(SAVE_BUT, C_LGREY, BUT_NORMAL) ;
+ draw_button(SHOW_ALL_BUT, C_LGREY, BUT_NORMAL) ;
draw_button(SUGGEST_BUT, C_LGREY, BUT_NORMAL) ;
draw_button(UNDO_BUT, C_LGREY, BUT_NORMAL) ;
***************
*** 226,232 ****
draw_cycle_item(NOTES, notes_values, C_LGREY, CY_NORMAL) ;
make_message(PANEL_MES) ;
! make_message(NOTES_MES) ;
make_message(SCORE_MES) ;
make_message(TURN_MES) ;
}
--- 209,215 ----
draw_cycle_item(NOTES, notes_values, C_LGREY, CY_NORMAL) ;
make_message(PANEL_MES) ;
! make_message(EVAL_MES) ;
make_message(SCORE_MES) ;
make_message(TURN_MES) ;
}
------- reve.man -------
*** /tmp/da28765 Fri Nov 9 10:32:20 1990
--- reve.man Fri Nov 9 10:31:20 1990
***************
*** 10,17 ****
SYNOPSIS
reve [ -b [ display ] ] [ -c ] [ -d difficulty ] [ -e edge-
! file ] [ -g geometry ] [ -i ] [ -l gamefile ] [ -n ] [ -v ]
! [ -w [ display ] ] [ -? ] [ -Wi ] [ -Wp x y ] [ -WP x y ]
DESCRIPTION
Reve is a version of the popular Othello game. It contains
--- 10,18 ----
SYNOPSIS
reve [ -b [ display ] ] [ -c ] [ -d difficulty ] [ -e edge-
! file ] [ -g geometry ] [ -i ] [ -l gamefile ] [ -m ] [ -n ]
! [ -r ] [ -v ] [ -w [ display ] ] [ -? ] [ -Wi ] [ -Wp x y ]
! [ -WP x y ]
DESCRIPTION
Reve is a version of the popular Othello game. It contains
***************
*** 38,44 ****
go. Note that it is also possible to supply a number and a
letter pair, to indicate where you would like your new piece
to go. This is the only method to place pieces with the dumb
! tty interface.
There are various buttons and cyclic selections available.
Their meanings are given below, plus an indication of their
--- 39,47 ----
go. Note that it is also possible to supply a number and a
letter pair, to indicate where you would like your new piece
to go. This is the only method to place pieces with the dumb
! tty interface. The square containing the last move will be
! shown with a black outline. This is updated with each new
! move.
There are various buttons and cyclic selections available.
Their meanings are given below, plus an indication of their
***************
*** 54,62 ****
other combination, then you should use the appropriate com-
mand line options (see below).
- REVE BUTTONS
- With the graphics versions, there are eight buttons that are
- normally displayed at the top of the Reve window. Each of
--- 57,62 ----
***************
*** 71,81 ****
these buttons, except the "done" button has a keyboard
equivalent which is given in brackets below.
- last [ l ] Show the last move played.
-
load [ L ] Load a game file. The format of this game
file is given below. With the graphical
versions, a text field is displayed
--- 71,82 ----
+ REVE BUTTONS
+ With the graphics versions, there are eight buttons that are
+ normally displayed at the top of the Reve window. Each of
these buttons, except the "done" button has a keyboard
equivalent which is given in brackets below.
load [ L ] Load a game file. The format of this game
file is given below. With the graphical
versions, a text field is displayed
***************
*** 92,97 ****
--- 93,102 ----
game file, the piece is displayed on the
board, and the appropriate pieces flipped.
+ moves? [ A ] Show all the valid moves for the current
+ board. This is useful for beginners, and
+ for teaching purposes.
+
new game [ n ] Start a new game of reve
save [ S ] Save the current game to file. See the
***************
*** 118,128 ****
left mouse button, to increment or decrement the current
selection (depending upon which half on the item you click
over), or a selection can be made from a popup menu when you
- click with the right mouse button (SunView and XView ver-
- sions only). Each cycle value has a keyboard equivalent
- which is given in brackets below. This must be followed by
- the value of the new selection you wish to make. The dumb
- tty version has the equivalent of these items displayed to
--- 123,128 ----
***************
*** 137,142 ****
--- 137,147 ----
+ click with the right mouse button (SunView and XView ver-
+ sions only). Each cycle value has a keyboard equivalent
+ which is given in brackets below. This must be followed by
+ the value of the new selection you wish to make. The dumb
+ tty version has the equivalent of these items displayed to
the right of the reve board display.
Black: [ B ] Select whether the black player should be
***************
*** 184,197 ****
of reve it is possible to give an optional display
value.
- -c The computer will play. Presence or absence of -b and
- -w options determine which piece the computer plays.
- -d difficulty
- The level of difficulty for computer moves. See the
-
Sun Release 4.1 Last change: 18 October 1990 3
--- 189,197 ----
***************
*** 203,212 ****
Difficulty: cyclic item description above for more
information.
! -eedgefile
Specify an alternate location for the reve edge stabil-
ity table file. Normally the location of this file is
compiled in when the program is created, but reve will
--- 203,217 ----
+ -c The computer will play. Presence or absence of -b and
+ -w options determine which piece the computer plays.
+
+ -d difficulty
+ The level of difficulty for computer moves. See the
Difficulty: cyclic item description above for more
information.
! -e edgefile
Specify an alternate location for the reve edge stabil-
ity table file. Normally the location of this file is
compiled in when the program is created, but reve will
***************
*** 226,233 ****
--- 231,245 ----
Load a game file. The format of this game file is given
below. The board will be setup with these pieces.
+ -m Always display in monochrome, even on a color screen.
+
-n Display computer notes.
+ -r Save a log of computer move information to the file
+ reve.res as the game progresses. This information is
+ probably only useful to people trying to improve the
+ computer algorithm.
+
-? Print the version number and usage message for this
release of the reve program.
***************
*** 243,274 ****
and XView version of reve will automatically uses this
flag, but the X11 version will also.
- -Wp x y
- Start the open window position at x y
- -WP x y
- Start the icon position at x y
- REVE GAMES FILE FORMAT
- Reve has the ability to load or save games. The format of
- the games files are:
! 1, <C-4> - [ remarks field ]
! 2, - <E-3> [ remarks field ]
- Sun Release 4.1 Last change: 18 October 1990 4
! REVE(6) GAMES AND DEMOS REVE(6)
There is one move per line. Lines starting with a '#' and
blank lines are ignored. The first field of each line is the
move number. This will be present before the comma. It is
--- 255,287 ----
and XView version of reve will automatically uses this
flag, but the X11 version will also.
! Sun Release 4.1 Last change: 18 October 1990 4
+ REVE(6) GAMES AND DEMOS REVE(6)
! -Wp x y
! Start the open window position at x y
+ -WP x y
+ Start the icon position at x y
+ REVE GAMES FILE FORMAT
+ Reve has the ability to load or save games. The format of
+ the games files are:
+ 1, <C-4> - [ remarks field ]
+ 2, - <E-3> [ remarks field ]
+
There is one move per line. Lines starting with a '#' and
blank lines are ignored. The first field of each line is the
move number. This will be present before the comma. It is
***************
*** 297,315 ****
AUTHORS
Computer strategy: Yves Gallot galloty@cernvax.cern.ch
Graphics interface: Rich Burridge richb@Aus.Sun.COM
-
-
-
-
-
-
-
-
-
-
-
-
-
--- 310,315 ----
------- reve.6 -------
*** /tmp/da28768 Fri Nov 9 10:32:21 1990
--- reve.6 Fri Nov 9 10:31:13 1990
***************
*** 24,31 ****
--- 24,35 ----
.B \-l
.I gamefile
] [
+ .B \-m
+ ] [
.B \-n
] [
+ .B \-r
+ ] [
.B \-v
] [
.B \-w
***************
*** 65,71 ****
square in which you want your piece to go. Note that it is also possible
to supply a number and a letter pair, to indicate where you would like your
new piece to go. This is the only method to place pieces with the dumb tty
! interface.
.LP
There are various buttons and cyclic selections available. Their meanings
are given below, plus an indication of their keyboard equivalents. With the
--- 69,76 ----
square in which you want your piece to go. Note that it is also possible
to supply a number and a letter pair, to indicate where you would like your
new piece to go. This is the only method to place pieces with the dumb tty
! interface. The square containing the last move will be shown with a black
! outline. This is updated with each new move.
.LP
There are various buttons and cyclic selections available. Their meanings
are given below, plus an indication of their keyboard equivalents. With the
***************
*** 83,90 ****
displayed at the top of the Reve window. Each of these buttons, except
the "done" button has a keyboard equivalent which is given in brackets below.
.LP
- .IP "\fBlast [ l ]\fP" 18
- Show the last move played.
.IP "\fBload [ L ]\fP" 18
Load a game file. The format of this game file is given below. With the
graphical versions, a text field is displayed between the \fBdone\fP and
--- 88,93 ----
***************
*** 95,100 ****
--- 98,106 ----
stop on the invalid line, and display an error message. As each line is
successfully read from the game file, the piece is displayed on the board,
and the appropriate pieces flipped.
+ .IP "\fBmoves? [ A ]\fP" 18
+ Show all the valid moves for the current board. This is useful for beginners,
+ and for teaching purposes.
.IP "\fBnew game [ n ]\fP" 18
Start a new game of
.I reve
***************
*** 178,184 ****
The level of difficulty for computer moves. See the \fBDifficulty:\fP
cyclic item description above for more information.
.TP
! .BI \-e "edgefile"
Specify an alternate location for the
.I reve
edge stability table file. Normally the location of this file is compiled
--- 184,190 ----
The level of difficulty for computer moves. See the \fBDifficulty:\fP
cyclic item description above for more information.
.TP
! .BI \-e " edgefile"
Specify an alternate location for the
.I reve
edge stability table file. Normally the location of this file is compiled
***************
*** 201,208 ****
--- 207,223 ----
Load a game file. The format of this game file is given below. The board
will be setup with these pieces.
.TP
+ .B \-m
+ Always display in monochrome, even on a color screen.
+ .TP
.B \-n
Display computer notes.
+ .TP
+ .B \-r
+ Save a log of computer move information to the file
+ .I reve.res
+ as the game progresses. This information is probably only useful to
+ people trying to improve the computer algorithm.
.TP
.B \-?
Print the version number and usage message for this release of the
------- main.c -------
*** /tmp/da28803 Fri Nov 9 10:34:47 1990
--- main.c Wed Nov 7 15:04:18 1990
***************
*** 6,16 ****
* Copyright (C) 1990 - Rich Burridge & Yves Gallot.
* All rights reserved.
*
! * Permission is given to distribute these sources, as long as the
! * introductory messages are not removed, and no monies are exchanged.
*
! * You are forbidden from using Reve as is, or in a modified state, in
! * any tournaments, without the permission of 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
--- 6,21 ----
* 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
***************
*** 17,28 ****
* (see README file), then an attempt will be made to fix them.
*/
- #include <stdio.h>
- #include <strings.h>
- #include <sys/time.h>
- #include "color.h"
#include "reve.h"
#include "patchlevel.h"
/* Text values for the cyclic buttons. */
char *diff_values[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL } ;
--- 22,39 ----
* (see README file), then an attempt will be made to fix them.
*/
#include "reve.h"
+ #include "color.h"
#include "patchlevel.h"
+ #ifdef SYSV
+ #include <string.h>
+ #else
+ #include <strings.h>
+ #endif /*SYSV*/
+ #include <sys/time.h>
+ #ifdef X11
+ #include <X11/Xos.h>
+ #endif /*X11*/
/* Text values for the cyclic buttons. */
char *diff_values[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL } ;
***************
*** 45,51 ****
int cur_ch ; /* Current character pressed. */
int curx ; /* Current mouse X position. */
int cury ; /* Current mouse Y position. */
- int depth ; /* Depth of search for computers move. */
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. */
--- 56,61 ----
***************
*** 58,65 ****
--- 68,77 ----
int ix ; /* Initial X position of the icon. */
int iy ; /* Initial Y position of the icon. */
int last_move ; /* Last valid computer move. */
+ 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. */
+ int monochrome = 0 ; /* If set, display will be in monochrome. */
int move ; /* Current move being evaluated. */
int move_delta ; /* Delta for piece animation. */
int nextc ; /* Current event identifier. */
***************
*** 67,72 ****
--- 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. */
***************
*** 93,98 ****
--- 107,113 ----
BOARD old_board ; /* The previous reve board. */
BOARD board ; /* The current reve board. */
BOARD *s_pos ;
+ BOARD s_all ; /* List of valid positions for this move. */
BOARD moves[64] ; /* Complete array of board moves. */
***************
*** 101,110 ****
/* type x y width height text value function */
{ P_BUTTON, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
! BWIDTH, BHEIGHT, "last", 0, last },
{ P_BUTTON, BBORDER + (1*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
! BWIDTH, BHEIGHT, "load", 0, draw_textfield },
{ P_BUTTON, BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
BWIDTH, BHEIGHT, "new game", 0, new_game },
--- 116,125 ----
/* 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 },
***************
*** 170,175 ****
--- 185,191 ----
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. */
extern enum gr_type gtype ; /* Graphics type. */
***************
*** 190,195 ****
--- 206,226 ----
FPRINTF(stderr,"Error initialising window system.\n") ;
exit(1) ;
}
+ generate_graphics(argc, argv, DPY1) ;
+ if (dtype == XTWO) generate_graphics(argc, argv, DPY2) ;
+ start_tool(dtype) ; /* Event handling loop. */
+ exit(0) ;
+ /*NOTREACHED*/
+ }
+
+
+ void
+ generate_graphics(argc, argv, dpyno)
+ enum dpy_type dpyno ;
+ int argc ;
+ char *argv[] ;
+ {
+ cur_dpyno = dpyno ;
make_icon() ;
make_frame(argc, argv) ; /* Create reve window/icon. */
make_canvas() ; /* Create drawing canvas. */
***************
*** 200,208 ****
create_menu(NOTES, notes_values) ;
initboard() ;
set_cursor(CANVASCUR) ;
- start_tool(dtype) ; /* Event handling loop. */
- exit(0) ;
- /*NOTREACHED*/
}
--- 231,236 ----
***************
*** 212,217 ****
--- 240,246 ----
char *argv[] ;
{
char next[MAXLINE] ; /* The next command line parameter. */
+ int i ;
INC ;
while (argc > 0)
***************
*** 220,226 ****
switch (argv[0][1])
{
case 'b' : isblack = 1 ;
! if (*argv != NULL && argv[0][0] != '-')
{
INC ;
black_dpy = *argv ;
--- 249,255 ----
switch (argv[0][1])
{
case 'b' : isblack = 1 ;
! if (*(argv+1) != NULL && argv[1][0] != '-')
{
INC ;
black_dpy = *argv ;
***************
*** 230,238 ****
break ;
case 'd' : INC ;
getparam(next, argv, "-d needs difficulty") ;
! depth = atoi(next) ;
! if (depth < 1 || depth > MAXDIFF) depth = INIT_DEPTH ;
! items[(int) DIFFICULTY].value = depth - 1 ;
break ;
case 'e' : INC ;
getparam(edgefile, argv, "-e needs an edgetable file") ;
--- 259,267 ----
break ;
case 'd' : INC ;
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") ;
***************
*** 247,260 ****
getparam(gamefile, argv, "-l needs a game file") ;
loadgame = 1 ; /* Game file to load. */
break ;
case 'n' : show_notes = 1 ; /* Display computer notes. */
items[(int) NOTES].value = 1 ;
break ;
case '?' :
case 'v' : usage() ;
case 'w' : iswhite = 1 ;
! if (*argv != NULL && argv[0][0] != '-')
{
INC ;
white_dpy = *argv ;
--- 276,294 ----
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 ;
***************
*** 382,387 ****
--- 416,422 ----
BFONT, color, sa) ;
}
batch(IS_OFF) ;
+ show_last(last_move, IS_ON) ;
show_suggestion() ;
batch(IS_ON) ;
FOR_BOARD(i)
***************
*** 423,430 ****
show_notes = FALSE ;
isblack = 0 ;
iswhite = 0 ;
! depth = INIT_DEPTH ;
! items[(int) DIFFICULTY].value = depth - 1 ;
black_dpy = NULL ; /* X11 black piece display information. */
white_dpy = NULL ; /* X11 white piece display information. */
--- 458,465 ----
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. */
***************
*** 512,517 ****
--- 547,553 ----
void
set_display_types()
{
+ if (isblack && iswhite) play_computer = 0 ;
if (isblack && iswhite) dtype = XBOTH ;
else if (isblack) dtype = XBLACK ;
else if (iswhite) dtype = XWHITE ;
***************
*** 553,559 ****
int player ;
{
set_cursor(HOURGLASS) ;
! play_reve(board.square, player, depth, &move, ¬e) ;
set_cursor(CANVASCUR) ;
animate_move(move) ;
do_move(player) ;
--- 589,596 ----
int player ;
{
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) ;
------- makemove.c -------
*** /tmp/da28806 Fri Nov 9 10:34:48 1990
--- makemove.c Mon Nov 5 09:06:03 1990
***************
*** 7,17 ****
* Copyright (C) 1990 - Rich Burridge & Yves Gallot.
* All rights reserved.
*
! * Permission is given to distribute these sources, as long as the
! * introductory messages are not removed, and no monies are exchanged.
*
! * You are forbidden from using Reve as is, or in a modified state, in
! * any tournaments, without the permission of 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
--- 7,22 ----
* 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
***************
*** 18,24 ****
* (see README file), then an attempt will be made to fix them.
*/
- #include <stdio.h>
#include "reve.h"
#include "extern.h"
--- 23,28 ----
***************
*** 101,106 ****
--- 105,111 ----
register int square,offset ;
int row_offset,col_offset,piece,piece_count ;
+ if ((s_move+increment) < 0 || (s_move+increment) > 63) return(FALSE) ;
if (s_pos->square[s_move+increment] != s_opponent) return(FALSE) ;
/* Quick test to catch most failures -
------- procs.c -------
*** /tmp/da28809 Fri Nov 9 10:34:49 1990
--- procs.c Thu Nov 8 10:46:31 1990
***************
*** 7,17 ****
* Copyright (C) 1990 - Rich Burridge & Yves Gallot.
* All rights reserved.
*
! * Permission is given to distribute these sources, as long as the
! * introductory messages are not removed, and no monies are exchanged.
*
! * You are forbidden from using Reve as is, or in a modified state, in
! * any tournaments, without the permission of 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
--- 7,22 ----
* 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
***************
*** 18,24 ****
* (see README file), then an attempt will be made to fix them.
*/
- #include <stdio.h>
#include "color.h"
#include "reve.h"
#include "extern.h"
--- 23,28 ----
***************
*** 27,33 ****
void
difficulty()
{
! depth = next_setting(DIFFICULTY, diff_values) + 1 ;
}
--- 31,37 ----
void
difficulty()
{
! level = next_setting(DIFFICULTY, diff_values) + 1 ;
}
***************
*** 46,53 ****
else
{
draw_piece(next_player, piece_x, piece_y, RINV) ;
! cx = (piece_x + PIECE_RAD) / CELL_SIZE ;
! cy = ((piece_y - CY) + PIECE_RAD) / CELL_SIZE ;
move = cy * BOARD_SIZE + cx ;
make_move() ;
}
--- 50,57 ----
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() ;
}
***************
*** 66,72 ****
init_notes()
{
show_notes = next_setting(NOTES, notes_values) ;
! if (show_notes == FALSE) message(NOTES_MES, "") ;
}
--- 70,76 ----
init_notes()
{
show_notes = next_setting(NOTES, notes_values) ;
! if (show_notes == FALSE) message(EVAL_MES, "") ;
}
***************
*** 102,110 ****
message(PANEL_MES, "Computer can't play both players.") ;
}
if (curi == HUMAN && curo == COMPUTER)
! dtype = (next_player == BLACK) ? XBLACK : XWHITE ;
else if (curi == COMPUTER && curo == HUMAN)
! dtype = (next_player == BLACK) ? XWHITE : XBLACK ;
else if (curi == HUMAN && curo == HUMAN)
dtype = (dtype == XTWO) ? XTWO : XBOTH ;
--- 106,114 ----
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 ;
***************
*** 116,139 ****
void
- last()
- {
- enum optype rop ;
- int flips, player, x, y ;
-
- if (last_move == -1) return ; /* No last move. */
- player = board.square[last_move] ;
- for (flips = 0; flips < 4; flips++)
- {
- get_xy(last_move, &x, &y) ;
- rop = flips % 2 ? RSRC : RCLR ;
- draw_piece(player, x, CY+y, rop) ;
- PAUSE ;
- }
- }
-
-
- void
make_move()
{
if (legal(move, next_player, &board) == FALSE)
--- 120,125 ----
***************
*** 149,160 ****
case XBLACK :
case XWHITE : computer_move(OPPONENT(next_player)) ;
return ;
! case XBOTH : if (check(next_player) == TRUE) break ;
(void) check(OPPONENT(next_player)) ;
return ;
- case XTWO : FPRINTF(stderr, "Multi display not supported yet.\n") ;
}
-
cmode = (enum cantype) (OPPONENT(next_player) + 1) ;
next_player = OPPONENT(next_player) ;
}
--- 135,145 ----
case XBLACK :
case XWHITE : computer_move(OPPONENT(next_player)) ;
return ;
! case XBOTH :
! case XTWO : if (check(next_player) == TRUE) break ;
(void) check(OPPONENT(next_player)) ;
return ;
}
cmode = (enum cantype) (OPPONENT(next_player) + 1) ;
next_player = OPPONENT(next_player) ;
}
***************
*** 168,174 ****
last_move = -1 ;
if (items[(int) BLACK_PLAYS].value == COMPUTER) first_move = 1 ;
init_canvas() ;
! message(NOTES_MES, "") ;
message(PANEL_MES, "Use left mouse button to move") ;
draw_button(NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
}
--- 153,159 ----
last_move = -1 ;
if (items[(int) BLACK_PLAYS].value == COMPUTER) first_move = 1 ;
init_canvas() ;
! message(EVAL_MES, "") ;
message(PANEL_MES, "Use left mouse button to move") ;
draw_button(NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
}
***************
*** 208,213 ****
--- 193,206 ----
void
+ show_all_moves()
+ {
+ if (show_moves) show_all(IS_OFF) ;
+ else show_all(IS_ON) ;
+ }
+
+
+ void
suggest()
{
int player ;
***************
*** 216,222 ****
if (cmode == GAME_OVER) return ;
if (cmode == WHITE_START) player = WHITE ;
else player = BLACK ;
! play_reve(&board.square[0], player, depth, &suggestion, ¬e) ;
suggest_x = BBORDER + ((suggestion & 7) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
suggest_y = BBORDER + ((suggestion >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
--- 209,216 ----
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 ;
***************
*** 259,269 ****
--- 253,266 ----
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 ;
board.note = moves[n].note ;
+ board.timeleft = moves[n].timeleft ;
+ last_move = board.move ;
moves[n+1].move = -1 ;
FOR_BOARD(i) old_board.square[i] = moves[n-1].square[i] ;
***************
*** 271,277 ****
--- 268,277 ----
old_board.player = moves[n-1].player ;
old_board.move = moves[n-1].move ;
old_board.note = moves[n-1].note ;
+ old_board.timeleft = moves[n-1].timeleft ;
+ timeleft = board.timeleft ;
+
if (OPPONENT(player) == BLACK) cmode = BLACK_START ;
else cmode = WHITE_START ;
message(PANEL_MES, "") ;
***************
*** 284,289 ****
--- 284,290 ----
(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.") ;