summaryrefslogtreecommitdiff
path: root/generator.cpp
diff options
context:
space:
mode:
authorJohn Fultz <jfultz@wolfram.com>2015-08-22 01:39:47 -0500
committerJohn Fultz <jfultz@wolfram.com>2015-08-22 01:39:47 -0500
commit5e5d414c57d5c7dd8a3037dda1555db5fb7eb486 (patch)
treea442ebdafbb882f9fb3a620b8741e079a12e75a3 /generator.cpp
parent6613f3fd45b4ecf6821ee7bb07c95f86f43b0db2 (diff)
Add versioning of DAWGs.
If we're going to start writing these into user directories, then we'd better start versioning them so we don't end up generating bugs in the future. LexiconParameters::loadDawg() implements a tiny class factory which allows backward compatibility of DAWGs. I'll soon be adding a "version 1" in addition to the legacy "version 0". For now, version 1 is just dummied in.
Diffstat (limited to 'generator.cpp')
-rw-r--r--generator.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/generator.cpp b/generator.cpp
index 2bfc199..f2923b8 100644
--- a/generator.cpp
+++ b/generator.cpp
@@ -440,16 +440,7 @@ void Generator::makeMove(const Move &move, bool regenerateCrosses)
void Generator::readFromDawg(int index, unsigned int &p, Letter &letter, bool &t, bool &lastchild, bool &british, int &playability) const
{
- index *= 7;
- p = (QUACKLE_LEXICON_PARAMETERS->dawgAt(index) << 16) + (QUACKLE_LEXICON_PARAMETERS->dawgAt(index + 1) << 8) + (QUACKLE_LEXICON_PARAMETERS->dawgAt(index + 2));
- letter = QUACKLE_LEXICON_PARAMETERS->dawgAt(index + 3);
-
- t = (letter & 32) != 0;
- lastchild = (letter & 64) != 0;
- british = !(letter & 128);
- letter = (letter & 31) + QUACKLE_FIRST_LETTER;
-
- playability = (QUACKLE_LEXICON_PARAMETERS->dawgAt(index + 4) << 16) + (QUACKLE_LEXICON_PARAMETERS->dawgAt(index + 5) << 8) + (QUACKLE_LEXICON_PARAMETERS->dawgAt(index + 6));
+ QUACKLE_LEXICON_PARAMETERS->dawgAt(index, p, letter, t, lastchild, british, playability);
}
bool Generator::checksuffix(int i, const LetterString &suffix) {