DEALER.DPP(6)
π DEALER.DPP β preprocessor for dealer scripts π
okay bestie, pull up a chair, because this is dealer.dpp, section 6 of the user docs, and it's genuinely one of my favourite little tools π«Ά
πΈ NAME πΈ
dealer.dpp β the preprocessor for dealer scripts. that's it. that's the whole vibe.
β¨ SYNOPSIS β¨
dealer.dpp [inputfile]
π¦ DESCRIPTION π¦
so dealer.dpp literally stands for dealer-pre-processor, which is not the most creative name ever, but hear me out: its whole entire purpose in life is to preprocess input files for Hans van Staveren's absolutely iconic dealer program. that's the job. it does the job. π
π SYNTAX π
okay so the way this works, the program expands shape specifications that look like this:
shape{COMPASS, shp1 + shp2 + ... + shpM - shm1 - ... - shmN}
that's the master template, and everything below is a flavour of it. buckle up. π
π regular shapes
7xxx, 4432, 4xx5 β these mean exactly the same thing they mean in the original dealer. no drama, no changes, we're not reinventing the wheel here. π
π the at least operator
the moment you drop a + after a suit-length, it means at least. that's the whole rule, so easy.
shape{north, 5+xx5+}: at least 5/5 in the blacks,
-->shape(north,5xx5 + 5xx6 + 6xx5 + 5xx7 + 6xx6 + 7xx5 + 5008 + 6007
+ 7006 + 8005)
see how it just... expands into every single possibility? obsessed. it ate and left no crumbs. π₯
π the at most operator
it's literally the same as the at least operator, except you use a - instead. that's it, that's the twist.
shape{north, 2-xxx}: at most 2 spades,
-->shape(north,0xxx + 1xxx + 2xxx)
π the range operator
okay this one operates on a single suit only β one suit, not the whole hand. and it comes with [] brackets, exactly like in Perl, so if you know Perl you're already winning. π§
shape{north, x[3-5]x[13]}: (3 to 5) hearts, and one or 3 clubs
-->shape(north,x3x1 + x4x1 + x3x3 + x5x1 + x4x3 + x5x3)
also, note that shape{north, 3-xxx} is equivalent to shape{north,[0-3]xxx} β same thing, different font, both slay. and yes, you can write compound ranges if you want to:
shape{north, [013-68]xxx} means: 0,1,3,4,5,6 or 8 spades.
look at that list. 0, 1, 3, 4, 5, 6, or 8. chaotic, but valid. π
π the permutation operator
the permutation operator shows up as () β same notation as the WBF rules for specifying shapes, so if you've seen those, this will feel like coming home.
shape{north, (4432)}: any 4432 hand.
-->shape(north,any 4432)
but here's the part that's actually iconic: the () operator can operate on restricted groups of cards. like, it can do partial work and leave the rest alone.
shape{north, 5s(431)}: 5 spades, the others suits being (431).
-->shape(north,5134 + 5314 + 5143 + 5341 + 5413 + 5431)
six expansions. six. all from one tiny line. that's the power. π
so what you have to do is:
- specify the suit names (
s,h,d,cin english) in the left part of the shape, in any order you want, go wild, - and enclose the rest of the permutation into
()in the right part.
and here's a (complicated) example, because we love a challenge:
shape{north, 4+c3+d(2+2+)}: at least 5 clubs, at least 3 diamonds,
and no short major.
-->shape(north,3334 + 4234 + 2434 + 3244 + 2344 + 2254 + 3235 + 2335 + 2245 + 2236)
π the Major operator
this one has to be used together with the () operator, no solo acts. M stands for a major. and listen β the M operator can only be used in the left part, never put a M inside the parens, i'm serious. π
shape{north, 5M(xxx)}
-->shape(north,x5xx + 5xxx)
shape{north, 5+M3+c(31)}
-->shape(north,1534 + 3514 + 1633 + 3613 + 5134 + 5314 + 6133 + 6313)
π the minor operator
literally the same as the Major operator, just lowercase m instead. siblings, not twins, but close enough. π
shape{north, 5M5m(xx)}
-->shape(north,x5x5 + 5xx5 + x55x + 5x5x)
π the conditional operator
okay so this is where it gets fancy. you get the option to specify complex conditions to be verified that can't just be simply expressed by the other operators. for that, you use the : operator, and you put it just after the atomic-shape specification:
shape{north, shp1:condition1,condition2,...}
the conditions use the letters (s,h,d,c) as variables for the suit lengths, plus the usual C-operators (*,+,-,/,>,<,==,!,?, and so on). also note that the , stands for the and-logical operator, and you can use or for the or-logical operator. yes bestie, you get boolean logic in your shape specs, we're thriving. πΈ
shape{north, 4+s4+h(xx):d>c,h+s==10}
-->shape(north,6421 + 6430 + 5521 + 5530 + 4621 + 4630)
π EXAMPLES π
here are some real ones, the good stuff:
- a balanced hand
(3+3+3+2+)
- a french 1H opening
x5+xx:h>s,h>=d,h>=c
- my No_trump opening
hn = hcp(north)
n1NT = (hn > 14 and hn < 18 and shape{north, 5m(332) + 5m2s(42)} )
or (hn > 13 and hn < 17 and shape{north, 6m(322)} )
or (hn > 15 and hn < 18 and shape{north, 5M(332)} )
or (hn > 15 and hn < 19 and shape{north, (4432) + (4333)} )
that last one is a whole mood honestly. look at all those ors stacked up. main character energy. β
π«Ά SEE ALSO π«Ά
dealer(6)/usr/share/doc/dealer/Manual
go read them, they're great, iykyk.
π AUTHORS π
- Francois Dellacherie
- Manpage: Christoph Berg <cb@df7cb.de>
π LICENSE π
This program is hereby put in the public domain. Do with it whatever you want, but I would like you not to redistribute it in modified form without mentioning the fact of modification. I will accept bug reports and modification requests, without any obligation of course, but fixing bugs someone else put in is beyond me.
fr fr, read that again: public domain, do whatever, but don't redistribute it modified without saying you modified it, and the author will take bug reports and modification requests with zero obligation. and fixing someone else's bugs? absolutely not, that's beyond them. valid. π
and that's the whole page bestie, no notes, periodt. β¨ this was Dealer, dated 2022-08-23, straight from DEALER.DPP(6) β now go write some shapes. ππ¦π
π¦ where this page comes from
- debian bookworm: dealer 20211121+ds-1 Β· dealer
- ubuntu noble: dealer 20211121+ds-1 Β· dealer
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms