From def0b7f0288abb3943dc59828a22b1590dde8b00 Mon Sep 17 00:00:00 2001
From: Romain Lebouc <rlebouc@insa-rennes.fr>
Date: Mon, 9 Nov 2015 10:57:34 +0100
Subject: [PATCH] Implemented function to_string

String representation of the whole board
---
 src/game/morpion.cpp | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/game/morpion.cpp b/src/game/morpion.cpp
index e3445ce..eaae6d1 100644
--- a/src/game/morpion.cpp
+++ b/src/game/morpion.cpp
@@ -156,9 +156,22 @@ namespace game
 
 	string morpion::to_string() const
 	{
-		//for (int i = 0
-		//TODO PAR ROMAIN
-		return "";
+		string result = "";
+		for (int row = 2; row >= 0; row--)
+		{
+			result += "|"
+			for (int col = 2; col >= 0; col--)
+			{
+				if(((state.cross_bitboard >> 3*row) >> col) & 1)
+					result += player_to_string(CROSS)+"|";
+				else if (((state.circle_bitboard >> 3*row) >> col) & 1)
+					result += player_to_string(CIRCLE)+"|";
+				else
+					result += " |";
+			}
+			result += "\n-------\n";
+		}
+		return result;
 	}
 
 	void morpion::playout(mt19937& engine, int max_depth)
-- 
GitLab