summaryrefslogtreecommitdiff
path: root/games/backgammon
diff options
context:
space:
mode:
Diffstat (limited to 'games/backgammon')
-rw-r--r--games/backgammon/backgammon/backgammon.64
-rw-r--r--games/backgammon/backgammon/main.c7
-rw-r--r--games/backgammon/backgammon/move.c6
-rw-r--r--games/backgammon/common_source/back.h3
-rw-r--r--games/backgammon/common_source/init.c5
-rw-r--r--games/backgammon/common_source/subs.c10
6 files changed, 22 insertions, 13 deletions
diff --git a/games/backgammon/backgammon/backgammon.6 b/games/backgammon/backgammon/backgammon.6
index 5bbb9122128..1f9138be78a 100644
--- a/games/backgammon/backgammon/backgammon.6
+++ b/games/backgammon/backgammon/backgammon.6
@@ -1,4 +1,4 @@
-.\" $OpenBSD: backgammon.6,v 1.13 2003/06/03 03:01:38 millert Exp $
+.\" $OpenBSD: backgammon.6,v 1.14 2006/10/29 20:02:41 martin Exp $
.\"
.\" Copyright (c) 1980, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -73,6 +73,8 @@ player is red (implies n)
player is white (implies n)
.It Fl b
two players, red and white (implies n)
+.It Fl d
+play without doubling
.It Fl s Ar file
recover previously saved game from
.Ar file
diff --git a/games/backgammon/backgammon/main.c b/games/backgammon/backgammon/main.c
index 0d696da24fb..60635878a3d 100644
--- a/games/backgammon/backgammon/main.c
+++ b/games/backgammon/backgammon/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.14 2004/04/05 14:24:45 aaron Exp $ */
+/* $OpenBSD: main.c,v 1.15 2006/10/29 20:02:41 martin Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.14 2004/04/05 14:24:45 aaron Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.15 2006/10/29 20:02:41 martin Exp $";
#endif
#endif /* not lint */
@@ -302,7 +302,8 @@ main (argc,argv)
break;
case 'D': /* double */
- dble();
+ if (dflag != 0)
+ dble();
break;
case ' ': /* roll */
diff --git a/games/backgammon/backgammon/move.c b/games/backgammon/backgammon/move.c
index 36b8a0e9f5a..005c08a3f77 100644
--- a/games/backgammon/backgammon/move.c
+++ b/games/backgammon/backgammon/move.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: move.c,v 1.7 2003/06/03 03:01:38 millert Exp $ */
+/* $OpenBSD: move.c,v 1.8 2006/10/29 20:02:41 martin Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -33,7 +33,7 @@
#if 0
static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: move.c,v 1.7 2003/06/03 03:01:38 millert Exp $";
+static char rcsid[] = "$OpenBSD: move.c,v 1.8 2006/10/29 20:02:41 martin Exp $";
#endif
#endif /* not lint */
@@ -77,7 +77,7 @@ domove(okay)
int l = 0; /* last man */
bestmove = -9999999.;
- if (okay) { /* see if comp should double */
+ if (okay && dflag != 0) { /* see if comp should double */
if (gvalue < 64 && dlast != cturn && dblgood()) {
addstr(*Colorptr);
dble(); /* double */
diff --git a/games/backgammon/common_source/back.h b/games/backgammon/common_source/back.h
index b81f68b330e..255eaae3105 100644
--- a/games/backgammon/common_source/back.h
+++ b/games/backgammon/common_source/back.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: back.h,v 1.9 2003/06/03 03:01:38 millert Exp $ */
+/* $OpenBSD: back.h,v 1.10 2006/10/29 20:02:41 martin Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -83,6 +83,7 @@ extern int hflag; /* flag for cleaning screen */
extern int mflag; /* backgammon flag */
extern int raflag; /* 'roll again' flag for recovered game */
extern int rflag; /* recovered game flag */
+extern int dflag; /* disable doubling flag */
extern int rfl; /* saved value of rflag */
extern int iroll; /* special flag for inputting rolls */
extern int board[26]; /* board: negative values are white,
diff --git a/games/backgammon/common_source/init.c b/games/backgammon/common_source/init.c
index 81b280715b9..ab50537eef5 100644
--- a/games/backgammon/common_source/init.c
+++ b/games/backgammon/common_source/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.7 2003/06/03 03:01:38 millert Exp $ */
+/* $OpenBSD: init.c,v 1.8 2006/10/29 20:02:41 martin Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -33,7 +33,7 @@
#if 0
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: init.c,v 1.7 2003/06/03 03:01:38 millert Exp $";
+static char rcsid[] = "$OpenBSD: init.c,v 1.8 2006/10/29 20:02:41 martin Exp $";
#endif
#endif /* not lint */
@@ -64,6 +64,7 @@ int mflag = 0; /* backgammon flag */
int raflag = 0; /* 'roll again' flag for recovered game */
int rflag = 0; /* recovered game flag */
int iroll = 0; /* special flag for inputting rolls */
+int dflag = 1; /* doubling enabled */
int rfl = 0;
const char *const color[] = {"White", "Red", "white", "red"};
diff --git a/games/backgammon/common_source/subs.c b/games/backgammon/common_source/subs.c
index 8f78fcc5182..4db117aad64 100644
--- a/games/backgammon/common_source/subs.c
+++ b/games/backgammon/common_source/subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subs.c,v 1.13 2004/04/07 14:09:35 aaron Exp $ */
+/* $OpenBSD: subs.c,v 1.14 2006/10/29 20:02:41 martin Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -33,7 +33,7 @@
#if 0
static char sccsid[] = "@(#)subs.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: subs.c,v 1.13 2004/04/07 14:09:35 aaron Exp $";
+static char rcsid[] = "$OpenBSD: subs.c,v 1.14 2006/10/29 20:02:41 martin Exp $";
#endif
#endif /* not lint */
@@ -210,7 +210,7 @@ getarg(argc,argv)
int ch;
int j;
- while ((ch = getopt(argc, argv, "bhnrs:w")) != -1)
+ while ((ch = getopt(argc, argv, "bdhnrs:w")) != -1)
switch((char)ch) {
case 'n': /* don't ask if rules or instructions needed */
if (rflag)
@@ -247,6 +247,10 @@ getarg(argc,argv)
recover(optarg);
break;
+ case 'd': /* disable doubling */
+ dflag = 0;
+ break;
+
default: /* print cmdline options */
case 'h':
for (j = 0; descr[j] != NULL; j++)