Fix code blocks in 1991 and part of 1992
In 1991 the code blocks in the html files should look better with smaller screens. In one entry, rince, an image was added as the formatting is too complicated to get right. The text was changed from two columns to one column and then a screenshot was taken so that it's a bit easier to see with smaller widths. This looks fairly good on mobile phones too. The only downside, of course, is if the web pages ever change to have a different background or code colour it won't match but it did not look right with mobile phones. This required a manifest update. In 1992 one entry's html file defeated me for now so I had to stop. This can be looked at later. The last entry I am committing changes to is 1991/buzzard.1. It was buzzard.2/buzzard.2.design.md that is a big problem and will have to be done another time.
This commit is contained in:
1 parent
1e2793bf5b
commit
3fdb24beb9
23 files changed
+119
-146
No files matched your search
+12
-35
@@ -427,48 +427,24 @@ next move, recompile <code>nextmove.c</code> and play it again:</p>
|
||||
<p>We have provided the shell script, <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1991/westley/ttt.sh">ttt.sh</a>, to make it easier to play the
|
||||
game:</p>
|
||||
<pre><code> make ttt
|
||||
./ttt [first_move] # <- omit first arg to have it move first
|
||||
./ttt [first_move]
|
||||
./ttt next_move</code></pre>
|
||||
<p>The shell script determines when the game is over, and automatically replaces
|
||||
<code>merlyn.c</code> (copied from <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1991/westley/westley.c">westley.c</a> with an improved version after a
|
||||
loss). The <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1991/westley/ttt.sh">ttt</a> script has two other modes:</p>
|
||||
<pre><code> ./ttt quitgame # cancel any game in progress, revert to merlyn.c
|
||||
./ttt clobber # remove all game files, revert to original source</code></pre>
|
||||
<pre><code> # cancel any game in progress,
|
||||
# revert to merlyn.c:
|
||||
./ttt quitgame
|
||||
# remove all game files,
|
||||
# revert to original source:
|
||||
./ttt clobber</code></pre>
|
||||
<p>For example here is a potentially losing game:</p>
|
||||
<pre><code> ./ttt 1
|
||||
./ttt 4
|
||||
./ttt 6</code></pre>
|
||||
<p>The final might look like:</p>
|
||||
<pre><code> a(X){/*/X=- a(X){/*/X=-
|
||||
X -1;F;X=- -1;F;X=-
|
||||
-1;F;}/*/ -1;F;}/*/
|
||||
char z[][100]={"char z[][100]={","a(X){/*/X=-","-1;F;X=-","-1;F;}/*/","1999999999 :-) ",
|
||||
"int q,i,j,k,X,O=0,H;S(x)int*x;{X+=X;O+=O;*x+1?*x+2||X++:O++;*x=1;}L(n){for(*",
|
||||
"z[i=1]=n+97;i<4;i++)M(256),s(i),M(128),s(i),M(64),N;X*=8;O*=8;}s(R){char*r=z",
|
||||
"[R];for(q&&Q;*r;)P(*r++);q&&(Q,P(44));}M(m){P(9);i-2||P(X&m?88:O&m?48:32);P(",
|
||||
"9);}y(A){for(j=8;j;)~A&w[--j]||(q=0);}e(W,Z){for(i-=i*q;i<9&&q;)y(W|(1<<i++&",
|
||||
"~Z));}R(){for(k=J[*J-48]-40;k;)e(w[k--],X|O);}main(u,v)char**v;{a(q=1);b(1);",
|
||||
"c(1);*J=--u?O?*J:*v[1]:53;X|=u<<57-*v[u];y(X);K=40+q;q?e(O,X),q&&(K='|'),e(X",
|
||||
",O),R(),O|=1<<--i:J[*J-48+(X=O=0)]--;L(q=0);for(s(i=0);q=i<12;)s(i++),i>4&&N",
|
||||
";s(q=12);P(48);P('}');P(59);N;q=0;L(1);for(i=5;i<13;)s(i++),N;L(2);}",0};
|
||||
b(X){/*/X=- b(X){/*/X=-
|
||||
X -1;F;X=- -1;F;X=- X
|
||||
-1;F;}/*/ -1;F;}/*/
|
||||
int q,i,j,k,X,O=0,H;S(x)int*x;{X+=X;O+=O;*x+1?*x+2||X++:O++;*x=1;}L(n){for(*
|
||||
z[i=1]=n+97;i<4;i++)M(256),s(i),M(128),s(i),M(64),N;X*=8;O*=8;}s(R){char*r=z
|
||||
[R];for(q&&Q;*r;)P(*r++);q&&(Q,P(44));}M(m){P(9);i-2||P(X&m?88:O&m?48:32);P(
|
||||
9);}y(A){for(j=8;j;)~A&w[--j]||(q=0);}e(W,Z){for(i-=i*q;i<9&&q;)y(W|(1<<i++&
|
||||
~Z));}R(){for(k=J[*J-48]-40;k;)e(w[k--],X|O);}main(u,v)char**v;{a(q=1);b(1);
|
||||
c(1);*J=--u?O?*J:*v[1]:53;X|=u<<57-*v[u];y(X);K=40+q;q?e(O,X),q&&(K='|'),e(X
|
||||
,O),R(),O|=1<<--i:J[*J-48+(X=O=0)]--;L(q=0);for(s(i=0);q=i<12;)s(i++),i>4&&N
|
||||
;s(q=12);P(48);P('}');P(59);N;q=0;L(1);for(i=5;i<13;)s(i++),N;L(2);}
|
||||
c(X){/*/X=- c(X){/*/X=-
|
||||
0 -1;F;X=- 0 -1;F;X=- 0
|
||||
-1;F;}/*/ -1;F;}/*/
|
||||
|
||||
ttt: I win!</code></pre>
|
||||
<p>Redirects stderr to <code>/dev/null</code> by default. If you need errors or warnings use
|
||||
<code>-e</code>.</p>
|
||||
<p>To see what it might look like, try it out.</p>
|
||||
<p>The script redirects stderr to <code>/dev/null</code> by default. If you need errors or
|
||||
warnings use <code>-e</code>.</p>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>This version is based on the author’s remarks. It is not supposed to lose but it
|
||||
can lose if you cheat. That’s supposed to happen. Can you win any other time?</p>
|
||||
@@ -546,7 +522,8 @@ possible moves by making the <code>e()</code> function return “winning” move
|
||||
e.g. the template:</p>
|
||||
<pre><code> . . .
|
||||
O , O (this is the value 40; 2^3+2^5)
|
||||
. . . ("O"s are 1 bits, "." and "," are 0 bits)</code></pre>
|
||||
. . . ("O"s are 1 bits,
|
||||
"." and "," are 0 bits)</code></pre>
|
||||
<p>…will make the <code>e()</code> 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 <code>X</code>s and <code>O</code>s when making a template move, only which cells are
|
||||
|
||||
Reference in new issue
Block a user