Merge pull request #71 from xexyl/1991-westley

Fix in 1991/westley/ttt.sh
This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-03-17 11:03:57 -07:00
commit 494550225c
2 files changed
+8 -8

No files matched your search

+5 -5
View File
@@ -11,19 +11,19 @@
### To run ### To run
Make and run as follows: Make and run as follows:
./westley [move_location] | tee nextmove.c ./westley [move_location] | tee nextmove.c
where the 'move_location' is a digit from 1 to 9 that represents where the 'move_location' is a digit from 1 to 9 that represents
a move on a tic-tac-toe board: a move on a tic-tac-toe board:
1 2 3 1 2 3
4 5 6 4 5 6
7 8 9 7 8 9
If you omit 'move_location', then the computer moves first. For your If you omit 'move_location', then the computer moves first. For your
next move, recompile nextmove.c and play it again: next move, recompile `nextmove.c` and play it again:
make nextmove make nextmove
./nextmove move_location | tee nextmove.c ./nextmove move_location | tee nextmove.c
+3 -3
View File
@@ -61,7 +61,7 @@ if [ ! -f merlyn.c ]; then
fi fi
# check to see if the copy worked # check to see if the copy worked
if [ ! -f merlyn.c ]; then if [ ! -f merlyn.c ]; then
echo "ttt: Darn, coundn't copy westley.c to merlyn.c" 1>&2 echo "ttt: Darn, couldn't copy westley.c to merlyn.c" 1>&2
exit 4 exit 4
fi fi
fi fi
@@ -85,9 +85,9 @@ fi
if [ ! -w ttt_game.c ]; then if [ ! -w ttt_game.c ]; then
rm -f ttt_game.c rm -f ttt_game.c
if [ -z "$move" ]; then if [ -z "$move" ]; then
merlyn | tee ttt_game.c ./merlyn | tee ttt_game.c
else else
merlyn "$move" | tee ttt_game.c ./merlyn "$move" | tee ttt_game.c
fi fi
chmod +w ttt_game.c chmod +w ttt_game.c