eliot-dev
[Top][All Lists]
Advanced

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

[Eliot-dev] eliot/game ai_percent.h ai_player.h bag.h board...


From: eliot-dev
Subject: [Eliot-dev] eliot/game ai_percent.h ai_player.h bag.h board...
Date: Sun, 01 Jan 2006 19:49:35 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Branch:         
Changes by:     Antoine Fraboulet <address@hidden>      06/01/01 19:49:35

Modified files:
        game           : ai_percent.h ai_player.h bag.h board.h coord.h 
                         cross.h debug.h duplicate.h freegame.h 
                         game_factory.h history.h player.h results.h 
                         round.h tile.h training.h turn.h ai_percent.cpp 
                         bag.cpp board.cpp coord.cpp cross.cpp 
                         duplicate.cpp freegame.cpp game_factory.cpp 
                         history.cpp player.cpp results.cpp round.cpp 
                         tile.cpp training.cpp turn.cpp 

Log message:
        - add comments and emacs mode

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/ai_percent.h.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/ai_player.h.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/bag.h.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/board.h.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/coord.h.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/cross.h.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/debug.h.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/duplicate.h.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/freegame.h.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/game_factory.h.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/history.h.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/player.h.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/results.h.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/round.h.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/tile.h.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/training.h.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/turn.h.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/ai_percent.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/bag.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/board.cpp.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/coord.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/cross.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/duplicate.cpp.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/freegame.cpp.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/game_factory.cpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/history.cpp.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/player.cpp.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/results.cpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/round.cpp.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/tile.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/training.cpp.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/turn.cpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text

Patches:
Index: eliot/game/ai_percent.cpp
diff -u eliot/game/ai_percent.cpp:1.4 eliot/game/ai_percent.cpp:1.5
--- eliot/game/ai_percent.cpp:1.4       Sun Nov  6 17:13:45 2005
+++ eliot/game/ai_percent.cpp   Sun Jan  1 19:49:35 2006
@@ -65,3 +65,9 @@
     return vector<Tile>();
 }
 
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/ai_percent.h
diff -u eliot/game/ai_percent.h:1.5 eliot/game/ai_percent.h:1.6
--- eliot/game/ai_percent.h:1.5 Sun Nov  6 17:13:45 2005
+++ eliot/game/ai_percent.h     Sun Jan  1 19:49:35 2006
@@ -62,3 +62,9 @@
 
 #endif
 
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/ai_player.h
diff -u eliot/game/ai_player.h:1.6 eliot/game/ai_player.h:1.7
--- eliot/game/ai_player.h:1.6  Sun Nov  6 17:13:45 2005
+++ eliot/game/ai_player.h      Sun Jan  1 19:49:35 2006
@@ -89,3 +89,9 @@
 
 #endif
 
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/bag.cpp
diff -u eliot/game/bag.cpp:1.5 eliot/game/bag.cpp:1.6
--- eliot/game/bag.cpp:1.5      Fri Nov  4 20:00:06 2005
+++ eliot/game/bag.cpp  Sun Jan  1 19:49:35 2006
@@ -136,3 +136,10 @@
     }
     fprintf(stderr, "\n");
 }
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/bag.h
diff -u eliot/game/bag.h:1.7 eliot/game/bag.h:1.8
--- eliot/game/bag.h:1.7        Fri Nov  4 20:00:06 2005
+++ eliot/game/bag.h    Sun Jan  1 19:49:35 2006
@@ -73,3 +73,10 @@
 };
 
 #endif
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/board.cpp
diff -u eliot/game/board.cpp:1.11 eliot/game/board.cpp:1.12
--- eliot/game/board.cpp:1.11   Sat Nov  5 13:56:59 2005
+++ eliot/game/board.cpp        Sun Jan  1 19:49:35 2006
@@ -473,3 +473,9 @@
 }
 #endif
 
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/board.h
diff -u eliot/game/board.h:1.10 eliot/game/board.h:1.11
--- eliot/game/board.h:1.10     Fri Nov  4 23:26:03 2005
+++ eliot/game/board.h  Sun Jan  1 19:49:35 2006
@@ -90,31 +90,27 @@
     void removeRound(const Dictionary &iDic, const Round &iRound);
     int checkRound(Round &iRound, bool iFirstTurn);
 
