[Top][All Lists]

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

Re: [Bug-gnubg] Using GNU Backgammon Weights

From: Ian Shaw
Subject: Re: [Bug-gnubg] Using GNU Backgammon Weights
Date: Tue, 3 Apr 2012 08:46:42 +0000

Hi Stanley,


The weights file is a set of weights for the neural network. The weights DO NOT represent values of specific positions. I’ll explain these lines as best I can.


GNU Backgammon 0.15

250 128 5 1 0.1000000 1.0000000



1)      A header line, stating the version number of the weights file

2)      Defines the dimensions of the Contact neural network: 250 input nodes, 128 hidden nodes, 5 outputs nodes (wins, g wins, bg wins, g losses, bg losses),  don’t know, hidden-layer learning rate, output-layer learning rate. (The last two are not needed for playing, only when the net is being trained)

3)      Weight for input 1 to hidden node 1

4)      Weight for input input 2 to hidden node 1



There are actually 3 sets of weights in this file, for Contact, Race  and Crashed positions. You can see similar lines to line 2 at line 32776 and 60942, defining sizes of these nets.


I haven’t got time to go into neural networks in detail, but there are lots of resources on the web. Bkgm.com might be a good place to start, from a backgammon perspective.


From memory (I don’t have the source handy) the board position (as a 2 * 25 matrix) is converted to input values for the network by calculate_inputs() twice calling calculate_half_inputs()  in neuralnet.c. This vector of 250 inputs is then passed through the neural network to give the five outputs.


I hope this helps.


n  Ian Shaw



From: bug-gnubg-bounces+address@hidden [mailto:bug-gnubg-bounces+address@hidden On Behalf Of Stanley Richards
Sent: 27 March 2012 00:18
To: GNU Backgammon
Subject: [Bug-gnubg] Using GNU Backgammon Weights


Hi GNU Backgammon Users,


I hope that you are gracious enough with your time to explain some basic gnu backgammon weight calculations to me. I developed a rudimentary internet backgammon gambling site in 2010. My site’s aesthetics and game lobby were flawed. Also, I realized that there were not many people who wanted to play backgammon for money. Thus, I closed the site within a few months of its opening.


I wish to make another attempt. The goals of this cosmetically improved site are very modest compared to my original hopes. Hopefully, I can attract a few dozen regular customers who enjoy low stakes backgammon. The problems with Play65 are the horrific waits and high rakes. My site addresses these issues.


Since there will be a small customer base, it is essential that clients have the opportunity to play a Bot if there are no opponents. I have been developing GM Bot for this purpose. My goal is to allow players to win a small amount of money if they defeat GM Bot, but lose nothing if GM Bot wins. My rakes are low, the customer base is small, and players are paid to play GM Bot without risk.  Thus, my gaming site may not be profitable.  But I don’t care. Great backgammon sites like GNU Backgammon, BGOnline, Backgammon Galore, and others do not generate profit for the owner. These sites are labors of love, not labors of profit. If I can create a site which is enjoyed by low stakes backgammon gamblers, then I am willing to lose several thousand dollars per year.


My GM Bot is working properly. It uses dozens of basic strategies for checker and cube play. Unfortunately, over the last several months I have not developed strategies which allow GM Bot to consistently play well. Initially, I did not think that would be a problem since I am not trying to develop an excellent Bot. The Bot’s purpose is to entertain my clients. However without applying position weights, I cannot develop a decent Bot.


Thus, I seek answers from the GNU Backgammon source code. Quite frankly, as a visual basic programmer I understand only a fraction of this code. I need to learn to use the gnubg weights file. I understand how GNU represents any backgammon position with an 80 bit string and how this string can be converted to a Position ID. Is gnubg weights associated with the 80 bit string, the Position ID, or some other metric? Can you teach me how to associate a backgammon position with gnubg weights?  Is there some type of vector used?  Even though I program with VB, if I knew the exact C+ code or where to find the necessary C+ code, I could translate and eventually understand.


GNU Backgammon 0.15

250 128 5 1 0.1000000 1.0000000




The above are the first lines of gnubg weights. I do not know how to interpret any of these lines or numbers. I suspect that these numbers represent the strength of specific positions. Can you explain the above four lines?


Even though, there are 1,813 pages of weights, I suspect that some board positions are not represented in these pages. How is a position weighted if it isn’t on the list? Also, does the attached gnubg weights include bearoff positions? If not, where do I find GNU bearoff database?


Your assistance in understanding GNU backgammon weight system would be much appreciated.


Thanking you in advance,


Stanley E. Richards


reply via email to

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