#!/bin/sh PATH="/home/comp210/bin:.:$PATH" export PATH MRED="mred" PENTE="/home/comp210/Projects/Connect5/bin/pente-gui.ss" SIZE="" TIME="" QUIET="verbose" PLAYONE="" PLAYTWO="" TYPEONE="" TYPETWO="" while [ -n "$1" ]; do case "$1" in -n | --size ) SIZE="$2" shift ; shift ;; -t | --time ) TIME="$2" shift ; shift ;; -q | --quiet ) QUIET="quiet" shift ;; -p1 | --player1 ) PLAYONE="$2" shift ; shift ;; -p2 | --player2 ) PLAYTWO="$2" shift ; shift ;; -f1 | --format1 ) TYPEONE="$2" shift ; shift ;; -f2 | --format2 ) TYPETWO="$2" shift ; shift ;; * ) case "$1" in -h | -help | --help ) ;; * ) echo "Unknown option: $1" ;; esac echo "The command line options are:" echo " -n : sets size of board" echo " -t : sets the time per move in seconds" echo " -p1 : sets player 1" echo " -p2 : sets player 2" echo " -f1 : sets the type of program 1 (scheme or exec)" echo " -f2 : sets the type of program 2" echo " -q : suppress all output except final result" echo "A file ending in .ss implicitly sets type to scheme" echo "unless overridden by -f flag. Any options not set" echo "on the command line are promted." exit ;; esac done while [ -z "$SIZE" ]; do echo "Enter the size of the board:" read SIZE FOO done while [ -z "$TIME" ]; do echo "Enter the time limit per move in seconds:" read TIME FOO done while [ -z "$PLAYONE" ]; do echo "Enter the pathname for Player 1:" echo "You probably want a full pathname here." read PLAYONE FOO done while [ -z "$PLAYTWO" ]; do echo "Enter the pathname for Player 2:" echo "You probably want a full pathname here." read PLAYTWO FOO done if [ -z "$TYPEONE" ]; then if [ -x "$PLAYONE" ]; then TYPEONE="exec" fi case "$PLAYONE" in *[.]ss ) TYPEONE="scheme" ;; esac if [ -z "$TYPEONE" ]; then echo "Is Player 1 ($PLAYONE) a scheme program [y|n]?" read ANS case "$ANS" in [yY]* ) TYPEONE="scheme" ;; * ) TYPEONE="exec" ;; esac fi fi if [ -z "$TYPETWO" ]; then if [ -x "$PLAYTWO" ]; then TYPETWO="exec" fi case "$PLAYTWO" in *[.]ss ) TYPETWO="scheme" ;; esac if [ -z "$TYPETWO" ]; then echo "Is Player 2 ($PLAYTWO) a scheme program [y|n]?" read ANS case "$ANS" in [yY]* ) TYPETWO="scheme" ;; * ) TYPETWO="exec" ;; esac fi fi export SIZE export TIME export QUIET export PLAYONE export PLAYTWO export TYPEONE export TYPETWO CURDIR=`pwd` export CURDIR echo "Starting Connect5 window (please wait) ..." exec $MRED -nu -f $PENTE