-    /*************************
+    /**
      *
-     *
-     *************************/
+     */
     void testRound(const Round &iRound);
     void removeTestRound();
     char getTestChar(int iRow, int iCol) const;
 
-    /*************************
-     *
+    /**
      * board_search.c
-     *************************/
+     */
     void search(const Dictionary &iDic, const Rack &iRack, Results &oResults);
     void searchFirst(const Dictionary &iDic, const Rack &iRack, Results 
&oResults);
 
-    /*************************
-     *
+    /**
      * board_cross.c
-     *************************/
+     */
     void buildCross(const Dictionary &iDic);
 
-    /*************************
+    /**
      *
-     *
-     *************************/
+     */
     int getWordMultiplier(int iRow, int iCol) const;
     int getLetterMultiplier(int iRow, int iCol) const;
 
@@ -150,3 +146,10 @@
 };
 
 #endif
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/coord.cpp
diff -u eliot/game/coord.cpp:1.7 eliot/game/coord.cpp:1.8
--- eliot/game/coord.cpp:1.7    Sat Nov  5 15:48:59 2005
+++ eliot/game/coord.cpp        Sun Jan  1 19:49:35 2006
@@ -19,7 +19,7 @@
 
 /**
  *  \file   coord.cpp
- *  \brief  Eliot coordinate system
+ *  \brief  Board coordinate system
  *  \author Antoine Fraboulet
  *  \date   2005
  */
@@ -85,26 +85,39 @@
     setRow(row);
 }
 
-string Coord::toString() const
+string Coord::toString(coord_mode_t mode) const
 {
     ASSERT(isValid(), "Invalid coordinates");
 
-    string res;
-    char s[5];
-    sprintf(s, "%d", m_col);
-    if (getDir() == HORIZONTAL)
-    {
-        res = string(1, m_row + 'A' - 1) + s;
-    }
-    else
+    char res[7];
+    char srow[3];
+    char scol[3];
+
+    sprintf(scol, "%d", m_col);
+    sprintf(srow, "%c", m_row + 'A' - 1);
+
+    switch (mode)
     {
-        res = s + string(1, m_row + 'A' - 1);
+    case COORD_MODE_COMPACT:
+       if (getDir() == HORIZONTAL)
+           sprintf(res,"%s%s",srow,scol);
+       else
+           sprintf(res,"%s%s",scol,srow);
+       break;
+    case COORD_MODE_LONG:
+       if (getDir() == HORIZONTAL)
+           sprintf(res,"%2s %2s",srow,scol);
+       else
+           sprintf(res,"%2s %2s",scol,srow);
+       break;
     }
-    return res;
-}
 
+    return string(res);
+}
 
 /// Local Variables:
+/// mode: c++
 /// mode: hs-minor
 /// c-basic-offset: 4
+/// indent-tabs-mode: nil
 /// End:
Index: eliot/game/coord.h
diff -u eliot/game/coord.h:1.5 eliot/game/coord.h:1.6
--- eliot/game/coord.h:1.5      Sat Nov  5 13:56:59 2005
+++ eliot/game/coord.h  Sun Jan  1 19:49:35 2006
@@ -19,7 +19,7 @@
 
 /**
  *  \file   coord.h
- *  \brief  Game coordinates system
+ *  \brief  Board coordinates system
  *  \author Antoine Fraboulet
  *  \date   2005
  */
@@ -55,7 +55,12 @@
     void swap();
 
     void setFromString(const string &iStr);
-    string toString() const;
+
+    typedef enum {
+       COORD_MODE_COMPACT,
+       COORD_MODE_LONG
+    } coord_mode_t;
+    string toString(coord_mode_t mode = COORD_MODE_COMPACT) const;
 
 private:
     Direction m_dir;
@@ -65,8 +70,9 @@
 
 #endif
 
-
 /// Local Variables:
