eliot-dev
[Top][All Lists]
Advanced

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

[Eliot-dev] Changes to eliot/game/player.cpp [antoine-1]


From: eliot-dev
Subject: [Eliot-dev] Changes to eliot/game/player.cpp [antoine-1]
Date: Sun, 23 Oct 2005 13:16:34 -0400

Index: eliot/game/player.cpp
diff -u /dev/null eliot/game/player.cpp:1.5.2.1
--- /dev/null   Sun Oct 23 17:16:34 2005
+++ eliot/game/player.cpp       Sun Oct 23 17:16:24 2005
@@ -0,0 +1,146 @@
+<<<<<<< player.cpp
+/* Copyright (C) 2004-2005 Eliot                                             */
+/* Authors: Olivier Teuliere  <address@hidden>                            */
+/*                                                                           */
+/* This file is part of Eliot.                                               */
+/*                                                                           */
+/* Eliot is free software; you can redistribute it and/or modify             */
+/* it under the terms of the GNU General Public License as published by      */
+/* the Free Software Foundation; either version 2 of the License, or         */
+/* (at your option) any later version.                                       */
+/*                                                                           */
+/* Eliot is distributed in the hope that it will be useful,                  */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of            */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             */
+/* GNU General Public License for more details.                              */
+/*                                                                           */
+/* You should have received a copy of the GNU General Public License         */
+/* along with this program; if not, write to the Free Software               */
+/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+/* $Id: player.cpp,v 1.5.2.1 2005/10/23 17:16:24 afrab Exp $ */
+
+/**
+ *  \file   player.cpp
+ *  \brief  Eliot player class
+ *  \author Olivier Teuliere
+ *  \date   2005
+ */
+=======
+/*****************************************************************************
+ * Copyright (C) 2004-2005 Eliot
+ * Authors: Olivier Teuliere  <address@hidden>
+ *
+ * $Id: player.cpp,v 1.5.2.1 2005/10/23 17:16:24 afrab Exp $
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *****************************************************************************/
+>>>>>>> 1.5
+
+#include "tile.h"
+#include "rack.h"
+#include "pldrack.h"
+#include "round.h"
+#include "turn.h"
+#include "results.h"
+#include "board.h"
+#include "player.h"
+
+#include "debug.h"
+
+/* ******************************************************** */
+/* ******************************************************** */
+/* ******************************************************** */
+
+Player::Player(int number)
+{
+    m_num   = number;
+    m_score = 0;
+    m_name  = "eliot";
+}
+
+Player::~Player()
+{
+}
+
+
+const PlayedRack Player::getCurrentRack() const
+{
+    return m_history.getCurrentRack();
+}
+
+
+void Player::setCurrentRack(const PlayedRack &iPld)
+{
+    gdebug("Player::setCurrentRack\n");
+    m_history.setCurrentRack(iPld);
+}
+
+
+const Turn Player::getPreviousTurn() const
+{
+    return m_history.getPreviousTurn();
+}
+
+
+void Player::playRound(int iTurn, const Round &iRound)
+{
+    gdebug("Player::playRound\n");
+    m_history.playRound(m_num,iTurn,iRound);
+    addPoints(iRound.getPoints());
+}
+
+
+void Player::removeLastTurn()
+{
+    gdebug("Player::removeLastTurn\n");
+    Round r  = m_history.getPreviousTurn().getRound();
+    m_score -= r.getPoints();
+    m_history.removeLastTurn();
+}
+
+
+void Player::addPoints(int s)
+{
+    gdebug("Player::addPoints\n");
+    m_score += s; 
+}
+
+
+int Player::getPoints() const
+{
+    return m_score; 
+}
+
+
+std::string
+Player::toString()
+{
+    std::string rs;
+    char sp[5];
+    sprintf(sp,"%d",m_score);
+    rs = m_history.toString() + std::string("\ntotal:\t") + sp + 
std::string("\n");
+    return rs;
+}
+
+/* ******************************************************** */
+/* ******************************************************** */
+/* ******************************************************** */
+
+
+/// Local Variables:
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// End:




reply via email to

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