Unless I'm doing something very stupid that I haven't noticed,
the dictionary list/save option in Quackle appears to always
produce the same list regardless of which word source is
selected.

So I hacked up this so I could have a look at the word lists
and do some random checking for quality:

/*
* Copyright (c) 2005-2006 Jason Katz-Brown and John O'Laughlin.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
*    notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
*    notice, this list of conditions and the following disclaimer in the
*    documentation and/or other materials provided with the distribution.
* 3. The names of the authors may not be used to endorse or promote
*    products derived from this software without specific prior written
*    permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// originally loaddawg.cpp - modified to print dawg file

#include <stdio.h>
#include <stdlib.h>

#define true (0==0)
#define false (0!=0)

typedef int bool;
unsigned char *dawg;

void pdawg(int i, char *prefix, int len) {

    int index;      // integer index into 4-byte node
    unsigned int p; // pointer
    char c;         // the char
    bool t;         // terminates?
    bool lastchild; // lastchild?
   
    for (;;) {
        index = i * 4;
        c = dawg[index + 3];    
        p = (dawg[index] << 16) + (dawg[index + 1] << 8) + (dawg[index + 2]);
        t = c & 32;
        lastchild = c & 64;
        c = (c & 31) + 'A';  // no i18n :-/
        prefix[len] = c; prefix[len+1] = '\0';

        if (t) fprintf(stdout, "%s\n", prefix);
        if (p) {pdawg(p, prefix, len+1); prefix[len] = '\0';}

        if (lastchild) return;
        i = i+1;
    }
}


int main(int argc, char **argv) {
    FILE *file;
    char buff[128];
    int i = 0, rc;

    if (argc != 2) {
      fprintf(stderr, "syntax: %s ../data/lexica/(%s|%s|%s|%s)\n",
        argv[0],
        "cosd.dawg",  "sowpods.dawg",  "twl06.dawg",  "twl98.dawg"
        );
      exit(0);
    }

    file = fopen(argv[1], "rb");   
    if (file == NULL) {
      fprintf(stderr, "Won't\n"); exit(1);
    }

    dawg = (unsigned char *)malloc(5000000); // hacky :-(
    *buff = '\0';
    for (;;) {
        rc = fread((char*)(dawg) + i, sizeof(char), 4, file);
      if (rc != 4) break;
        i += 4;
    }
    if (rc != 0) {
      fprintf(stderr, "Bad %d\n", rc);
      exit(1);
    }
    fprintf(stderr, "%d bytes\n", i);
    pdawg(1, buff, 0);
    exit(0);
}


SPONSORED LINKS
Collectible board game Chess board game Child board game
Parker brother board game Cranium board game Milton bradley board games


YAHOO! GROUPS LINKS




Reply via email to