+/// mode: c++
 /// mode: hs-minor
 /// c-basic-offset: 4
+/// indent-tabs-mode: nil
 /// End:
Index: eliot/game/cross.cpp
diff -u eliot/game/cross.cpp:1.4 eliot/game/cross.cpp:1.5
--- eliot/game/cross.cpp:1.4    Fri Nov  4 20:00:06 2005
+++ eliot/game/cross.cpp        Sun Jan  1 19:49:35 2006
@@ -62,3 +62,10 @@
     else
         return false;
 }
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/cross.h
diff -u eliot/game/cross.h:1.5 eliot/game/cross.h:1.6
--- eliot/game/cross.h:1.5      Fri Nov  4 20:00:06 2005
+++ eliot/game/cross.h  Sun Jan  1 19:49:35 2006
@@ -57,3 +57,10 @@
 };
 
 #endif
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/debug.h
diff -u eliot/game/debug.h:1.10 eliot/game/debug.h:1.11
--- eliot/game/debug.h:1.10     Mon Dec 26 21:10:59 2005
+++ eliot/game/debug.h  Sun Jan  1 19:49:35 2006
@@ -48,3 +48,10 @@
 #endif
 
 #endif
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/duplicate.cpp
diff -u eliot/game/duplicate.cpp:1.14 eliot/game/duplicate.cpp:1.15
--- eliot/game/duplicate.cpp:1.14       Mon Dec 26 22:54:02 2005
+++ eliot/game/duplicate.cpp    Sun Jan  1 19:49:35 2006
@@ -284,3 +284,9 @@
              m_hasPlayed[m_currPlayer]);
 }
 
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/duplicate.h
diff -u eliot/game/duplicate.h:1.10 eliot/game/duplicate.h:1.11
--- eliot/game/duplicate.h:1.10 Fri Nov  4 20:00:06 2005
+++ eliot/game/duplicate.h      Sun Jan  1 19:49:35 2006
@@ -82,3 +82,10 @@
 };
 
 #endif /* _DUPLICATE_H_ */
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/freegame.cpp
diff -u eliot/game/freegame.cpp:1.16 eliot/game/freegame.cpp:1.17
--- eliot/game/freegame.cpp:1.16        Mon Dec 26 22:58:19 2005
+++ eliot/game/freegame.cpp     Sun Jan  1 19:49:35 2006
@@ -254,3 +254,9 @@
     return 0;
 }
 
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/freegame.h
diff -u eliot/game/freegame.h:1.9 eliot/game/freegame.h:1.10
--- eliot/game/freegame.h:1.9   Fri Nov  4 20:00:06 2005
+++ eliot/game/freegame.h       Sun Jan  1 19:49:35 2006
@@ -64,3 +64,10 @@
 };
 
 #endif /* _FREEGAME_H_ */
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/game_factory.cpp
diff -u eliot/game/game_factory.cpp:1.6 eliot/game/game_factory.cpp:1.7
--- eliot/game/game_factory.cpp:1.6     Fri Nov  4 20:00:06 2005
+++ eliot/game/game_factory.cpp Sun Jan  1 19:49:35 2006
@@ -214,3 +214,10 @@
          << "Public License;\nsee the file named COPYING for details.\n";
 }
 
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/game_factory.h
diff -u eliot/game/game_factory.h:1.6 eliot/game/game_factory.h:1.7
--- eliot/game/game_factory.h:1.6       Fri Nov  4 20:00:06 2005
+++ eliot/game/game_factory.h   Sun Jan  1 19:49:35 2006
@@ -93,3 +93,10 @@
 };
 
 #endif // _GAME_FACTORY_H_
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/history.cpp
diff -u eliot/game/history.cpp:1.8 eliot/game/history.cpp:1.9
--- eliot/game/history.cpp:1.8  Tue Dec 27 16:54:38 2005
+++ eliot/game/history.cpp      Sun Jan  1 19:49:35 2006
@@ -39,7 +39,7 @@
 
 History::History()
 {
-    Turn* t = new Turn();
+    Turn* t = new Turn ();
     m_history.clear();
     m_history.push_back(t);
 }
