1
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
4
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5
<meta name="GENERATOR" content="Mozilla/4.51 [en] (X11; I; Linux 2.2.5 i686) [Netscape]">
6
<title>Pre-Processors</title>
8
<body bgcolor="#F5DEB3">
12
The pre-processor directory contains code that can be used to generate
13
input for dealer. Currently there is only 1 contribution, <b>DPP</b> by
19
<a href="mailto:sr007-2@dial.oleane.com">François Dellacherie</a></h3>
23
dpp stands for dealer-pre-processor. Its main purpose is to preprocess
24
input files for Hans van Staveren's great dealer program.
26
2. How is it written ?</h3>
27
dpp is written in Perl-object. In fact, it was a small part of a package
28
that I will probably never finish to write (a package that should do automatic
29
checking of bidding conventions...).
30
<p>It contains two file:
33
the executable file 'dpp',</li>
36
the package 'Dist.pm'.</li>
40
3. What do I need to make it work ?</h3>
44
You need Perl (and anyway, even if you don't plan to use dpp, you probably
45
need perl, with or without knowing it !),</li>
48
You may need to change the first line of dpp, depending on where your perl
49
interpreter is located, and where you plan to install the package file
53
You need to read this...</li>
57
4. What can I do with it ?</h3>
58
The greatest idea of Hans van Staveren was his 'shape' function (please
59
reread his manual). The 'shape' function speed is the same for any number
60
of args in it. Unfortunately, there's no convenient way to express ideas
61
like "a balanced shape with 4 in a major". With the regular dealer, you
63
<pre>shape(north,2443 + 2434 + 3424 + 3442 + 3433 + 4243 + 4423 + 4234 +
64
4432 + 4324 + 4342 + 4333)</pre>
65
or, if you are clever :
66
<pre>shape(north, any 4432 + any 4333 - 3343 - 3334 - 2344 - 3244)</pre>
67
With dpp, you will just write :
68
<pre>shape{north, 4M(3+3+2+)}</pre>
71
<h3>5. Differences with the original syntax of shape:</h3>
72
Perl is great. (Repeat after me...)
73
<p>The only thing it misses regarding text-parsing is the hability to handle
74
sexp (in a more general case, I don't recommend having sex-p with a computer
75
;-). The bad news is that I had to change the parenthesis () into braces
76
{}, because I wanted to use () for other purposes inside the shape-func.
77
The only other difference is that shape doesn't recognize the word 'any'
79
<p>(I confess I may have kept the old syntax and invent a new word like
80
dist{}. If people complain about this, I may change it... I just wanted
81
to keep HVS-soul alive in my files...)
82
<p>The new general syntax is :
83
<pre>shape{COMPASS, shp1 + shp2 + ... + shpM - shm1 - ... - shmN}</pre>
84
See below for the atomic (shp or shm) shapes...
87
when you see a shape after a » signs, it's the result of a shape
88
after being dp-processed...
91
regular shapes : 7xxx, 4432, 4xx5 have the same meaning as in original
95
the 'at least' operator : whenever you put a '+' after a suit-length, it
96
means 'at least'.</li>
97
<p>Example: shape{north, 5+xx5+} : at least 5/5 in the blacks, »shape(north,5xx5
98
+ 5xx6 + 6xx5 + 5xx7 + 6xx6 + 7xx5 + 5008 + 6007 + 7006 + 8005)
100
the 'at most' operator : same as the 'at least', just use a '-' :
101
<p>Example: shape{north, 2-xxx} : at most 2 spades, »shape(north,0xxx
104
the 'range' operator : the range operator operates on a single suit. It
105
comes with [], like in Perl.
107
<p>Example: shape{north, x[3-5]x[13]} : (3 to 5) hearts, and one or 3 clubs
108
»shape(north,x3x1 + x4x1 + x3x3 + x5x1 + x4x3 + x5x3)
109
<p>Note that shape{north, 3-xxx} is equivalent to shape{north,[0-3]xxx}
110
You can write compound ranges if you want : shape{north, [013-68]xxx} means:
111
0,1,3,4,5,6 or 8 spades.
113
the 'permutation' operator : the permutation operator will appears as ()
114
like in the WBF rules of specifying shapes. Example :
115
<p>shape{north, (4432)} : any 4432 hand. »shape(north,any 4432)
116
<p>what's best is that the () operator can operate on restricted groups
118
<p>Example: shape{north, 5s(431)} : 5 spades, the others suits being (431).
119
»shape(north,5134 + 5314 + 5143 + 5341 + 5413 + 5431)
120
<p>What you have to do is :
123
specify the suit names (s,h,d,c in english) in the left part of the shape,
126
and enclose the rest of the permutation into () in the right part.</li>
128
A (complicated) example : shape{north, 4+c3+d(2+2+)} : at least 5 clubs,
129
at least 3 diamonds, and no short major. »shape(north,3334 +
130
4234 + 2434 + 3244 + 2344 + 2254 + 3235 + 2335 + 2245 + 2236)
132
the 'Major' operator : has to be used together with the () operator. 'M'
133
stands for 'a major' The 'M' operator can only be used in the left part
134
(never put a M inside the parens)
136
<br>shape{north, 5M(xxx)} »shape(north,x5xx + 5xxx)
137
<br>shape{north, 5+M3+c(31)} »shape(north,1534 + 3514 + 1633
138
+ 3613 + 5134 + 5314 + 6133 + 6313)
140
the 'minor' operator : same as the 'Major' operator, but in lowercase 'm'.
141
<p>Example : shape{north, 5M5m(xx)} »shape(north,x5x5 + 5xx5
144
the 'conditional' operator : you've got the possibility of specifying complex
145
conditions to be verified that cannot be simply expressed by other operators.
146
In order to do that, you use the ':' operator, just after the atomic-shape
147
specification : shape{north, shp1:condition1,condition2,...}
148
<p>The conditions use the letters (s,h,d,c) as variables for the suit lengths,
149
and the usual C-operators (*,+,-,/,>,<,==,!,?, and so on) Note that
150
the ',' stands for the 'and-logical' operator. You can use 'or' for the
151
'or-logical' operator.
152
<p>Example: shape{north, 4+s4+h(xx):d>c,h+s==10} »shape(north,6421
153
+ 6430 + 5521 + 5530 + 4621 + 4630)</ol>
156
7. Some other examples:</h3>
160
A balanced hand : (3+3+3+2+)</li>
163
A french 1H opening : x5+xx:h>s,h>=d,h>=c</li>
166
a michaels (spade+minor) : 5+s5+m(xx)</li>
169
my No_trump opening :</li>
172
<br>n1NT = (hn > 14 and hn < 18 and shape{north, 5m(332) + 5m2s(42)}
174
<br>(hn > 13 and hn < 17 and shape{north, 6m(322)} ) or
175
<br>(hn > 15 and hn < 18 and shape{north, 5M(332)} ) or
176
<br>(hn > 15 and hn < 19 and shape{north, (4432) + (4333)} )</ul>
179
8. How to use dpp:</h3>
183
Unix world: dpp my_input_file | dealer</li>
186
Windows/DOS world: I don't know. I've never used windows/DOS in my life
187
:-). I guess 2 possibilities :</li>
191
'dpp my_input_file > dppfile' followed by 'dealer dppfile'</li>
194
Include the dpp code inside the dealer code. Maybe somebody can do that
195
on the next dealer distribution, and add a '-dpp' option to dealer. I won't
196
do it, since I cannot check if that works properly.</li>
200
you can also try some shapes by typing 'dpp' on the command line, and enter
201
shape{} one by one to see how it transforms them.</li>
206
The suit specifications can be made in french or english. The default mode
207
is english. To change the mode, you can do 2 things:
210
add a "Dist->language('French');" in dpp (after the Dist->new)</li>
213
Change the DefaultLanguage value in Dist.pm</li>
215
If somebody wants to add other languages, it's possible...
217
10. Bugs and further developments:</h3>
224
don't understand a peculiar behaviour of dpp (but please reread this README
228
have suggestions for further developments,</li>
231
<a href="mailto:sr007-2@dial.oleane.com">sr007-2@dial.oleane.com</a>
232
<p>On the other hand, if you :
235
don't understand the *code*,</li>
238
cannot install perl on your machine,</li>
240
there is unfortunately nothing that I can do for you.
241
<p>Quoting Hans van Staveren :
244
This program is hereby put in the public domain. Do with it
245
whatever you want, but I would like you not to redistribute it in modified
246
form without mentioning the fact of modification. I will accept bug reports
247
and modification requests, without any obligation of course, but fixing
248
bugs someone else put in is beyond me.
249
<p>When you report bugs please mention the version number in the source
250
files, and preferably send context diffs if you changed anything. I might
251
put in your fixes, and ask Henk to distribute a new version someday.
254
<blockquote>François Dellacherie<BR> Paris, FRANCE</blockquote>
256
<hr><a href="input.html"><img SRC="prev.gif" BORDER=0 ></a><a href="index.html"><img SRC="index.gif" BORDER=0 ></a><a href="command.html"><img SRC="next.gif" BORDER=0 ></a>