~ubuntu-branches/ubuntu/natty/dealer/natty

« back to all changes in this revision

Viewing changes to Manual/preproc.html

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2005-09-07 23:32:20 UTC
  • Revision ID: james.westby@ubuntu.com-20050907233220-e7bsghnrwg1ncye4
Tags: upstream-0.20040530
ImportĀ upstreamĀ versionĀ 0.20040530

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
 
2
<html>
 
3
<head>
 
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>
 
7
</head>
 
8
<body bgcolor="#F5DEB3">
 
9
 
 
10
<h1>
 
11
Pre-Processors</h1>
 
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
 
14
Francois Dellacherie.
 
15
<hr>
 
16
<h2>
 
17
DPP</h2>
 
18
<h3>
 
19
<a href="mailto:sr007-2@dial.oleane.com">Fran&ccedil;ois Dellacherie</a></h3>
 
20
 
 
21
<h3>
 
22
1. What is dpp ?</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.
 
25
<h3>
 
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:
 
31
<ul>
 
32
<li>
 
33
the executable file 'dpp',</li>
 
34
 
 
35
<li>
 
36
the package 'Dist.pm'.</li>
 
37
</ul>
 
38
 
 
39
<h3>
 
40
3. What do I need to make it work ?</h3>
 
41
 
 
42
<ul>
 
43
<li>
 
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>
 
46
 
 
47
<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
 
50
'Dist.pm'.</li>
 
51
 
 
52
<li>
 
53
You need to read this...</li>
 
54
</ul>
 
55
 
 
56
<h3>
 
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
 
62
have to write :
 
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>
 
69
nice isn't it ??
 
70
 
 
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'
 
78
anymore.
 
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...
 
85
<h3>
 
86
6. Features:</h3>
 
87
when you see a shape after a &raquo; signs, it's the result of a shape
 
88
after being dp-processed...
 
89
<ol>
 
90
<li>
 
91
regular shapes : 7xxx, 4432, 4xx5 have the same meaning as in original
 
92
dealer.
 
93
 
 
94
<li>
 
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, &raquo;shape(north,5xx5
 
98
+ 5xx6 + 6xx5 + 5xx7 + 6xx6 + 7xx5 + 5008 + 6007 + 7006 + 8005)
 
99
<li>
 
100
the 'at most' operator : same as the 'at least', just use a '-' :
 
101
<p>Example: shape{north, 2-xxx} : at most 2 spades, &raquo;shape(north,0xxx
 
102
+ 1xxx + 2xxx)
 
103
<li>
 
104
the 'range' operator : the range operator operates on a single suit. It
 
105
comes with [], like in Perl.
 
106
 
 
107
<p>Example: shape{north, x[3-5]x[13]} : (3 to 5) hearts, and one or 3 clubs
 
108
&raquo;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.
 
112
<li>
 
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. &raquo;shape(north,any 4432)
 
116
<p>what's best is that the () operator can operate on restricted groups
 
117
of cards :
 
118
<p>Example: shape{north, 5s(431)} : 5 spades, the others suits being (431).
 
119
&raquo;shape(north,5134 + 5314 + 5143 + 5341 + 5413 + 5431)
 
120
<p>What you have to do is :
 
121
<ul>
 
122
<li>
 
123
specify the suit names (s,h,d,c in english) in the left part of the shape,
 
124
in any order,
 
125
<li>
 
126
and enclose the rest of the permutation into () in the right part.</li>
 
127
</ul>
 
128
A (complicated) example : shape{north, 4+c3+d(2+2+)} : at least 5 clubs,
 
129
at least 3 diamonds, and no short major. &raquo;shape(north,3334 +
 
130
4234 + 2434 + 3244 + 2344 + 2254 + 3235 + 2335 + 2245 + 2236)
 
131
<li>
 
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)
 
135
<p>Examples :
 
136
<br>shape{north, 5M(xxx)} &raquo;shape(north,x5xx + 5xxx)
 