@@ -143,7 +143,7 @@
         delete t;
     }
 
-    // Now we have the previous played round in back()
+    // now we have the previous played round in back()
     Turn* t = m_history.back();
     t->setNum(0);
     t->setPlayer(0);
@@ -160,13 +160,13 @@
     string rs = "";
 #ifdef DEBUG
     char buff[20];
-    sprintf(buff, "%ld", m_history.size());
+    sprintf(buff,"%d",m_history.size());
     rs = "history size = " + string(buff) + "\n\n";
 #endif
     for (i = 0; i < m_history.size(); i++)
     {
         Turn *t = m_history[i];
-        rs += t->toString() + "\n";
+        rs += t->toString() + string("\n");
     }
     return rs;
 }
@@ -177,6 +177,8 @@
 
 
 /// Local Variables:
+/// mode: c++
 /// mode: hs-minor
 /// c-basic-offset: 4
+/// indent-tabs-mode: nil
 /// End:
Index: eliot/game/history.h
diff -u eliot/game/history.h:1.8 eliot/game/history.h:1.9
--- eliot/game/history.h:1.8    Tue Dec 27 16:54:38 2005
+++ eliot/game/history.h        Sun Jan  1 19:49:35 2006
@@ -27,16 +27,10 @@
 #ifndef _HISTORY_H
 #define _HISTORY_H
 
-#include <string>
 #include <vector>
-
-using std::string;
-using std::vector;
-
-class Round;
-class Turn;
-class PlayedRack;
-
+#include "pldrack.h"
+#include "round.h"
+#include "turn.h"
 
 /**
  * History stores all the turns that have been played
@@ -45,23 +39,23 @@
  *  - one for each of the players
  *
  * A History is never void (getSize() can be used as the is the current turn
- * number for the complete game history).
+ * number for the complete game history). 
  *
  * History starts at zero.
  *
  * The top of the history is an empty
  * Turn until it has been filled and game is up to a new round.
- *
- * getCurrentRack() can/should be used to store the current played rack.
+ * 
+ * getCurrentRack() can/should be used to store the current played rack. 
  * setCurrentRack must be called whenever the current played rack is
  * modified.
- *
+ * 
  * History owns the turns that it stores. Do not delete a turn referenced by 
History
  */
 
 class History
 {
-public:
+ public:
     History();
     virtual ~History();
 
@@ -90,15 +84,15 @@
     /// String handling
     string toString() const;
 
-private:
-    vector<Turn*> m_history;
+ private:
+    vector < Turn* > m_history;
 };
 
 #endif
 
-
 /// Local Variables:
 /// mode: c++
 /// mode: hs-minor
 /// c-basic-offset: 4
+/// indent-tabs-mode: nil
 /// End:
Index: eliot/game/player.cpp
diff -u eliot/game/player.cpp:1.12 eliot/game/player.cpp:1.13
--- eliot/game/player.cpp:1.12  Tue Dec 27 01:06:54 2005
+++ eliot/game/player.cpp       Sun Jan  1 19:49:35 2006
@@ -97,4 +97,5 @@
 /// mode: c++
 /// mode: hs-minor
 /// c-basic-offset: 4
+/// indent-tabs-mode: nil
 /// End:
Index: eliot/game/player.h
diff -u eliot/game/player.h:1.16 eliot/game/player.h:1.17
--- eliot/game/player.h:1.16    Tue Dec 27 01:06:54 2005
+++ eliot/game/player.h Sun Jan  1 19:49:35 2006
@@ -69,7 +69,7 @@
     // A new rack is created with the remaining letters
     void endTurn(const Round &iRound, int iTurn);
 
-    const std::string toString() const;
+    const string toString() const;
 
 private:
     /// ID of the player
