cleanup winner README.md files

Fixed cases where there was a bad trailing backslash.

Improved a few cases where a code block was needed
to highlight some text.

Changed a few cases where a code block needed to
declared as, say, a sh code block.

Fixed a few cases where the winner information was not properly formatted.

Plus a few nits and clarifying text was added.
This commit is contained in:
Landon Curt Noll committed 2023-11-04 03:21:11 -07:00
1 parent 394f710bc3
commit 360708f858
120 files changed
+1198 -1024

No files matched your search

+35 -39
View File
@@ -43,60 +43,56 @@ it) or when you type `^D` (EOF).
### Hints on how to cheat
Rot13 to read:
You can, of course, cheat by looking at the maze map. The question
you need to ask yourself, though, is what sequence of characters
marks the place where you can escape the maze?
Lbh pna, bs pbhefr, purng ol ybbxvat ng gur znmr znc. Gur dhrfgvba
lbh arrq gb nfx lbhefrys, gubhtu, vf jung frdhrapr bs punenpgref
znexf gur cynpr jurer lbh pna rfpncr gur znmr?
Gur nytbevguz vf dhvgr ovmneer--gur cevznel arfgrq ybbc gung
trarengrf vg tbrf gbc gb obggbz ba gur qvfcynl, ybbcvat sbejneq
gura onpxjneq sebz gur pheerag cbfvgvba gb qenj gur yrsg fvqr naq
gura gur evtug fvqr.
The algorithm is quite bizarre--the primary nested loop that
generates it goes top to bottom on the display, looping forward
then backward from the current position to draw the left side and
then the right side.
### Advanced usage notes
Rot13 to read:
The program can also be run from other files containing mazes. The
maze should be laid out graphically in the obvious format; newlines
separate physical rows in the maze; a space indicates a corridor,
and any other character is a wall. Tabs are also considered walls,
so make sure to convert tabs to spaces before using it.
Gur cebtenz pna nyfb or eha sebz bgure svyrf pbagnvavat znmrf. Gur
znmr fubhyq or ynvq bhg tencuvpnyyl va gur boivbhf sbezng; arjyvarf
frcnengr culfvpny ebjf va gur znmr; n fcnpr vaqvpngrf n pbeevqbe,
naq nal bgure punenpgre vf n jnyy. Gnof ner nyfb pbafvqrerq jnyyf,
fb znxr fher gb pbaireg gnof gb fcnprf orsber hfvat vg.
Usage: buzzard [filename [escape-char [start-x start-yNNN
Hfntr: ohmmneq [svyranzr [rfpncr-pune [fgneg-k fgneg-l]]]
Filename is the name of the file containing the maze. This
defaults to 'buzzard.c'.
Svyranzr vf gur anzr bs gur svyr pbagnvavat gur znmr. Guvf
qrsnhygf gb 'ohmmneq.p'.
Escape-char is the character in the maze that represents the exit.
You can put more than one exit in the maze (for example, you could
make all '!'s in the maze be exits).
Rfpncr-pune vf gur punenpgre va gur znmr gung ercerfragf gur rkvg.
Lbh pna chg zber guna bar rkvg va gur znmr (sbe rknzcyr, lbh pbhyq
znxr nyy '!'f va gur znmr or rkvgf).
Start-x and start-y mark the coordinates where you begin playing.
Y coordinate is down the rows in the files, X is to the right
through the characters of each line. Both X and Y begin counting
from 0. The default is start-x = 4, start-y = 5, which is needed
for the buzzard.c, but would probably be inappropriate for other
mazes.
Fgneg-k naq fgneg-l znex gur pbbeqvangrf jurer lbh ortva cynlvat.
L pbbeqvangr vf qbja gur ebjf va gur svyrf, K vf gb gur evtug
guebhtu gur punenpgref bs rnpu yvar. Obgu K naq L ortva pbhagvat
sebz 0. Gur qrsnhyg vf fgneg-k = 4, fgneg-l = 5, juvpu vf arrqrq
sbe gur ohmmneq.p, ohg jbhyq cebonoyl or vanccebcevngr sbe bgure
znmrf.
BUGS:
OHTF:
You can't change that at start you're facing down ("south").
Lbh pna'g punatr gung ng fgneg lbh'er snpvat qbja ("fbhgu").
\
Gur qenjvat nytbevguz pnaabg unaqyr bcra fcnprf (gjb fhpprfvir
fvqr-pbeevqbef jvgu ab jnyy orgjrra gurz). Va snpg, vg pnaabg unaqyr
fznyy qbt-yrtf cebcreyl, nygubhtu gur reebe vf fhogyr.
The drawing algorithm cannot handle open spaces (two successive
side-corridors with no wall between them). In fact, it cannot handle
small dog-legs properly, although the error is subtle.
Gur rkvg vf qenja yvxr n abezny pbeevqbe sebz gur fvqr ivrj;
vg'f bayl qvfcynlrq nf gur rkvg jura lbh ner snpvat vg.
The exit is drawn like a normal corridor from the side view;
it's only displayed as the exit when you are facing it.
Vzcebcre pbzznaqyvar nethzragf ner abg unaqyrq avpryl.
Improper command line arguments are not handled nicely.
Znmrf jvgu bcravatf ng gur rqtrf jvyy pnhfr gur qenjvat cebtenz
gb ernpu vagb neovgenel cnepryf bs zrzbel.
Mazes with openings at the edges will cause the drawing program
to reach into arbitrary parcels of memory.
Gur cebtenz nffhzrf gung gnof ner frg gb 8 punenpgref.
The program assumes that tabs are set to 8 characters.
## Copyright and CC BY-SA 4.0 License:
+10 -10
View File
@@ -40,19 +40,19 @@ this entry.
## Author's remarks:
Spoiler, rot13 to read:
Spoiler:
Gur fbhepr pbqr ubyqf gur yrggref bs gur zrffntr. Rnpu yrggre, pbzovarq
jvgu nabgure xrl yrggre, vf hfrq gb pbzchgr gur pbbeqvangrf bs gur arkg
yrggre naq xrl. Guhf, gur zrffntr vf pbqr. Gung vf jul V hfr fvyyl\
pbzzragf, zbfg bsgra onqyl fcnprq.
The source code holds the letters of the message. Each letter, combined
with another key letter, is used to compute the coordinates of the next
letter and key. Thus, the message is code. That is why I use silly\
comments, most often badly spaced.
Gur fcnpr punenpgre frdhrapr orgjrra gur jbeqf vf tvira ol n fvzcyr
pbzchgngvba ba na bpgny pbafgnag (tvira urer nf na urk inyhr, bs
pbhefr).
The space character sequence between the words is given by a simple
computation on an octal constant (given here as an hex value, of
course).
Guvf jnl, nal zrffntr pna or zvkrq vagb n pbqr, fvapr gur xrlf nyybj
lbh gb cynpr gur zrnavatshy yrggref jurerire lbh jnag.
This way, any message can be mixed into a code, since the keys allow
you to place the meaningful letters wherever you want.
## Copyright and CC BY-SA 4.0 License:
+2 -2
View File
@@ -55,12 +55,12 @@ the high bit off some input?
The author wishes to thank J Greely for the last 6 bytes.
Here's about how it does it: [rot13 to read]
Here's about how it does it:
NOTE: Bits are referred to as 76543210, high to low.
1. Get the character in variable `a`. Note the fun way we check for `EOF`.
(thanks J).
(thanks J).
2. Reverse bit 6, and strip bit 5. Bit 6 determines (mostly) whether
or not this character is a letter. Bit 5 would determine case if
+33 -33
View File
@@ -33,45 +33,45 @@ This entry has been updated to allow most ANSI C compilers.
This program is a simple puzzle type game. (I'll leave you to play
it to see the rest of it .. :-) .) The general idea was to try and
write the smallest playable game, but keep the playability and
enjoyment high.\
\
### Instructions (rot13 to read):
enjoyment high.
### Instructions:
Xrl gb znc:-
Key to map:
|
###### | | | /\ /--\ ==| /\ | | Qverpgbany xrlf\
###### Fbyvq Jnyy | ----|| \/ /\ ||---- (haybpx qbbef bs
###### | \/ ==| \--/ \/ gur fnzr qverpgvba)
|\
| << >> Qbbef. Haybpxrq ol
Oynax fcnpr | << iiiiii ^^^^^^ >> gur nobir xrlf.
| << >>
|\
___ | b__B\ B__B ^__^ /B__b\
/ \ 'Pehfunoyr' | \___/ /----\ /----\ \___/ Gur sbhe fcevgrf sbe
\___/ obhyqre | _/_\ _/ \_ _/ \_ /_\_ lbhe punenpgre :-)
|\
___ hapehfunoyr | /\ Qvnzbaqf. Gurl pna rvgure or sbhaq ylvat
/@@@\ obhyqre | < > nebhaq (vs bayl!) be znahsnpgher ol chfuvat
\@@@/ | \/ gjb 'pehfunoyr' ebpxf gbtrgure.
|
```
|
###### | | | /\ /--\ ==| /\ | | Directonal keys\
###### Solid Wall | ----|| \/ /\ ||---- (unlock doors of
###### | \/ ==| \--/ \/ the same direction)
|\
| << >> Doors. Unlocked by
Blank space | << vvvvvv ^^^^^^ >> the above keys.
| << >>
|\
___ | o__O\ O__O ^__^ /O__o\
/ \ 'Crushable' | \___/ /----\ /----\ \___/ The four sprites for
\___/ boulder | _/_\ _/ \_ _/ \_ /_\_ your character :-)
|\
___ uncrushable | /\ Diamonds. They can either be found lying
/@@@\ boulder | < > around (if only!) or manufacture by pushing
\@@@/ | \/ two 'crushable' rocks together.
|
Gur trareny vqrn bs gur tnzr vf gb pbyyrpg nyy gur qvnzbaqf. Guvf zhfg
or qbar va gur zvavzhz nzbhag bs zbirf. V'ir nyybjrq n znetva bs 5
zbirf juvpu oevatf gur zbirf nyybjrq gb 484. (nygre gur inyhr bs 'h' va
gur cebtenz gb frg gur znk zbirf nyybjrq)
The general idea of the game is to collect all the diamonds. This must
be done in the minimum amount of moves. I've allowed a margin of 5
moves which brings the moves allowed to 484. (alter the value of 'u' in
the program to set the max moves allowed)
Gurer ner gjb glcrf bs obhyqref. Obgu pna or chfurq nebhaq, ohg bayl
gur ubyybj (pehfunoyr) barf pna or ghearq vagb qvnzbaqf (ol chfuvat vg
bagb nabgure ubyybj bar).
Bs gur sbhe glcrf bs qbbef (naq xrlf) bayl 3 unir orra qrsvarq. Guvf
jnf qbar gb xrrc gur fbhepr nf ybj nf cbffvoyr (nf V bayl hfrq 3 va gur
znc). Gb haybpx n qbbe fvzcyl chfu n xrl vagb gur pbeerfcbaqvat qbbe.
Gnxr pner gung vg'f snpvat va gur pbeerpg qverpgvba.
There are two types of boulders. Both can be pushed around, but only
the hollow (crushable) ones can be turned into diamonds (by pushing it
onto another hollow one).
Of the four types of doors (and keys) only 3 have been defined. This
was done to keep the source as low as possible (as I only used 3 in the
map). To unlock a door simply push a key into the corresponding door.
Take care that it's facing in the correct direction.
```
## Copyright and CC BY-SA 4.0 License:
+93 -86
View File
@@ -38,9 +38,11 @@ Make and run as follows:
where the `move_location` is a digit from 1 to 9 that represents
a move on a tic-tac-toe board:
1 2 3
4 5 6
7 8 9
```
1 2 3
4 5 6
7 8 9
```
If you omit `move_location`, then the computer moves first. For your\
next move, recompile `nextmove.c` and play it again:
@@ -61,7 +63,7 @@ make ttt
./ttt next_move
```
\
The shell script determines when the game is over, and automatically\
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:
@@ -172,113 +174,118 @@ longer loses games.
If you want a program that never loses, simply replace the string
`"9999999999 :-| "` with `"9883857753 :-| "`.
### How it works (rot13 to read):
### How it works
The vertical "bars" of the grid are identical functions, with the
name of the function as a(), b(), or c(). After each function is
called, the global variables X and O contain bitmasks of where all
the Xs and Os are placed. The statement:
Gur iregvpny "onef" bs gur tevq ner vqragvpny shapgvbaf, jvgu gur
anzr bs gur shapgvba nf n(), o(), be p(). Nsgre rnpu shapgvba vf
pnyyrq, gur tybony inevnoyrf K naq B pbagnva ovgznfxf bs jurer nyy
gur Kf naq Bf ner cynprq. Gur fgngrzrag:
```c
X=- <char> -1;
``
K=- <pune> -1;
evaluates to 1, -1, or -2 when X is 1 and <char> is one of "X",
"0", or " ". The function S(&X) sets the appropriate bits in
(global var) X and O and resets the value of &X to 1. This is how
the current position is computed.
rinyhngrf gb 1, -1, be -2 jura K vf 1 naq <pune> vf bar bs "K",
"0", be " ". Gur shapgvba F(&K) frgf gur nccebcevngr ovgf va
(tybony ine) K naq B naq erfrgf gur inyhr bs &K gb 1. Guvf vf ubj
gur pheerag cbfvgvba vf pbzchgrq.
The player's move is OR'd into the X mask, and (if it is the
opening move) the strategy string's first character is set to the
player's first move (or "5" if the computer moves first).
Gur cynlre'f zbir vf BE'q vagb gur K znfx, naq (vs vg vf gur
bcravat zbir) gur fgengrtl fgevat'f svefg punenpgre vf frg gb gur
cynlre'f svefg zbir (be "5" vs gur pbzchgre zbirf svefg).
The evalution function y(M) checks if the mask has a winning
pattern (any of the first eight bitmasks of the w[N array), and
sets the variable q to 0 if it does.
Gur rinyhgvba shapgvba l(Z) purpxf vs gur znfx unf n jvaavat
cnggrea (nal bs gur svefg rvtug ovgznfxf bs gur j[] neenl), naq
frgf gur inevnoyr d gb 0 vs vg qbrf.
The player's move is evaluated to see if the human has won. The
smiley is set to :-) or :-( depending on this. Also, if the human
has won, the digit in the strategy string is decremented to change
the computer's play for next game.
Gur cynlre'f zbir vf rinyhngrq gb frr vs gur uhzna unf jba. Gur
fzvyrl vf frg gb :-) be :-( qrcraqvat ba guvf. Nyfb, vs gur uhzna
unf jba, gur qvtvg va gur fgengrtl fgevat vf qrperzragrq gb punatr
gur pbzchgre'f cynl sbe arkg tnzr.
If the human has NOT won, the e(N,M) function evaluates if ANY move
not in mask N can produce a win in mask M. The first evaluation
e(X,O) checks if O can make a legal winning move. If so, the
computer has a winning move and makes it. If not, the smiley is
set to :-|, and a non-winning move is generated.
Vs gur uhzna unf ABG jba, gur r(A,Z) shapgvba rinyhngrf vs NAL zbir
abg va znfx A pna cebqhpr n jva va znfx Z. Gur svefg rinyhngvba
r(K,B) purpxf vs B pna znxr n yrtny jvaavat zbir. Vs fb, gur
pbzchgre unf n jvaavat zbir naq znxrf vg. Vs abg, gur fzvyrl vf
frg gb :-|, naq n aba-jvaavat zbir vf trarengrq.
A non-winning move first checks if X can win in one move; if so,
this move is selected, blocking the win. Otherwise, a move is
generated by looking down the list of "move templates". The first
move template that generates a move that is NOT already occupied by
an X or O is returned.
N aba-jvaavat zbir svefg purpxf vs K pna jva va bar zbir; vs fb,
guvf zbir vf fryrpgrq, oybpxvat gur jva. Bgurejvfr, n zbir vf
trarengrq ol ybbxvat qbja gur yvfg bs "zbir grzcyngrf". Gur svefg
zbir grzcyngr gung trarengrf n zbir gung vf ABG nyernql bpphcvrq ol
na K be B vf erghearq.
The "move templates" are static tic-tac-toe positions that generate
possible moves by making the e() function return "winning" moves,
e.g. the template:
Gur "zbir grzcyngrf" ner fgngvp gvp-gnp-gbr cbfvgvbaf gung trarengr
cbffvoyr zbirf ol znxvat gur r() shapgvba erghea "jvaavat" zbirf,
r.t. gur grzcyngr:
```
. . .
O , O (this is the value 40; 2^3+2^5)
. . . ("O"s are 1 bits, "." and "," are 0 bits)
```
. . .
B , B (guvf vf gur inyhr 40; 2^3+2^5)
. . . ("B"f ner 1 ovgf, "." naq "," ner 0 ovgf)
...will make the e() function return a center move, as
this is the only move that produces three in a row. Notice that
the computer does not consider which cells contain Xs and Os when
making a template move, only which cells are empty and not-empty.
This makes for unusual play.
...jvyy znxr gur r() shapgvba erghea n pragre zbir, nf
guvf vf gur bayl zbir gung cebqhprf guerr va n ebj. Abgvpr gung
gur pbzchgre qbrf abg pbafvqre juvpu pryyf pbagnva Kf naq Bf jura
znxvat n grzcyngr zbir, bayl juvpu pryyf ner rzcgl naq abg-rzcgl.
Guvf znxrf sbe hahfhny cynl.
The templates are carefully chosen to eventually block all traps
that X can try, by just blundering in the way.
Gur grzcyngrf ner pnershyyl pubfra gb riraghnyyl oybpx nyy gencf
gung K pna gel, ol whfg oyhaqrevat va gur jnl.
Also note that the winning & strategy templates are part of the
compile line, making it possible to change the rules of the game by
changing the compile line.
Nyfb abgr gung gur jvaavat & fgengrtl grzcyngrf ner cneg bs gur
pbzcvyr yvar, znxvat vg cbffvoyr gb punatr gur ehyrf bs gur tnzr ol
punatvat gur pbzcvyr yvar.
The templates are:
Gur grzcyngrf ner:
```
O , O
, , ,
O , O
B , B
, , ,
B , B
, . .
. O .
. . O
, . .
. B .
. . B
. . .
O , O
. . .
. . .
B , B
. . .
. . .
O O ,
. . .
. . .
B B ,
. . .
. . .
O , O
. . .
. . .
B , B
. . .
. , ,
. O .
O O ,
. , ,
. B .
B B ,
O , O
, , .
O . .
B , B
, , .
B . .
, . O
O , O
O . ,
, . B
B , B
B . ,
O . ,
O , O
, . O
B . ,
B , B
, . B
O , O
, , ,
O , O
```
B , B
, , ,
B , B
N qvtvg bs "9" zrnaf fgneg jvgu gur svefg grzcyngr, "8" fgnegf ng
gur frpbaq, rgp. Gur grzcyngrf ner fpnaarq hagvy n yrtny zbir vf
sbhaq. N grzcyngr vf fpnaarq sebz obggbz gb gbc, evtug gb yrsg
(v.r. zbir 9 vf grfgrq svefg, gura 8, qbja gb zbir 1).
A digit of "9" means start with the first template, "8" starts at
the second, etc. The templates are scanned until a legal move is
found. A template is scanned from bottom to top, right to left
(i.e. move 9 is tested first, then 8, down to move 1).
## Copyright and CC BY-SA 4.0 License: