eliot-dev
[Top][All Lists]
Advanced

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

[Eliot-dev] eliot/game player.h player.cpp


From: eliot-dev
Subject: [Eliot-dev] eliot/game player.h player.cpp
Date: Mon, 26 Dec 2005 22:52:38 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Branch:         
Changes by:     Antoine Fraboulet <address@hidden>      05/12/26 22:52:38

Modified files:
        game           : player.h player.cpp 

Log message:
        - add toString method

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/player.h.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/player.cpp.diff?tr1=1.10&tr2=1.11&r1=text&r2=text

Patches:
Index: eliot/game/player.cpp
diff -u eliot/game/player.cpp:1.10 eliot/game/player.cpp:1.11
--- eliot/game/player.cpp:1.10  Mon Dec 26 21:18:21 2005
+++ eliot/game/player.cpp       Mon Dec 26 22:52:38 2005
@@ -71,6 +71,21 @@
     m_history.playRound(m_id,iTurn,iRound);
 }
 
+
+const string Player::toString() const
+{
+    char buff[20];
+    string res;
+
+    sprintf(buff,"Player %d\n",m_id);
+    res = string(buff);
+    res += m_history.toString();
+    res += "\n";
+    sprintf(buff,"score %d\n",m_score);
+    res += string(buff);
+    return res;
+}
+
 /****************************************************************/
 /****************************************************************/
 
Index: eliot/game/player.h
diff -u eliot/game/player.h:1.14 eliot/game/player.h:1.15
--- eliot/game/player.h:1.14    Mon Dec 26 21:18:21 2005
+++ eliot/game/player.h Mon Dec 26 22:52:38 2005
@@ -21,6 +21,7 @@
 #define _PLAYER_H_
 
 #include <vector>
+#include <string>
 #include "pldrack.h"
 #include "history.h"
 
@@ -66,6 +67,8 @@
     // A new rack is created with the remaining letters
     void endTurn(const Round &iRound, int iTurn);
 
+    const std::string toString() const;
+
 private:
     /// ID of the player
     int m_id;




reply via email to

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