@@ -89,6 +89,8 @@
 class HumanPlayer: public Player
 {
 public:
+    string name;
+
     HumanPlayer(int iId): Player(iId) {}
     virtual ~HumanPlayer() {}
 
@@ -98,3 +100,9 @@
 
 #endif
 
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/results.cpp
diff -u eliot/game/results.cpp:1.9 eliot/game/results.cpp:1.10
--- eliot/game/results.cpp:1.9  Tue Dec 27 00:06:23 2005
+++ eliot/game/results.cpp      Sun Jan  1 19:49:35 2006
@@ -84,4 +84,5 @@
 /// mode: c++
 /// mode: hs-minor
 /// c-basic-offset: 4
+/// indent-tabs-mode: nil
 /// End:
Index: eliot/game/results.h
diff -u eliot/game/results.h:1.7 eliot/game/results.h:1.8
--- eliot/game/results.h:1.7    Mon Dec 26 21:22:21 2005
+++ eliot/game/results.h        Sun Jan  1 19:49:35 2006
@@ -76,4 +76,5 @@
 /// mode: c++
 /// mode: hs-minor
 /// c-basic-offset: 4
+/// indent-tabs-mode: nil
 /// End:
Index: eliot/game/round.cpp
diff -u eliot/game/round.cpp:1.8 eliot/game/round.cpp:1.9
--- eliot/game/round.cpp:1.8    Mon Dec 26 22:55:26 2005
+++ eliot/game/round.cpp        Sun Jan  1 19:49:35 2006
@@ -144,7 +144,7 @@
 string Round::getWord() const
 {
   char c;
-  std::string s;
+  string s;
 
   for (int i = 0; i < getWordLen(); i++)
     {
@@ -175,6 +175,8 @@
 }
 
 /// Local Variables:
+/// mode: c++
 /// mode: hs-minor
 /// c-basic-offset: 4
+/// indent-tabs-mode: nil
 /// End:
Index: eliot/game/round.h
diff -u eliot/game/round.h:1.10 eliot/game/round.h:1.11
--- eliot/game/round.h:1.10     Mon Dec 26 15:52:48 2005
+++ eliot/game/round.h  Sun Jan  1 19:49:35 2006
@@ -81,8 +81,8 @@
      *************************/
     const Coord& getCoord() const { return m_coord; }
     Coord& accessCoord()          { return m_coord; }
-
-    std::string toString() const;
+    
+    string toString() const;
 
 private:
     vector<Tile> m_word;
@@ -93,3 +93,10 @@
 };
 
 #endif
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/tile.cpp
diff -u eliot/game/tile.cpp:1.5 eliot/game/tile.cpp:1.6
--- eliot/game/tile.cpp:1.5     Fri Nov  4 20:00:06 2005
+++ eliot/game/tile.cpp Sun Jan  1 19:49:35 2006
@@ -209,3 +209,9 @@
     return !(*this == iOther);
 }
 
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/tile.h
diff -u eliot/game/tile.h:1.6 eliot/game/tile.h:1.7
--- eliot/game/tile.h:1.6       Fri Nov  4 20:00:06 2005
+++ eliot/game/tile.h   Sun Jan  1 19:49:35 2006
@@ -73,3 +73,10 @@
 };
 
 #endif
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/training.cpp
diff -u eliot/game/training.cpp:1.14 eliot/game/training.cpp:1.15
--- eliot/game/training.cpp:1.14        Tue Dec 27 13:11:17 2005
+++ eliot/game/training.cpp     Sun Jan  1 19:49:35 2006
@@ -38,14 +38,20 @@
 {
 }
 
-int Training::setRackRandom(int p, bool iCheck, set_rack_mode mode)
+
+int Training::setRackRandom(bool iCheck, set_rack_mode mode)
 {
+#define MAX_RANDOM_TRY 5
+
     int res;
+    int try_number = 0;
+    int p = m_currPlayer;
     m_results.clear();
     do
     {
         res = helperSetRackRandom(p, iCheck, mode);
-    } while (res == 2);
+        try_number ++;
+    } while (res == 2 && try_number < MAX_RANDOM_TRY);
     // 0 : ok
     // 1 : not enough tiles
     // 2 : check failed (number of voyels before round 15)
