bug-gnubg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnubg] Export dice rolls to file


From: Jim Segrave
Subject: Re: [Bug-gnubg] Export dice rolls to file
Date: Sat, 23 Aug 2003 19:28:13 +0200
User-agent: Mutt/1.4.1i

On Thu 21 Aug 2003 (17:23 -0300), Albert Silver wrote:
> Hi,
> 
>       Is it possible to export a reproducible (using the same seed)
> set of dice rolls into a file? A certain person in RGB has challenged me
> to win every game in a match using a list of pre-rolled dice that only I
> would know (so yes, I could see all the dice rolls in advance, including
> his), but that he could verify afterwards. The person would like this to
> be done using the Mersenne Twister. 
> 
>                                               Albert

BTW, you'll need one seed and one set of rolls per game. Otherwise,
you won't have the advance knoledge of the rolls for the following
game since you won't know the length of the previous game.

I've created a command 
  dicerolls  nnnn

which only is available from the command line (no GUI). It will print 
nnnn rolls using the current RNG. So you could use the Gnubg.nogui
version and create a simple command file:

set rng mersenne
set seed 31415926
dicerolls 128
quit

and then do (from a DOS window)

gnubg.nogui -c command.file > rolls.out

Which will give a file like:

GNU Backgammon 0.14-devel  Copyright 1999, 2000, 2001, 2002, 2003 Gary Wong.
GNU Backgammon is free software, covered by the GNU General Public License
version 2, and you are welcome to change it and/or distribute copies of it
under certain conditions.  Type "show copying" to see the conditions.
There is absolutely no warranty for GNU Backgammon.  Type "show warranty" for
details.
You are already using the Mersenne Twister generator.
Seed set to 31415926.
4 5
1 2
5 2
6 5
6 3
4 5
3 2
...

In this case, the opening roll is 4 for player 0, 5 for player 1, so
player 1 goes first.

This is an ugly bit of code, doesn't use proper output functions and I
won't be unhappy if it's gone in the near future. I wish I could say I
thought it would make a dent in your troll, but I doubt it.

-- 
Jim Segrave           address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]