#!/bin/sh

name=nils

while read command a1 a2 a3
do
    (echo ">> command: $command"
    echo ">> a1:      $a1"
    echo ">> a2:      $a2"
    echo ">> a3:      $a3") > /dev/null # >&2
    echo "$command $a1 $a2 $a3" >&2
    case $command in
	HELO)
	    echo "AUTH $name Hi there!"
	    ;;
	TURN)
	    echo "ROLL los geht's!"
	    echo "Spielstand ${a1}:${a2}" >&2
	    ;;
	THRW)
	    echo "Spielstand ..." > /dev/null
	    ;;
	WIN|DEF)
	    echo "Spielende: $command" >&2
	    exit 0
	    ;;
	*)
	    echo "komisches Kommando: $command" >&2
	    ;;
	esac
done