@@ -64,9 +70,9 @@
     m_results.clear();
     uLetters = iLetters;
     for(it = uLetters.begin(); it != uLetters.end(); it ++)
-    {
-        *it = toupper(*it);
-    }
+      {
+       *it = toupper(*it);
+      }
     res = helperSetRackManual(p, iCheck, uLetters);
     // 0 : ok
     // 1 : not enough tiles
@@ -78,17 +84,17 @@
 {
     int res = 0;
     switch(iMode)
-    {
-        case RACK_MANUAL:
-            res = setRackManual(iCheck, iLetters);
-            break;
-        case RACK_ALL:
-            res = setRackRandom(m_currPlayer, iCheck, iMode);
-            break;
-        case RACK_NEW:
-            res = setRackRandom(m_currPlayer, iCheck, iMode);
-            break;
-    }
+       {
+       case RACK_MANUAL:
+           res = setRackManual(iCheck, iLetters);
+           break;
+       case RACK_ALL:
+           res = setRackRandom(iCheck, iMode);
+           break;
+       case RACK_NEW:
+           res = setRackRandom(iCheck, iMode);
+           break;
+       }
     return res;
 }
 
@@ -128,6 +134,7 @@
     return 0;
 }
 
+
 int Training::endTurn()
 {
     // Nothing to do?
@@ -140,7 +147,7 @@
     // Search for the current player
     Rack r;
     m_players[m_currPlayer]->getCurrentRack().getRack(r);
-//     debug("Training::search for %s\n",r.toString().c_str());
+    debug("Training::search for %s\n",r.toString().c_str());
     m_results.search(*m_dic, m_board, r, m_history.getSize());
 }
 
@@ -209,4 +216,5 @@
 /// mode: c++
 /// mode: hs-minor
 /// c-basic-offset: 4
+/// indent-tabs-mode: nil
 /// End:
Index: eliot/game/training.h
diff -u eliot/game/training.h:1.13 eliot/game/training.h:1.14
--- eliot/game/training.h:1.13  Mon Dec 26 22:53:26 2005
+++ eliot/game/training.h       Sun Jan  1 19:49:35 2006
@@ -52,7 +52,7 @@
     void search();
     int playResult(int);
 
-    virtual int setRackRandom(int, bool, set_rack_mode);
+    int setRackRandom(bool, set_rack_mode);
     int setRackManual(bool iCheck, const string &iLetters);
     int setRack(set_rack_mode iMode, bool iCheck, const string &iLetters);
 
@@ -87,3 +87,10 @@
 };
 
 #endif /* _TRAINING_H_ */
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/game/turn.cpp
diff -u eliot/game/turn.cpp:1.9 eliot/game/turn.cpp:1.10
--- eliot/game/turn.cpp:1.9     Mon Dec 26 19:43:21 2005
+++ eliot/game/turn.cpp Sun Jan  1 19:49:35 2006
@@ -47,9 +47,10 @@
 #if 0
 void Turn::operator=(const Turn &iOther)
 {
-    m_num     = iOther.m_num;
-    m_pldrack = iOther.m_pldrack;
-    m_round   = iOther.m_round;
+    m_num      = iOther.m_num;
+    m_playerId = iOther.m_playerId;
+    m_pldrack  = iOther.m_pldrack;
+    m_round    = iOther.m_round;
 }
 #endif
 
@@ -64,8 +65,9 @@
     return rs;
 }
 
-
 /// Local Variables:
+/// mode: c++
 /// mode: hs-minor
 /// c-basic-offset: 4
+/// indent-tabs-mode: nil
 /// End:
Index: eliot/game/turn.h
diff -u eliot/game/turn.h:1.7 eliot/game/turn.h:1.8
--- eliot/game/turn.h:1.7       Mon Dec 26 19:17:49 2005
+++ eliot/game/turn.h   Sun Jan  1 19:49:35 2006
@@ -60,8 +60,9 @@
 
 #endif
 
-
 /// Local Variables:
+/// mode: c++
 /// mode: hs-minor
 /// c-basic-offset: 4
+/// indent-tabs-mode: nil
 /// End:




reply via email to

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