137
<br>shape{north, 5+M3+c(31)} &raquo;shape(north,1534 + 3514 + 1633
 
138
+ 3613 + 5134 + 5314 + 6133 + 6313)
 
139
<li>
 
140
the 'minor' operator : same as the 'Major' operator, but in lowercase 'm'.
 
141
<p>Example : shape{north, 5M5m(xx)} &raquo;shape(north,x5x5 + 5xx5
 
142
+ x55x + 5x5x)
 
143
<li>
 
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 (*,+,-,/,>,&lt;,==,!,?, 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} &raquo;shape(north,6421
 
153
+ 6430 + 5521 + 5530 + 4621 + 4630)</ol>
 
154
 
 
155
<h3>
 
156
7. Some other examples:</h3>
 
157
 
 
158
<ul>
 
159
<li>
 
160
A balanced hand : (3+3+3+2+)</li>
 
161
 
 
162
<li>
 
163
A french 1H opening : x5+xx:h>s,h>=d,h>=c</li>
 
164
 
 
165
<li>
 
166
a michaels (spade+minor) : 5+s5+m(xx)</li>
 
167
 
 
168
<li>
 
169
my No_trump opening :</li>
 
170
 
 
171
<br>hn = hcp(north)
 
172
<br>n1NT = (hn > 14 and hn &lt; 18 and shape{north, 5m(332) + 5m2s(42)}
 
173
) or
 
174
<br>(hn > 13 and hn &lt; 17 and shape{north, 6m(322)} ) or
 
175
<br>(hn > 15 and hn &lt; 18 and shape{north, 5M(332)} ) or
 
176
<br>(hn > 15 and hn &lt; 19 and shape{north, (4432) + (4333)} )</ul>
 
177
 
 
178
<h3>
 
179
8. How to use dpp:</h3>
 
180
 
 
181
<ol>
 
182
<li>
 
183
Unix world: dpp my_input_file | dealer</li>
 
184
 
 
185
<li>
 
186
Windows/DOS world: I don't know. I've never used windows/DOS in my life
 
187
:-). I guess 2 possibilities :</li>
 
188
 
 
189
<ol>
 
190
<li>
 
191
'dpp my_input_file > dppfile' followed by 'dealer dppfile'</li>
 
192
 
 
193
<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>
 
197
</ol>
 
198
 
 
199
<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>
 
202
</ol>
 
203
 
 
204
<h3>
 
205
9. Languages:</h3>
 
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:
 
208
<ul>
 
209
<li>
 
210
add a "Dist->language('French');" in dpp (after the Dist->new)</li>
 
211
 
 
212
<li>
 
213
Change the DefaultLanguage value in Dist.pm</li>
 
214
</ul>
 
215
If somebody wants to add other languages, it's possible...
 
216
<h3>
 
217
10. Bugs and further developments:</h3>
 
218
If you :
 
219
<ul>
 
220
<li>
 
221
notice bugs or,</li>
 
222
 
 
223
<li>
 
224
don't understand a peculiar behaviour of dpp (but please reread this README
 
225
first),</li>
 
226
 
 
227
<li>
 
228
have suggestions for further developments,</li>
 
229
</ul>
 
230
you can e-mail me at
 
231
<a href="mailto:sr007-2@dial.oleane.com">sr007-2@dial.oleane.com</a>
 
232
<p>On the other hand, if you :
 
233
<ul>
 
234
<li>
 
235
don't understand the *code*,</li>
 
236
 
 
237
<li>
 
238
cannot install perl on your machine,</li>
 
239
</ul>
 
240
there is unfortunately nothing that I can do for you.
 
241
<p>Quoting Hans van Staveren :
 
242
<blockquote>
 
243
<font color="blue">
 
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.
 
252
</font></blockquote>
 
253
Have Fun!
 
254
<blockquote>Fran&ccedil;ois Dellacherie<BR> Paris, FRANCE</blockquote>
 
255
 
 
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>
 
257
</body>
 
258
</html>