#!/bin/bash

n=100


function analyzeGame()
{
    resultGame=`grep "score" outGame.txt |  tail -1`
}

function analyzeSecGame()
{
    resultSecGame=`grep "score" outSecGame.txt |  tail -1`
}

i=1
while (( i <= n )); do # while (( 1 )); do
    Game -s $i Dummy Dummy Dummy Dummy < default.cnf > outGame.txt 2> tmp.log
    SecGame -s $i Dummy Dummy Dummy Dummy < default.cnf > outSecGame.txt 2> tmp.log
    analyzeGame
    analyzeSecGame
    echo "Seed $i"
    echo $resultGame
    echo $resultSecGame
    if [ "$resultGame" != "$resultSecGame" ]; then
	echo "Problema amb seed " $i
	exit;
    fi
    ((++i))    
done
