eliot-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Eliot-dev] eliot/dic dic.cpp header.cpp tile.cpp [cppdic]


From: eliot-dev
Subject: [Eliot-dev] eliot/dic dic.cpp header.cpp tile.cpp [cppdic]
Date: Tue, 27 Nov 2007 18:38:29 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Branch:         cppdic
Changes by:     Olivier Teulière <ipkiss>      07/11/27 18:38:29

Modified files:
        dic            : dic.cpp header.cpp tile.cpp 

Log message:
         - Make sure the old points, frequency, etc. are correctly specified 
with the old format as well
         - The joker should be present in the dictionary header, like any 
"normal" letter

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/dic.cpp?cvsroot=eliot&only_with_tag=cppdic&r1=1.1.2.7&r2=1.1.2.8
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/header.cpp?cvsroot=eliot&only_with_tag=cppdic&r1=1.1.2.8&r2=1.1.2.9
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/tile.cpp?cvsroot=eliot&only_with_tag=cppdic&r1=1.1.2.1&r2=1.1.2.2

Patches:
Index: dic.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Attic/dic.cpp,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -b -r1.1.2.7 -r1.1.2.8
--- dic.cpp     27 Nov 2007 18:01:04 -0000      1.1.2.7
+++ dic.cpp     27 Nov 2007 18:38:29 -0000      1.1.2.8
@@ -114,8 +114,6 @@
     // Create a tile for each letter in the dictionary header
     for (unsigned int i = 0; i < m_header->getLetters().size(); ++i)
         m_tilesVect.push_back(Tile(m_header->getLetters()[i]));
-    // Another tile for the joker
-    m_tilesVect.push_back(Tile::Joker());
 }
 
 

Index: header.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Attic/header.cpp,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -b -r1.1.2.8 -r1.1.2.9
--- header.cpp  27 Nov 2007 18:01:04 -0000      1.1.2.8
+++ header.cpp  27 Nov 2007 18:38:29 -0000      1.1.2.9
@@ -253,8 +253,43 @@
 
     if (m_version == 0)
     {
-        m_letters = convertToWc("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+        // In version 0, the letters, points, frequency,
+        // vowels and consonants were hard-coded...
         m_dicName = convertToWc("Unspecified (old format)");
+        m_letters = convertToWc("ABCDEFGHIJKLMNOPQRSTUVWXYZ?");
+
+        static const uint8_t Frenchpoints[] =
+        {
+            // A B C D  E F G H I J  K L M N O P Q R S T U V  W  X  Y  Z ?
+               1,3,3,2, 1,4,2,4,1,8,10,1,2,1,1,3,8,1,1,1,1,4,10,10,10,10,0
+        };
+
+        static const uint8_t FrenchFrequency[] =
+        {
+            // A B C D  E F G H I J  K L M N O P Q R S T U V  W  X  Y  Z ?
+               9,2,2,3,15,2,2,2,8,1, 1,5,3,6,6,2,1,6,6,6,6,2, 1, 1, 1, 1,2
+        };
+
+        // The jokers and the 'Y' can be considered both as vowels or 
consonants
+        static const uint8_t FrenchVowels[] =
+        {
+            // A B C D  E F G H I J  K L M N O P Q R S T U V  W  X  Y  Z ?
+               1,0,0,0, 1,0,0,0,1,0, 0,0,0,0,1,0,0,0,0,0,1,0, 0, 0, 1, 0,1
+        };
+
+        static const uint8_t FrenchConsonants[] =
+        {
+            // A B C D  E F G H I J  K L M N O P Q R S T U V  W  X  Y  Z ?
+               0,1,1,1, 0,1,1,1,0,1, 1,1,1,1,0,1,1,1,1,1,0,1, 1, 1, 1, 1,1
+        };
+
+        for (unsigned int i = 0; i < m_letters.size(); ++i)
+        {
+            m_points.push_back(Frenchpoints[i]);
+            m_frequency.push_back(FrenchFrequency[i]);
+            m_vowels.push_back(FrenchVowels[i]);
+            m_consonants.push_back(FrenchConsonants[i]);
+        }
     }
     else
     {

Index: tile.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Attic/tile.cpp,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- tile.cpp    27 Nov 2007 18:01:05 -0000      1.1.2.1
+++ tile.cpp    27 Nov 2007 18:38:29 -0000      1.1.2.2
@@ -42,7 +42,7 @@
     {
         m_joker = true;
         m_char = TILE_JOKER;
-        m_code = m_header->getLetters().size() + 1;
+        m_code = m_header->getCodeFromChar(m_char);
     }
     else if (c == TILE_DUMMY)
     {
@@ -65,8 +65,6 @@
 {
     if (m_code == 0)
         throw DicException("Tile::isVowel: Invalid tile");
-    if (m_joker)
-        return true;
     return m_header->isVowel(m_code);
 }
 
@@ -75,8 +73,6 @@
 {
     if (m_code == 0)
         throw DicException("Tile::isConsonant: Invalid tile");
-    if (m_joker)
-        return true;
     return m_header->isConsonant(m_code);
 }
 
@@ -85,8 +81,6 @@
 {
     if (m_code == 0)
         throw DicException("Tile::maxNumber: Invalid tile");
-    if (m_joker)
-        return 2;
     return m_header->getFrequency(m_code);
 }
 
@@ -95,8 +89,6 @@
 {
     if (m_code == 0)
         throw DicException("Tile::getPoints: Invalid tile");
-    if (m_joker)
-        return 0;
     return m_header->getPoints(m_code);
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]