Writing software for running tournaments - .NET version

WinTD is a great program, but there are a couple of things I don’t like about it, and, being a programmer, I’ve long wanted to create my own version. I was getting a lot done on it last year, when work got a bit weird and I put aside some of my “outside” projects. Well, I have a new job, and I decided it was time to pick them up again.

One of my frustrations was that a tourney running program really has to work well with the ratings supplement files from USCF. In order to do that, I had to understand what the format of those files were, and I couldn’t find any published documentation. I did some work figuring out how to open the files up and see what’s in them. It wasn’t exactly arduous, but it took some hours to do. To save others the “getting started” portion of similar efforts, I’ve decided to share the results of my work.

I work with Visual Studio and the .NET Framework. The following code is provided “as is” with no support from anyone, and
without the blessing of the USCF. If it doesn’t work, blame me, not them. (And then, write one that does work and send me
the code.) It might work now, it might not.
It might work next month. It might not. My guess work about the contents of the rating supplement might be right. It might not.
Who knows? It’s just a hobby program, but it might be useful to others who, like me, might be interested in making a program
of their own which, although it doesn’t have the bells and whistles of SwissSys or WinTD, would work just fine for our tournaments.

Here’s the code. The code opens the “golden database” ratings file, creates a DataSet object, and stores the schema for that database. Good luck. I hope it works, but it will undoubtedly stop working whenever the USCF decides to make a change in the ratings supplement file. For now, it looks like it is working.

To begin, download the golden database file, and unzip it. The .DBF is called taratsup.dbf.

private void button1_Click(object sender, EventArgs e)
{if (openFileDialog1.ShowDialog()== System.Windows.Forms.DialogResult.OK)
{
string dirname = openFileDialog1.FileName.Remove(openFileDialog1.FileName.LastIndexOf(‘\’));
string filename = openFileDialog1.FileName.Substring (openFileDialog1.FileName.LastIndexOf(‘\’) + 1);

            if (filename.ToUpper() != "TARATSUP.DBF")
            {
                MessageBox.Show("The file should be named TARATSUP.DBF");
                return;
            }


            string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + dirname + ";Extended Properties=dBase III";
            System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter("Select * from " + filename, ConnectionString);


            System.Data.DataSet ds = new DataSet();
            da.Fill(ds);//ds now contains a dataset of all the rows from the golden database
            if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                ds.WriteXmlSchema(saveFileDialog1.FileName);
            }
 }

}

When you run the above, it will create a dataset with the appropriate contents, and save the database schema to a file. If you look at that file, here are the contents.

<?xml version="1.0" standalone="true"?>

-<xs:schema xmlns:msdata=“urn:schemas-microsoft-com:xml-msdata” xmlns:xs=“http://www.w3.org/2001/XMLSchema” xmlns=“” id=“NewDataSet”>
-<xs:element msdata:UseCurrentLocale=“true” msdata:IsDataSet=“true” name=“NewDataSet”>
-xs:complexType -<xs:choice maxOccurs=“unbounded” minOccurs=“0”>
-<xs:element name=“Table”>
-xs:complexType
-xs:sequence
<xs:element name=“MEM_ID” minOccurs=“0” type=“xs:string”/>
<xs:element name=“MEM_NAME” minOccurs=“0” type=“xs:string”/>
<xs:element name=“EXPIRED” minOccurs=“0” type=“xs:dateTime”/>
<xs:element name=“STATE” minOccurs=“0” type=“xs:string”/>
<xs:element name=“RSUPP_YR” minOccurs=“0” type=“xs:string”/>
<xs:element name=“RSUPP_NUM” minOccurs=“0” type=“xs:string”/>
<xs:element name=“R_PLR_TYP” minOccurs=“0” type=“xs:string”/>
<xs:element name=“R_LPB_RAT” minOccurs=“0” type=“xs:string”/>
<xs:element name=“R_NRM_DAT” minOccurs=“0” type=“xs:string”/>
<xs:element name=“Q_PLR_TYP” minOccurs=“0” type=“xs:string”/>
<xs:element name=“Q_LPB_RAT” minOccurs=“0” type=“xs:string”/>
<xs:element name=“Q_NRM_DAT” minOccurs=“0” type=“xs:string”/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

It’s a single table, with rows that contain twelve columns.

Column 0 - The USCF Member ID, stored as a string.
Column 1 - The USCF Member name, the same as it appears on the membership card, which is intended to be lastname, firstname
Column 2 - The expiration date of the member. 12/31/2099 appears to indicate a life member.
column 3 - The member’s state, as a two letter string
column 4 - I believe this is the last year in which this member’s rating changed in a ratings supplement, as a four character string
column 5 - RSUPP_NUM - the number of the month of the last rating supplement for this member, as a two character string.
i.e. January is indicated by “01”. December is indicated by “12”.
column 6 - The regular rating type. A single character string. “U” is unrated. “P” is provisional. “E” is a normal rating.
column 7 - The regular rating, as a four digit string, with a leading space if necessary.
i.e. 838 is " 838".
column 8 - R_NRM_DAT I don’t know. All values appear to be null.
column 9 - as with column 6, but for quick ratings.
column 10 - as with column 7, but for quick ratings.
column 11 - as with column 8, and it also appears all entries are null.

From there, it’s up to you to manipulate the data.

