Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Sep 2012 13:33:48 -0700 (PDT)
From:      David Wolfskill <david@catwhisker.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/171792: patch: allow xmille to select starting player randomly
Message-ID:  <201209192033.q8JKXm35009953@albert.catwhisker.org>
Resent-Message-ID: <201209192040.q8JKe4KK080391@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         171792
>Category:       ports
>Synopsis:       patch: allow xmille to select starting player randomly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 19 20:40:04 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     David Wolfskill
>Release:        FreeBSD 9.1-PRERELEASE i386
>Organization:
Wolfskill & Dowling Residence
>Environment:
System: FreeBSD albert.catwhisker.org 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #349 240271M: Sun Sep 9 05:26:25 PDT 2012 root@freebeast.catwhisker.org:/usr/obj/usr/src/sys/ALBERT i386

>Description:
	As written, the human player always starts a game of xmille.

	The attached patch causes xmille to select the human player
	or itself to start, more-or-less randomly.
>How-To-Repeat:
	Play a few games of xmille, and note that you always start --
	never the computer.  Or examine the code, in mille.c:53 - 54:

	        Play = PLAYER;
		init_ui ();
>Fix:
	Since the port already has a files/patch-mille.c, we could patch
	that patchfile, thus:

--- files/patch-mille.c.orig	2012-07-22 04:58:35.000000000 -0700
+++ files/patch-mille.c	2012-09-19 13:12:55.000000000 -0700
@@ -21,6 +21,33 @@
  
  main(ac, av)
  reg int		ac;
+@@ -49,8 +50,6 @@
+ 		/* NOTREACHED */
+ 	}
+ 	setbuf(stdout, _sobuf);
+-	Play = PLAYER;
+-	init_ui ();
+ # ifndef PROF
+ #ifdef sun
+ 	srandom(getpid());
+@@ -60,6 +59,8 @@
+ # else
+ 	srand(0);
+ # endif
++	Play = random()&01 ? COMP : PLAYER;
++	init_ui ();
+ 	signal(SIGINT, rub);
+ 	for (;;) {
+ 		if (!restore || (Player[PLAYER].total >= 5000
+@@ -73,7 +74,7 @@
+ 		}
+ 		do {
+ 			if (!restore)
+-				Handstart = Play = other(Handstart);
++				Handstart = other(Handstart);
+ 			if (!restore || On_exit) {
+ 				shuffle();
+ 				init();
 @@ -123,9 +124,9 @@
   *	Routine to trap rubouts, and make sure they really want to
   * quit.
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209192033.q8JKXm35009953>