From bbdd9248f68bd298435be12869c2c870b91d0660 Mon Sep 17 00:00:00 2001
From: Vytor Calixto <vytorcalixto@gmail.com>
Date: Sun, 18 Jun 2017 01:44:35 -0300
Subject: [PATCH] =?UTF-8?q?Muda=20testes,=20arruma=20aloca=C3=A7=C3=A3o?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 libs/jogador.c    |  1 -
 tests/runTests.sh | 23 +++++++++++++++++------
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/libs/jogador.c b/libs/jogador.c
index d92e656..8cce92d 100644
--- a/libs/jogador.c
+++ b/libs/jogador.c
@@ -216,7 +216,6 @@ int calculaBonusRec(Vertice v, Vertice pai, Grafo g, int profundidade) {
         Vertice filho = (Vertice) getConteudo(n);
         if((filho->altura > v->altura)) {
             int preBonus = filho->peso + calculaBonusRec(filho, v, g, profundidade-1);
-            Lista fFilhos = agrupaCores(filho->filhos);
             bonus += preBonus;
         }
     }
diff --git a/tests/runTests.sh b/tests/runTests.sh
index 6da7fb7..2b09c06 100755
--- a/tests/runTests.sh
+++ b/tests/runTests.sh
@@ -23,10 +23,10 @@ echo $HEUR
 tempo_max=120000 #120s
 
 # tamanhos do tabuleiro
-tams=(3 4 8 16)
+tams=(4 8 16 32)
 
 # lista de cores
-cores=(2 3 4 6 8 10)
+cores=(4 8 10)
 
 #-- Cores do terminal
 RED='\033[0;31m'
@@ -52,12 +52,15 @@ do
         echo "Número de cores: ${cor}"
         T_soma_cor=0
         T_max_cor=0
-        N_TESTES=500
+        N_TESTES=100
+        VIT=0
+        EMP=0
+        DER=0
         for j in $(seq 1 ${N_TESTES})
         do
             echo -ne "Tabuleiro ${i}x${i} com ${cor} cores: (${j}/${N_TESTES}) (T max: $(($T_max_cor/1000000000))."
             printf "%03d" $(($T_max_cor/1000000%1000))
-            echo -ne ")"\\r
+            echo -ne ") (${GREEN}${VIT}${NC}/${BLUE}${EMP}${NC}/${RED}${DER}${NC})"\\r
             semente=$RANDOM
             ./test $i $i $cor $semente
 
@@ -75,10 +78,18 @@ do
             HRESP=$(cat "/tmp/heur${semente}.out" | tail -n2 | head -n1)
 
             if [ $RESP -gt $HRESP ]; then
-                echo -ne "${RED}Heurística $(basename ${HEUR}) fez tabuleiro ${i} ${i} ${cor} ${semente} em ${HRESP} e nós em ${RESP}${NC}\n"
+                #echo -ne "${RED}Heurística $(basename ${HEUR}) fez tabuleiro ${i} ${i} ${cor} ${semente} em ${HRESP} e nós em ${RESP}${NC}\n"
                 echo "${i} ${i} ${cor} ${semente} (${HRESP})" >> ${TABULEIROS}
+                DER=$(($DER + 1))
+            fi
+            if [ $RESP -eq $HRESP ]; then
+                #echo -ne "${BLUE}Empatamos com $(basename ${HEUR}) no tabuleiro ${i} ${i} ${cor} ${semente} em ${HRESP}${NC}\n"
+                EMP=$(($EMP + 1))
+            fi
+            if [ $RESP -lt $HRESP ]; then
+                #echo -ne "${GREEN}Ganhamos de  $(basename ${HEUR}) no tabuleiro ${i} ${i} ${cor} ${semente} com ${RESP}${NC}\n"
+                VIT=$(($VIT + 1))
             fi
-
             # tempo em segundos
             S=$(($T_gasto/1000000000))
             # tempo em milisegundos
-- 
GitLab