#!/bin/sh
# file: testcase.sh
# author: Rick van der Zwet, 0433373
# University Leiden, LIACS
timesPlayed=0
timesWon=0
timesLost=0
if [ "x$1" == "x" ]; then
    totalNumber=100
else
    totalNumber=$1
fi

for puzzle in `cat puzzles17`
do
    let "timesPlayed+=1"
    sleep 1
    ./sudoku -c $2 | ./sudoku -f - >/dev/null
    if [ "x$?" == "x0" ]; then
        let "timesWon+=1"
    else
        let "timesLost+=1"
    fi
    echo "Played: ${timesPlayed}"
    echo "won   : ${timesWon}"
    echo "lost  : ${timesLost}"
    if [ "x${timesPlayed}" == "x${totalNumber}" ]; then
        break
    fi
done