As I go forward, I might post more of my code, if I think it’s reusable elsewhere.

From the original documentation for Tnmtadmt:

The following lists screen display abbreviations:
-------------------------------------------------
MEMBER NAME = Member’s name (last, first)
MEMBER ID = Member’s ID
MEMBER EXP. = Member’s expiration date
ST AB = State abbreviation
LM = PLayer’s regular Life Master mark
TY = Player’s regular type (unrated/provisional/established)
RG RATE = PLayer’s regular rating
RG TITL = Player’s regular title
PT PG = Player’s regular pt toward next title/provisional games
TY = Player’s quick type (unrated/provisional/established)
QK RATE = PLayer’s quick rating
QK TITL = Player’s quick title
PT PG = Player’s quick pt toward next title/provisional games
R.S. YEAR = Year of the Rating Supplement
RS NO = Month of the Rating Supplement

RG Titl and Qk Title were used for the number of games played for Provisional ratings and a code for the Title awarded that player: a letter followed by a number.

I have PHP scripts that read the golden database and populate either a MySQL or Postgres table with the data. (This is part of a system I use to generate a database for use with SwissSys that contains USCF and FIDE ids, ratings, and FIDE titles and federations. This database works fine with SwissSys [which allows the user to customize the database setup] but not at all with WinTD.) The scripts are written in PHP simply because it was the only free solution I could find for reading and writing DBF files.

I would be more than happy to share these scripts (or the whole system) with anyone who wants them. Feel free to send me a PM.

You could probably have saved yourself a bit of work by reading the Frequent Questions document on TD/A, which has an entry for:

What are the file formats for the 3 upload files for rating reports and for the rating supplement files?

Note that there are currently two different file formats for the rating supplement files, one for the Golden Master file and one for the monthly update file.

I have been working on an XML-based supplement file format which will include all three OTB ratings systems (Regular, Quick and Blitz.) This will be a unified file format, so that the same format will be used for both incremental updates and Golden Master files. This format will include additional information not in the current DBF formats, including floors. At the request of USCF staff and others, that file format will include FIDE ID numbers. (It will not include FIDE titles or FIDE ratings, though, mostly because of timing issues between when FIDE Rating lists and USCF ratings lists are issued.)

In my report to the Board last November (see BINFO 201200324), I recommended that the USCF set a ‘sundown date’ on issuing the current DBF rating supplement file formats, after which only the XML format would be available. I think December 2016 would be a reasonable sundown date. I believe this issue will be on the agenda of the February EB meeting.

Thanks, Mike. Yes, that helps. I hadn’t noticed any L or W entries, which could have caused grief.

Actually, the biggest thing that was difficult about my code,though, was finding the right values for the DBASE 3 connection string. I figured it out last year after some struggle, because I stumbled upon needing it for work. It isn’t obvious that the file name is what goes into the table name.

When it comes to the XML format for the future rating supplements, I’ll put in a request that I’ve discussed before.

Could the information about a player’s norm based titles be included, either as part of the ratings supplement, or as a separate download?

What I would like is to be able to have my software do norm calculations and recognize players who had earned (unofficially, pending confirmation and all that) a new title or a new norm toward a title. In order to do that, though, I have to be able to get that information out of the database.

I’m more interested in basing prize calculations, wallcharts, etc. off norm titles than ratings.

I’ve thought about the wall charts, not to mention seating arrangements.

In my tournament, I have “board one” at the top of the hall, and then it goes down toward the other end. As the tournament goes on, the people with the best records start clustering at one end of the room.

Before that happens, the highest rated player ends up sitting at board one, playing against the player at the top of the bottom half. Within scoregroups, the games are assigned in rating order, and the table numbers follow the highest rated players.

I would like to assign table numbers based on points first, but then title. In other words, the games are assigned based on standard USCF rules, but then the board assignments are based on title. The effect would be that the player with the highest title, regardless of his current rating, ends up playing the top board at least for round one. If he loses, the current young whippersnapper with the better current score, would have the top honors, but I would like to honor, in a small way, those with achievements in the past.

Come to think of it, to make that work perfectly, the “title supplement” material would also have to include the date on which a title was achieved. A person who achieved Category One (typically the highest title at my tournaments) in 1992 would be seated above someone who achieved it in 2011.

For those interested, this post details some detective work I did on the internal format of dBase3 files.

Bill Smythe

I highly recommend books like the following:

fileformat.info/resource/boo … /index.htm

Every book on that list was over $100, and none included an exact list of which types of files (in this case dBase3) were described.

Does anybody know of anyplace I can get this sort of information for free or at a reasonable price? I’m talking about a byte-by-byte description of everything that’s in a file, similar to what I wrote in this post I mentioned earlier in the thread.

Actually, at this point I’m more interested in XML than in dBase.

Bill Smythe

I think the original Jeff Walden book “File Formats for Popular PC software” is out of print, hence the high price. The dBase III format takes up about 3 pages of that book as part of the chapter on dBase II and dBase III (pp 46-52 in my copy.)

When I google ‘dbase III file format’ I get a number of pages, including this one:

fileformat.info/format/corion-dbase-iii.htm

There is NO ‘simple explanation’ of XML, IMHO, though there are countless books on the subject. (I think I own at least 4.)

Bill, this post bytes. :smiley: