Some notes on a couple of projects which exercise my mind from time to time.
I have had under consideration for some time now the question of codifying Bridge bidding systems, in such a way as to make them available to a Bridge playing program. Although there are a number of Bridge playing programs which allow you to choose between several basic systems, and embelish them with your choice from a variety of optional conventions, so far as I am aware there is no program at present which will play a system entirely of your own making. To create such a program would require a notation, which could be used to define your chosen system in its entirety, and which would be comprehensible to a program (if recorded in machine-readable form, of course). That is the primary objective of this project.
I don't really have much of this in place yet, but I am convinced that, to be really useful, such a notation should have these characteristics:
I can't see that it would be really practical to completely define every system from taws. I haven't tried to calculate the total number of bidding sequences that would be required to describe a bidding system in its entirety, but it must be enormous. As well as all the uncontested auctions, you need to consider intervening bids at each stage of the auction, plus the effects of any intervention earlier in the auction.
Since every bidding system shares certain characteristics with other bidding systems, it seems only logical to create a new system by taking an existing system as a base, and describing just the differences. This is probably the thought process that goes into the creation of most new systems, and it would make sense to extend the process to the encoding of the new system.
Unlike most of the world, it seems, I don't normally do my computing on a Micrsoft platform. That leads one to a view of things which can have quite a different slant from those computer users who are blissfully unaware that there are operating systems whose names don't start with "Windows", and there are other ways of publishing documents than Microsoft Word.
I am excited by the promise of XML. XML files should be equally readable and useable on Windows, Macintosh, Linux, Unix, or any other operating system and hardware platform (except perhaps some obsolete ones). XML is equally capable of carrying relatively unstructured text, such as web pages or wordprocessing documents, or highly structured data, such as business transactions. XML can be manipulated by a range of interchangeable utility software. There are a number of parsers, XSLT translators, etc. available right now, for just about any platform. As browsers, print engines, and so on, get more XML-capable, we will finally have a genuine, widely supported platform-independent medium.
XML seems like the right medium for a bidding system notation.
Some other recent projects have lead me to also consider how to codify Bridge hands. Actually, I mean hand plus auction. (Is there an official term for this?) I am aware that there is at least one system in existence already to do this (PBN - Tis Veugen's Portable Bridge Notation ), but PBN doesn't do quite what I wanted.
Actually, I came to this project through wanting a replacement for Jeff Goldsmith's LaTeX Bridge macros . I have quite a bit of Bridge documentation stored in LaTeX and Lyx files. I started to convert one of these documents to docbook-XML. It didn't take me long to realise that docbook has no facility for formatting Bridge hands. In my Lyx and LaTeX documents, I had used Jeff's macros.
I am still learning XML & XSL, but I believe I can achieve what I want by creating a new DTD and a new XSL stylesheet, to handle the Bridge hands, and merging those with the docbook files. I haven't done it yet, but I think it's feasible. That would be immensely preferable to creating a modified version of docbook (bridgebook?).
And then it occurred to me that this DTD would be useful in other contexts. In fact, if carefully done it could be the only format needed for encoding Bridge hands. Hands encoded in this way could be typeset, published in web pages, loaded into Bridge-playing programs, loaded into dealing machines, and anything else that I could imagine that you might want to do with an encoded Bridge hand.
Thanks to some assistance and encouragement from Torbjörn Gannholm, my earliest crude efforts are gradually evolving into something half presentable.
Torbjörn has suggested some changes to the files below. I didn't have time to incorporate them this time round, but they will probably appear in the next round of changes.
Here is a sample XML file, as an example of what I have in mind. (If your browser understands XML, it will probably strip the markup from the XML file. You can see the marked-up file by clicking here. (This will apply to Netscape 6.0 or later, IE 5 or later, Mozilla 0.7 or later, or Opera 5.0 or later.)) And here is a DTD to go with it. I have started on an XSL stylesheet to transform the XML into HTML.
Here
is the result of applying
this XSL stylesheet
to the above
XML file
with
Xalan
XSLT engine.
(Recent browsers will lose most of the XSL stylesheet, in the same way as
they lose most of the XML. Here is an
alternative showing the markup.)
Here is an earlier attempt: XML file,
marked-up file,
DTD,
generated html, and
XSL stylesheet.
I will be attempting several other XSL style sheets. I am not sure whether I should bother with CSS sheets as well.
These are very early versions, and will probably change considerably before I consider a general "release". In particular, I want to see what elements are in PBM that I ought to consider incorporating.
It is possible, of course, that someone else has had similar ideas. I would appreciate being advised, if anyone knows of such a scheme, either already in existence or under development. I would be happy to support or collaborate on someone else's project, if it is likely to produce a better result than I can achieve alone. (As I said above, I am in the throes of learning about XML & XSL.)
Since I started this, I have discovered Glen Ashton's Bridge Matters site, which has a page discussing XML and Bridge, including links to some items from a newsgroup discussion on the subject.
And so that is where I am currently headed. As things emerge, I will post more details here, for review.
Why not utilise the existing standard, and just build tools to translate PBN files into whatever form we need?
PBN is obviously widely accepted as a defacto standard. It has some attractive features, and wide support. But it has some limitations, too.
XML has a growing momentum. I believe it is inevitable that some people will start to use XML in preference to PBN (as they are already doing in preference to a number of other standards), and that an XML standard for Bridge will eventually emerge, whether we like it or not. I have no existing investment in PBN, so I want to be in on the ground floor with XML.
As an example of some of the XML tools around here is a screenshot of Merlot XML modeller with the example XML file above loaded.
And here is a screenshot of IBM XSL Editor with the example XML and XSL files above loaded. (Unfortunately I am not able to use this editor at present, since it requires JDK 1.1, which I no longer have.)
Here are some examples of the sort of documents I eventually want to work with (unfortunately without the Bridge capabilities, yet).