From 906c442380e75804539a35ed4c661e3886bc5487 Mon Sep 17 00:00:00 2001 From: Luiza Wille <lmwc14@inf.ufpr.br> Date: Thu, 1 Jun 2017 09:04:02 -0300 Subject: [PATCH] added explanations for old and new heuristic on test 5 Signed-off-by: Luiza Wille <lmwc14@inf.ufpr.br> --- .README.md.swp | Bin 0 -> 12288 bytes README.md | 69 ++++++++++++++++----------- customTests/testeBasico.txt | 3 -- customTests/testeMsmaCor.txt | 3 -- tests/luizaTests.sh | 87 ----------------------------------- 5 files changed, 41 insertions(+), 121 deletions(-) create mode 100644 .README.md.swp delete mode 100644 customTests/testeBasico.txt delete mode 100644 customTests/testeMsmaCor.txt delete mode 100755 tests/luizaTests.sh diff --git a/.README.md.swp b/.README.md.swp new file mode 100644 index 0000000000000000000000000000000000000000..cf1cddbe9b0e8ac1cb5338a7f99f5c82d8c7bd61 GIT binary patch literal 12288 zcmeHNON<mn7%qGR@(3hiIG7SOz-D%4dS-W7SJW(F7clY&3@<k%+cR6UQ_$Tt_JiH! zf>Au^K@$#oGbWgrNYJQPQAy;WiQX{Ac*1Cm@uUai&F`;&YW9_|?8SuG6TX@1?yCRs zeSbZMoqGA$zWs7Xu}|Q&UWm8<DV|)rt}LpXg@}zw>Go2u&;;t7zf><FN-YzrQjqC$ zerdO9WTA@Eq@<!o3k_8|JTkm{|41>MSlUwFBWECIU|9@gX|s25ji^?<GL3s|%cFAR zhNH_ek$27+$Qj5P$Qj5P$Qj5P$Qj5P$Qih^8A#hJ#CfD}S0@ekg?~lo+I`;HS?1B_ z4CD;t4CD;t4CD;t4CD;t4CD;t4CD;t4E(<t@bTC7FF?U%`VRp7{oj56zq(F{&wy!Q z5cqqo5FY|pfY*UnfR}--z(!yLaCHsF0GEIZfC8Qdb^=cU>w$H^<p+iM0EmG#!1dKa zd<DD&oCnSTr-1{&bHH9;7w`=5^C}^30^b4O0v`icfXl%9z$IWWum`9D72qLY1F#;r z2N1wFD~0$P_!RgAcni1)ya{Xvo&Z(@tALfjUk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n+xyco4P&MZc8wQ*9y%(dHj8a9|O~TXgq?JSkt0$N9LEv}ptC*o(5TuHr;C zO@^Cw6__a*scGv^`HhxLaX=|bG2AVbwn-9Q58%qM5>hwqg6YmR_GHyaGd~ERRp)>O z+0vOdM3cpmnpTM19CE3+@I<X;64-^uL^k{g;dJ8CQKE5#q9SQ(xZcvplGKEBcuKYu zk)_&7hbvryGU}z8P2JEq(alK1(fProiFMiv<rLoMbGe90q&BG{75k}@b>qhq37nLA zyRYG02ancdZSRPzjU1^Rk=+NjQNoH*T<{tLZQ9B-?N95ZAZO^~)S`a#hY33@A$7fi zcS_EGS`=f}*eN;2*5p{j1SW=As}~V5y6^dsV(mmtCM}Z%ICr>HXwwAHngj`PIt}DD z$Yoj4sfrTU9SUgt0DBT8vK`g*IMfS$9m$<t!-BVtf{e4sj<<*1F2_1*nmFVF_3Nf{ zxSqCCe?}4qwn?FKDUx24MHVOIFZ9nSVHfcNZij7BpE_GF-J(KhiAvp29JpIXHxyPC z1GPD<Nk3H1RU~7TW-&kLmaUxvMM2gN1^$eRF_t)q?ef#qm;u``NpRmQ)7OIx^|svx zQ%B)RH!o1d3k)Cyu!wIPqk%CKy;#<4Ft)IG39kDz*P*gb3u2Ext2ngo48dflE;j1| zCOStpg?d(Y>Y1s?#Z1JYSnZ+<aw(g`BZm$m<EDyZ(i^1Ek#jgsbrU7&2XY@I4g!sm PZzzcs<}|(%4T*mN0h8Ty literal 0 HcmV?d00001 diff --git a/README.md b/README.md index 4d6f9c6..2adf0f7 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,31 @@ This is the REPO referring to our Artifitial Intelligence project: -* Given the Professor's base code, we will write our own Player code. -* The Player will take in a Flood-It game board, and based on it, -* the Player will try to find (under 10 minutes) the best possible -set of color choices to win the game and return it. +Given the Professor's base code, we will write our own Player code. +The Player will take in a Flood-It game board, and based on it, +the Player will try to find (under 10 minutes) the best possible +set of color choices to win the game and then return the sequence found. First, compile the code by typing: -* `make` +$ make Second, run the code with the information about the x and y axis and the number of colours -* `./main < FILE.TXT` +$ ./main < FILE.TXT And the FILE.TXT should have the following model (all the itens should be integers): -``` + [xaxis] [yaxis] [colors] [posision 1,1] ............... .............................. ................[position xaxis, yaxis] -``` + /----------ABOUT THE TESTS --------------/ -We've tested the efficiency of our algorithm with the professors implementation to genrate boards. +We've tested the efficiency of our algorithm with the professors implementation to generate boards. + +Those tests can be found inside the file "customTests". +And it is possible to check if our sequence is actually correct by typing ./exemploProfessor X Y Z W +Where X Y Z W correspond to the numbers found below next to each test. Used as input to the professor's implementation were the sequences: @@ -61,6 +65,34 @@ Our code gave the sequence: ``` It is a correct sequence. + +**Test 5- 50 50 6 2** + +First heuristic, our code gave the correct sequence: +``` +80 +2 1 3 4 2 6 5 2 1 3 5 4 1 3 2 4 5 2 5 4 2 3 5 1 2 6 4 1 6 3 2 5 4 6 1 2 6 4 2 5 6 2 4 1 2 3 6 4 1 3 5 2 6 3 1 2 3 5 4 2 1 5 6 4 1 5 3 5 4 1 6 2 3 4 5 1 2 6 3 4 +``` +Second heuristic, our code gave the sequence: +``` +88 +2 1 3 6 2 4 1 2 4 5 4 6 1 4 3 2 1 4 5 3 6 2 5 4 6 2 5 3 1 4 6 3 2 4 5 1 3 6 4 2 5 1 6 4 2 1 3 6 4 2 5 1 3 2 6 4 1 3 5 4 2 6 3 5 1 4 6 2 5 3 1 4 5 6 2 1 4 3 2 1 5 6 4 3 5 2 1 6 +``` + +**Test 6- 100 100 6 2** + +First heuristic: our code gave the sequence(not tested): +``` +172 +5 2 1 5 3 2 4 1 4 2 3 1 4 5 3 6 4 1 2 4 6 2 5 1 3 6 4 5 6 1 4 3 2 5 6 4 2 1 3 6 5 3 4 2 1 5 3 4 2 1 5 4 6 1 3 5 2 4 1 6 2 4 5 3 4 2 3 5 4 1 2 6 5 3 1 4 5 2 1 4 3 6 5 2 4 1 3 2 4 6 2 1 3 5 6 4 3 1 5 6 4 2 1 3 5 2 6 4 1 3 2 4 5 1 3 6 4 5 1 3 6 2 5 1 4 6 3 1 2 6 5 3 2 4 1 5 6 4 3 6 1 3 6 5 4 1 6 5 3 2 6 5 2 1 3 1 6 3 4 2 3 1 6 5 2 3 6 4 1 5 3 2 +``` + +Second heuristic, our code gave the sequence: +``` +186 +5 2 1 5 3 2 4 1 4 2 3 1 4 5 6 4 1 2 3 6 4 2 5 1 3 6 2 4 5 1 3 4 6 5 2 4 1 3 6 2 5 1 3 4 2 6 1 5 4 3 2 5 6 1 4 3 2 5 6 1 4 3 2 5 4 1 6 2 5 3 1 4 2 6 5 3 1 2 4 6 3 5 4 1 2 6 5 3 2 4 1 5 6 3 2 4 5 1 3 6 2 4 1 5 6 2 3 1 4 2 5 6 1 3 4 5 6 2 1 4 5 3 6 1 4 2 3 5 6 1 2 4 3 1 6 5 2 4 1 3 2 5 6 4 1 3 6 5 2 4 1 3 6 5 4 2 6 1 5 4 3 6 2 1 3 5 1 4 2 3 1 5 3 4 6 2 5 3 1 6 4 2 1 3 5 6 +``` + **Test 7- 5 5 4 3** Our code gave the sequence: @@ -82,22 +114,3 @@ It is a correct sequence, but the minimum sequence is: 19 4 1 4 5 2 1 5 1 2 4 6 2 3 6 3 2 4 5 1 ``` - - -**--------------- NOT ANALYSED yet --------------** - -**Test 5- 50 50 6 2** - -Our code gave the sequence: -``` -80 -2 1 3 4 2 6 5 2 1 3 5 4 1 3 2 4 5 2 5 4 2 3 5 1 2 6 4 1 6 3 2 5 4 6 1 2 6 4 2 5 6 2 4 1 2 3 6 4 1 3 5 2 6 3 1 2 3 5 4 2 1 5 6 4 1 5 3 5 4 1 6 2 3 4 5 1 2 6 3 4 -``` - -**Test 6- 100 100 6 2** - -Our code gave the sequence: -``` -172 -5 2 1 5 3 2 4 1 4 2 3 1 4 5 3 6 4 1 2 4 6 2 5 1 3 6 4 5 6 1 4 3 2 5 6 4 2 1 3 6 5 3 4 2 1 5 3 4 2 1 5 4 6 1 3 5 2 4 1 6 2 4 5 3 4 2 3 5 4 1 2 6 5 3 1 4 5 2 1 4 3 6 5 2 4 1 3 2 4 6 2 1 3 5 6 4 3 1 5 6 4 2 1 3 5 2 6 4 1 3 2 4 5 1 3 6 4 5 1 3 6 2 5 1 4 6 3 1 2 6 5 3 2 4 1 5 6 4 3 6 1 3 6 5 4 1 6 5 3 2 6 5 2 1 3 1 6 3 4 2 3 1 6 5 2 3 6 4 1 5 3 2 -``` diff --git a/customTests/testeBasico.txt b/customTests/testeBasico.txt deleted file mode 100644 index 8a082a5..0000000 --- a/customTests/testeBasico.txt +++ /dev/null @@ -1,3 +0,0 @@ -2 2 3 -1 2 -3 1 diff --git a/customTests/testeMsmaCor.txt b/customTests/testeMsmaCor.txt deleted file mode 100644 index 29bbd90..0000000 --- a/customTests/testeMsmaCor.txt +++ /dev/null @@ -1,3 +0,0 @@ -2 2 1 -2 2 -2 2 diff --git a/tests/luizaTests.sh b/tests/luizaTests.sh deleted file mode 100755 index 2098bb1..0000000 --- a/tests/luizaTests.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash - -# tempo máximo para executar, em milisegundos -tempo_max=10000 #10s - -# tamanhos do tabuleiro -tams=(4) - -# lista de cores -cores=(2) - -#-- Cores do terminal -RED='\033[0;31m' -GREEN='\033[0;32m' -BLUE='\033[0;34m' -CYAN='\033[0;36m' -NC='\033[0m' # Sem cor - -echo -ne "" > tabuleiros.txt -echo -ne "#Tam tabuleiro\t#N cores\t#Tempo médio\n" > tempos.txt -echo -ne "#Tam tabuleiro\t#Tempo médio\n" > medias.txt -echo -ne "#Tam tabuleiro\t#N cores\t#Tempo médio\n" > piores.txt - -echo "Iniciado testes" -for i in ${tams[*]} -do - echo "Tamanho do tabuleiro: ${i}" - T_soma_total=0 - for cor in ${cores[*]} - do - echo "Número de cores: ${cor}" - T_soma_cor=0 - T_max_cor=0 - for j in $(seq 1 $i) - do - echo -ne "Tabuleiro com ${i} linhas e ${cor} cores: ${i}x${j} (T max: $(($T_max_cor/1000000000))." - printf "%03d" $(($T_max_cor/1000000)) - echo -ne ")"\\r - semente=$RANDOM - # echo "Usando semente: ${semente}" - ./test $i $j $cor $semente - T_inicial=$(date +%s%N) - ../main < "/tmp/${semente}.in" > /dev/null - T_gasto=$(($(date +%s%N) - $T_inicial)) - T_soma_cor=$(($T_gasto + $T_soma_cor)) - T_soma_total=$(($T_gasto + $T_soma_total)) - # tempo em segundos - S=$(($T_gasto/1000000000)) - # tempo em milisegundos - M=$(($T_gasto/1000000)) - # tempo máximo por cor - if [ $T_max_cor -lt $T_gasto ]; then - T_max_cor=$T_gasto - fi - if (($M>$tempo_max)); then - echo -e "\n${RED}Tabuleiro ${i} ${j} ${cor} ${semente} levou mais de ${tempo_max} milisegundos: ${S}.${M}s${NC}" - echo "${i} ${j} ${cor} ${semente}" >> tabuleiros.txt - fi - rm "/tmp/${semente}.in" - done - T_medio_cor=$(($T_soma_cor/$i)) - S_medio_cor=$(($T_medio_cor/1000000000)) - M_medio_cor=$(($T_medio_cor/1000000)) - echo -ne "\n${CYAN}Tempo médio com ${cor} cores: ${S_medio_cor}." - printf "%03d" ${M_medio_cor} - echo -e "s (${T_medio_cor})${NC}\n" - echo -e "${i}\t${cor}\t${M_medio_cor}" >> tempos.txt - echo -e "${i}\t${cor}\t$(($T_max_cor/1000000))" >> piores.txt - done - T_medio_total=$(( $T_soma_total/($i * ${#cores[*]}) )) - S_medio_total=$(($T_medio_total/1000000000)) - M_medio_total=$(($T_medio_total/1000000)) - echo -ne "${BLUE}Tempo médio com tamanho ${i}: ${S_medio_total}." - printf "%03d" ${M_medio_total} - echo -e "s (${T_medio_total})${NC}\n" - echo -e "${i}\t${M_medio_total}" >> medias.txt -done - -fs=$(cat tabuleiros.txt | wc -l) -if [ ${fs} -gt "1" ]; then - echo -e "${RED}${fs} tabuleiro(s) passou(passaram) do tempo limite de ${tempo_max} milisegundos:${NC}" - cat tabuleiros.txt - exit 1 -else - echo -e "${GREEN}Nenhum tabuleiro passou do tempo limite de ${tempo_max} milisegundos${NC}" - exit 0 -fi -- GitLab