Format fixes in 1991/westley/README.md

This commit is contained in:
Cody Boone Ferguson committed 2023-04-09 09:02:36 -07:00
1 parent fcebc83dea
commit 8896c22edb
1 file changed
+29 -17
+29 -17
View File
@@ -3,57 +3,69 @@
Brian Westley (Merlyn LeRoy on usenet) Brian Westley (Merlyn LeRoy on usenet)
DigiBoard, Inc. DigiBoard, Inc.
1026 Blair Ave. 1026 Blair Ave.
St. Paul, MN 55104 USA St. Paul, MN 55104
USA
http://www.westley.org <http://www.westley.org>
## To build: ## To build:
```sh
make all make all
```
## To run ## To run:
Make and run as follows: Make and run as follows:
./westley [move_location] | tee nextmove.c
where the 'move_location' is a digit from 1 to 9 that represents ```sh
./westley [move_location] | tee nextmove.c
```
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:
```sh
make nextmove make nextmove
./nextmove move_location | tee nextmove.c ./nextmove move_location | tee nextmove.c
```
## Judges' comments ## Judges' comments:
We have provided the shell script, ttt, to make it easier to play the game: We have provided the shell script, [ttt](ttt.sh), to make it easier to play the game:
```sh
make ttt make ttt
./ttt [first_move] <- omit first arg to have it move first ./ttt [first_move] <- omit first arg to have it move first
./ttt next_move ./ttt next_move
```
The shell script determines when the game is over, and automatically The shell script determines when the game is over, and automatically
replaces merlyn.c with an improved version after a loss. The ttt script replaces `merlyn.c` (copied from [westley.c](westley.c) with an improved version after a loss. The [ttt](ttt.sh) script
has two other modes: has two other modes:
./ttt quitgame <- cancel any game in process, revert to merlyn.c ```sh
./ttt clobber <- remove all game files, revert to original source ./ttt quitgame # cancel any game in process, revert to merlyn.c
./ttt clobber # remove all game files, revert to original source
```
Try not to cheat, the computer has not learned how to catch you doing it. Try not to cheat, the computer has not learned how to catch you doing it.
## Author's comments ## Author's comments:
A tic-tac-toe self-modifying program that "learns". This C program A tic-tac-toe self-modifying program that "learns". This C program
plays standard tic-tac-toe on itself. The code is written as a plays standard tic-tac-toe on itself. The code is written as a
tic-tac-toe grid; moves are carried out within the code. tic-tac-toe grid; moves are carried out within the code.
The human is X, the computer 0 [sic, "zero", not letter "O"]. The human is `X`, the computer `0` [sic, "zero", not letter "O"].
The program, when run, reproduces itself with both the player's The program, when run, reproduces itself with both the player's
move and the computer's move added. Recompile THIS program (using move and the computer's move added. Recompile THIS program (using
@@ -68,10 +80,10 @@ next move, recompile `nextmove.c` and play it again:
longer loses games. longer loses games.
If you want a program that never loses, simply replace the string If you want a program that never loses, simply replace the string
"9999999999 :-| " with "9883857753 :-| ". `"9999999999 :-| "` with `"9883857753 :-| "`.
### How It Works (rot13 to read):
How It Works (rot13 to read)
----------------------------
Gur iregvpny "onef" bs gur tevq ner vqragvpny shapgvbaf, jvgu gur Gur iregvpny "onef" bs gur tevq ner vqragvpny shapgvbaf, jvgu gur
anzr bs gur shapgvba nf n(), o(), be p(). Nsgre rnpu shapgvba vf anzr bs gur shapgvba nf n(), o(), be p(). Nsgre rnpu shapgvba vf