set pandoc 8 character tab stops for HTML conversion
We add `--tab-stop=8` to all `pandoc(1)` executions in order to set a better tab stop indentation, especially for tab intended code blocks. Changed `bin/pandoc-wrapper.sh` VERSION "1.5.3 2024-03-26" to "1.6 2024-03-31". Fixed `1991/brnstnd/sorta.README.md` so that the sorta code is code blocks. Removed unneeded paragraph group in copyright in `inc/footer.default.html`. Performed `make www` to perform the above and test under macOS.
This commit is contained in:
1 parent
7141a1b808
commit
b84c27ce02
402 files changed
+2414
-2396
No files matched your search
+3
-3
@@ -248,11 +248,11 @@ ISBN 0-13-822305-X, chapter 5</p>
|
||||
|
||||
You are free to share and adapt this file under the terms of this license:
|
||||
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
|
||||
For more information, see:
|
||||
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
-->
|
||||
|
||||
@@ -315,7 +315,7 @@ ISBN 0-13-822305-X, chapter 5</p>
|
||||
<div class="footer">
|
||||
<h2>Copyright and CC BY-SA 4.0 License</h2>
|
||||
<p>This file and web page is:</p>
|
||||
<blockquote><p><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></p></blockquote>
|
||||
<blockquote><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></blockquote>
|
||||
<p>You are free to share and adapt this file under the terms of this license:</p>
|
||||
<blockquote><b>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</b></blockquote>
|
||||
<p>For more information, see:</p>
|
||||
|
||||
@@ -290,11 +290,11 @@ the size limit, unfortunately.</p>
|
||||
|
||||
You are free to share and adapt this file under the terms of this license:
|
||||
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
|
||||
For more information, see:
|
||||
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
-->
|
||||
|
||||
@@ -373,7 +373,7 @@ the size limit, unfortunately.</p>
|
||||
<div class="footer">
|
||||
<h2>Copyright and CC BY-SA 4.0 License</h2>
|
||||
<p>This file and web page is:</p>
|
||||
<blockquote><p><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></p></blockquote>
|
||||
<blockquote><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></blockquote>
|
||||
<p>You are free to share and adapt this file under the terms of this license:</p>
|
||||
<blockquote><b>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</b></blockquote>
|
||||
<p>For more information, see:</p>
|
||||
|
||||
@@ -124,47 +124,47 @@
|
||||
|
||||
<p>The <code>sorta</code> scripts described below can sorta be found in this directory.</p>
|
||||
<h1 id="sorta.i22"><a href="sorta.i2+2">sorta.i2+2</a></h1>
|
||||
<pre><code>2 2+#` [ about as basic as you can get ]ld</code></pre>
|
||||
<pre><code> 2 2+#` [ about as basic as you can get ]ld</code></pre>
|
||||
<p>This script takes 2, adds 2 to it, and prints the result (with a
|
||||
newline). I get 5 on the hand-held Sinclair under ZYNIX. Let me know if
|
||||
your machine produces a different result so that I can send you patches.</p>
|
||||
<h1 id="sorta.iarg0"><a href="sorta.iarg0">sorta.iarg0</a></h1>
|
||||
<pre><code>0A` [ take arg 0, print it ]</code></pre>
|
||||
<pre><code> 0A` [ take arg 0, print it ]</code></pre>
|
||||
<p>This is self-explanatory.</p>
|
||||
<h1 id="sorta.icalc"><a href="sorta.icalc">sorta.icalc</a></h1>
|
||||
<pre><code>[D2sD3s]:Dld [ input m n, output m n m n ]ld
|
||||
<pre><code> [D2sD3s]:Dld [ input m n, output m n m n ]ld
|
||||
|
||||
[2*1=d]:cld [ aux routine for :d recursion ]ld
|
||||
[1=D1s>1Ds_+=c]:dld [ input m n, as long as n <= m double it, output m n ]ld
|
||||
[2*1=d]:cld [ aux routine for :d recursion ]ld
|
||||
[1=D1s>1Ds_+=c]:dld [ input m n, as long as n <= m double it, output m n ]ld
|
||||
|
||||
[D2s1s_+1s]:-ld [ input m n, output m-n n ]ld
|
||||
[1=D1s>1Ds_+#T=-2/D=1]:1ld [ aux routine for :@ ]ld
|
||||
[1D=d2/1=1ddd1 ]:!ld
|
||||
["0"Td]:0ld
|
||||
[DD=!1_+=0]:@ld [ input m, m assumed nonnegative, append
|
||||
binary representation of m to top of s stack ]ld
|
||||
[D2s1s_+1s]:-ld [ input m n, output m-n n ]ld
|
||||
[1=D1s>1Ds_+#T=-2/D=1]:1ld [ aux routine for :@ ]ld
|
||||
[1D=d2/1=1ddd1 ]:!ld
|
||||
["0"Td]:0ld
|
||||
[DD=!1_+=0]:@ld [ input m, m assumed nonnegative, append
|
||||
binary representation of m to top of s stack ]ld
|
||||
|
||||
["-"T_]:+ld
|
||||
[D0 1s>=+1=@]:2ld [ input m, append - to top of s stack if m is negative,
|
||||
then append binary representation of abs(m) to
|
||||
top of s stack ]ld
|
||||
["-"T_]:+ld
|
||||
[D0 1s>=+1=@]:2ld [ input m, append - to top of s stack if m is negative,
|
||||
then append binary representation of abs(m) to
|
||||
top of s stack ]ld
|
||||
|
||||
[d1A:A2=A]:A 27182 a1>=A
|
||||
[d2A:A1=A]:A 3145 a2>=A
|
||||
[d1A:A2=A]:A 27182 a1>=A
|
||||
[d2A:A1=A]:A 3145 a2>=A
|
||||
|
||||
D # " in binary is "T 1=2 `ld
|
||||
1=Dd # " in binary is "T 1=2 `ld
|
||||
D # " in binary is "T 1=2 `ld
|
||||
1=Dd # " in binary is "T 1=2 `ld
|
||||
|
||||
1=D 1s# " + "T 1s#T " is "T + #Td `ld
|
||||
1=D 1s# " - "T 1s#T " is "T _+ #Td `ld
|
||||
1=D 1s# " * "T 1s#T " is "T * #Td `ld
|
||||
1=D 1s# " / "T 1s#T " is "T / #Td `ld
|
||||
1=D 1s# " % "T 1s#T " is "T 1=D/*_+ #Td `ld
|
||||
1=D 1s# " + "T 1s#T " is "T + #Td `ld
|
||||
1=D 1s# " - "T 1s#T " is "T _+ #Td `ld
|
||||
1=D 1s# " * "T 1s#T " is "T * #Td `ld
|
||||
1=D 1s# " / "T 1s#T " is "T / #Td `ld
|
||||
1=D 1s# " % "T 1s#T " is "T 1=D/*_+ #Td `ld
|
||||
|
||||
1=D d "~ " #T " is "T D& #T$ld " (" 1=2 ")"T `ld
|
||||
1=D 1s# " & "T 1s#T " is "T &D& #T$ld " (" 1=2 ")"T `ld
|
||||
1=D 1s# " | "T 1s#T " is "T D&1sD&& #T$ld " (" 1=2 ")"T `ld
|
||||
1=D 1s# " ^ "T 1s#T " is "T 1=D&2sD&1sD&&&D& #T$ld " (" 1=2 ")"T `ld</code></pre>
|
||||
1=D d "~ " #T " is "T D& #T$ld " (" 1=2 ")"T `ld
|
||||
1=D 1s# " & "T 1s#T " is "T &D& #T$ld " (" 1=2 ")"T `ld
|
||||
1=D 1s# " | "T 1s#T " is "T D&1sD&& #T$ld " (" 1=2 ")"T `ld
|
||||
1=D 1s# " ^ "T 1s#T " is "T 1=D&2sD&1sD&&&D& #T$ld " (" 1=2 ")"T `ld</code></pre>
|
||||
<p><code>icalc</code> shows off <code>SORTA</code>’s understanding of integer arithmetic. You can run
|
||||
it with up to two arguments; the arguments have default values of 27182
|
||||
and 3145. Notice that <code>SORTA</code> doesn’t have a language primitive for
|
||||
@@ -174,51 +174,51 @@ Look at program A.) <code>icalc</code> also provides a useful binary output rout
|
||||
and if you can’t remember offhand that <code>D2sD3s&2sD&1sD&&&D&</code> means XOR,
|
||||
you can just look it up here.</p>
|
||||
<h1 id="sorta.idup"><a href="sorta.idup">sorta.idup</a></h1>
|
||||
<pre><code>[ld#1_+1=y]:x
|
||||
[uD1+=x]:y
|
||||
0""1=y`</code></pre>
|
||||
<pre><code> [ld#1_+1=y]:x
|
||||
[uD1+=x]:y
|
||||
0""1=y`</code></pre>
|
||||
<p>This script prints out the maximum file descriptor available from
|
||||
repeated <code>dup(2)</code>s—usually <code>NOFILE - 1</code>. Can you see how it works?</p>
|
||||
<h1 id="sorta.iecho"><a href="sorta.iecho">sorta.iecho</a></h1>
|
||||
<pre><code>[" "$ld]:sld [ print a space ]ld
|
||||
[1s1+DA$ld1s1_+D=sD=x]:xld [ given n (argc-n), print args ]ld
|
||||
0a1_+D=x""` [ simulation of /bin/echo ]ld</code></pre>
|
||||
<pre><code> [" "$ld]:sld [ print a space ]ld
|
||||
[1s1+DA$ld1s1_+D=sD=x]:xld [ given n (argc-n), print args ]ld
|
||||
0a1_+D=x""` [ simulation of /bin/echo ]ld</code></pre>
|
||||
<p>This is a clone of <code>/bin/echo</code>, minus any argument processing and escape
|
||||
interpretation. (Note that, unlike some shells’ echo, <code>/bin/echo</code> prints a
|
||||
newline even with no arguments.) Try <code>./sorta foo bar < iecho</code>.</p>
|
||||
<h1 id="sorta.ifact1"><a href="sorta.ifact1">sorta.ifact1</a></h1>
|
||||
<pre><code>1#`ld2*#`ld3*#`ld4*#`ld5*#`ld6*#`ld7*#`ld8*#`ld9*#`ld10*#`ld</code></pre>
|
||||
<pre><code> 1#`ld2*#`ld3*#`ld4*#`ld5*#`ld6*#`ld7*#`ld8*#`ld9*#`ld10*#`ld</code></pre>
|
||||
<p>This is a very straightforward factorial program: Take 1, print it,
|
||||
multiply by 2, print it, multiply by 3, print it, etc.</p>
|
||||
<h1 id="sorta.ifact2"><a href="sorta.ifact2">sorta.ifact2</a></h1>
|
||||
<pre><code>[1+D2s*#`ld1s]:f
|
||||
1 0
|
||||
1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f</code></pre>
|
||||
<pre><code> [1+D2s*#`ld1s]:f
|
||||
1 0
|
||||
1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f</code></pre>
|
||||
<p><code>ifact1</code> does a lot of repeated work. <code>ifact2</code> takes advantage of this by
|
||||
keeping the current <code>n!</code> <code>n</code> on the stack. Each call to routine <code>f (1=f)</code>
|
||||
increments <code>n</code> by <code>1</code> and prints out the factorial.</p>
|
||||
<h1 id="sorta.ifact3"><a href="sorta.ifact3">sorta.ifact3</a></h1>
|
||||
<pre><code>[1+D2s*#`ld1s]:f [ given (n-1)! (n-1), print n!, put n! n ]
|
||||
[2s1=f2s1_+D0>=x]:x [ given n n! x, print (n+1)! through (n+x)! ]
|
||||
0 1 10 1=x</code></pre>
|
||||
<pre><code> [1+D2s*#`ld1s]:f [ given (n-1)! (n-1), print n!, put n! n ]
|
||||
[2s1=f2s1_+D0>=x]:x [ given n n! x, print (n+1)! through (n+x)! ]
|
||||
0 1 10 1=x</code></pre>
|
||||
<p>Finally, <code>ifact3</code> removes all the redundancy from <code>ifact2</code>, and exhibits
|
||||
proper documentation of stack routines. You can replace the <code>10</code> by
|
||||
anything in this version.</p>
|
||||
<h1 id="sorta.iio"><a href="sorta.iio">sorta.iio</a></h1>
|
||||
<pre><code> [ a simple example of interpreting code on the fly ]ld
|
||||
<pre><code> [ a simple example of interpreting code on the fly ]ld
|
||||
|
||||
["] "2 2+":xT ["]T " produces "T 1=x#T " which should be 4."T`</code></pre>
|
||||
["] "2 2+":xT ["]T " produces "T 1=x#T " which should be 4."T`</code></pre>
|
||||
<p>Notice that <code>"2 2+"</code> is a literal string inside the program.</p>
|
||||
<h1 id="sorta.irot13"><a href="sorta.irot13">sorta.irot13</a></h1>
|
||||
<pre><code>"[] [.tr] "
|
||||
["]".[a-m][n-z][A-M][N-Z]"[" ]TTT ["]".[n-z][a-m][N-Z][A-M]"[" ]TTT
|
||||
"[tr] !q"T:xld
|
||||
["rot13: fatal: need exactly one argument"`q]:gld
|
||||
["rot13: fatal: cannot open "1ST`q]:hld
|
||||
a2_+=g
|
||||
1A 0 [ that 0 is for RDONLY ]ld
|
||||
0 'o D0 1s>=hld
|
||||
0Ou1=x [ in a more complex spawner, this would be done under a fork ]ld</code></pre>
|
||||
<pre><code> "[] [.tr] "
|
||||
["]".[a-m][n-z][A-M][N-Z]"[" ]TTT ["]".[n-z][a-m][N-Z][A-M]"[" ]TTT
|
||||
"[tr] !q"T:xld
|
||||
["rot13: fatal: need exactly one argument"`q]:gld
|
||||
["rot13: fatal: cannot open "1ST`q]:hld
|
||||
a2_+=g
|
||||
1A 0 [ that 0 is for RDONLY ]ld
|
||||
0 'o D0 1s>=hld
|
||||
0Ou1=x [ in a more complex spawner, this would be done under a fork ]ld</code></pre>
|
||||
<p>Despite its name, <code>irot13</code> is meant to show how to exec a program with
|
||||
redirection from within <code>sorta</code>. You run it as <code>./sorta blah < irot13</code>; it
|
||||
opens <code>blah</code> and runs a (BSD-style) <code>tr</code> command to rotate all letters by 13
|
||||
@@ -227,23 +227,23 @@ subroutine <code>h</code> to print a nice error message if necessary. <code>0Ou<
|
||||
stdout and replaces it with the new descriptor. Finally, subroutine <code>x</code>
|
||||
executes the <code>tr</code>.</p>
|
||||
<h1 id="sorta.isleep"><a href="sorta.isleep">sorta.isleep</a></h1>
|
||||
<pre><code>["" "+sleep" "+5" "sleep" !q]:S [F0>1_+=S]:s
|
||||
"forking sleep 5..."`ld
|
||||
1=s
|
||||
"waiting for sleep to finish..."`ld
|
||||
w
|
||||
"done, sleep exit code " #T`</code></pre>
|
||||
<pre><code> ["" "+sleep" "+5" "sleep" !q]:S [F0>1_+=S]:s
|
||||
"forking sleep 5..."`ld
|
||||
1=s
|
||||
"waiting for sleep to finish..."`ld
|
||||
w
|
||||
"done, sleep exit code " #T`</code></pre>
|
||||
<p>This script illustrates the classic fork-exec-wait.</p>
|
||||
<h1 id="sorta.itailrec"><a href="sorta.itailrec">sorta.itailrec</a></h1>
|
||||
<pre><code>[3*#" "T$ldD=f]:f
|
||||
1=f</code></pre>
|
||||
<pre><code> [3*#" "T$ldD=f]:f
|
||||
1=f</code></pre>
|
||||
<p>The sole purpose of this script is to prove that <code>sorta</code> can do infinite
|
||||
tail recursion (in this case, in program <code>f</code>). Do <code>./sorta < itailrec | more</code>
|
||||
and watch the powers of 3 (mod your computer’s word size) flow by.</p>
|
||||
<h1 id="sorta.iwhosort"><a href="sorta.iwhosort">sorta.iwhosort</a></h1>
|
||||
<pre><code>[0Ou "" "+-u" "sort" !q]:S [F0>1_+=S]:s
|
||||
[1Ou "" "+-u" "who" !q]:W [F0>1_+=W]:w
|
||||
P1=wO1=sOww</code></pre>
|
||||
<pre><code> [0Ou "" "+-u" "sort" !q]:S [F0>1_+=S]:s
|
||||
[1Ou "" "+-u" "who" !q]:W [F0>1_+=W]:w
|
||||
P1=wO1=sOww</code></pre>
|
||||
<p>This final example is a simple pipeline, <code>who | sort</code>.</p>
|
||||
<!--
|
||||
|
||||
@@ -251,11 +251,11 @@ P1=wO1=sOww</code></pre>
|
||||
|
||||
You are free to share and adapt this file under the terms of this license:
|
||||
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
|
||||
For more information, see:
|
||||
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
-->
|
||||
|
||||
@@ -292,7 +292,7 @@ P1=wO1=sOww</code></pre>
|
||||
<div class="footer">
|
||||
<h2>Copyright and CC BY-SA 4.0 License</h2>
|
||||
<p>This file and web page is:</p>
|
||||
<blockquote><p><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></p></blockquote>
|
||||
<blockquote><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></blockquote>
|
||||
<p>You are free to share and adapt this file under the terms of this license:</p>
|
||||
<blockquote><b>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</b></blockquote>
|
||||
<p>For more information, see:</p>
|
||||
|
||||
@@ -2,8 +2,9 @@ The `sorta` scripts described below can sorta be found in this directory.
|
||||
|
||||
# [sorta.i2+2](sorta.i2+2)
|
||||
|
||||
|
||||
```
|
||||
2 2+#` [ about as basic as you can get ]ld
|
||||
```
|
||||
|
||||
|
||||
This script takes 2, adds 2 to it, and prints the result (with a
|
||||
@@ -13,7 +14,9 @@ your machine produces a different result so that I can send you patches.
|
||||
|
||||
# [sorta.iarg0](sorta.iarg0)
|
||||
|
||||
```
|
||||
0A` [ take arg 0, print it ]
|
||||
```
|
||||
|
||||
This is self-explanatory.
|
||||
|
||||
@@ -21,7 +24,7 @@ This is self-explanatory.
|
||||
# [sorta.icalc](sorta.icalc)
|
||||
|
||||
|
||||
|
||||
```
|
||||
[D2sD3s]:Dld [ input m n, output m n m n ]ld
|
||||
|
||||
[2*1=d]:cld [ aux routine for :d recursion ]ld
|
||||
@@ -55,6 +58,7 @@ This is self-explanatory.
|
||||
1=D 1s# " & "T 1s#T " is "T &D& #T$ld " (" 1=2 ")"T `ld
|
||||
1=D 1s# " | "T 1s#T " is "T D&1sD&& #T$ld " (" 1=2 ")"T `ld
|
||||
1=D 1s# " ^ "T 1s#T " is "T 1=D&2sD&1sD&&&D& #T$ld " (" 1=2 ")"T `ld
|
||||
```
|
||||
|
||||
`icalc` shows off `SORTA`'s understanding of integer arithmetic. You can run
|
||||
it with up to two arguments; the arguments have default values of 27182
|
||||
@@ -68,10 +72,11 @@ you can just look it up here.
|
||||
|
||||
# [sorta.idup](sorta.idup)
|
||||
|
||||
|
||||
```
|
||||
[ld#1_+1=y]:x
|
||||
[uD1+=x]:y
|
||||
0""1=y`
|
||||
```
|
||||
|
||||
This script prints out the maximum file descriptor available from
|
||||
repeated `dup(2)`s---usually `NOFILE - 1`. Can you see how it works?
|
||||
@@ -79,9 +84,11 @@ repeated `dup(2)`s---usually `NOFILE - 1`. Can you see how it works?
|
||||
|
||||
# [sorta.iecho](sorta.iecho)
|
||||
|
||||
```
|
||||
[" "$ld]:sld [ print a space ]ld
|
||||
[1s1+DA$ld1s1_+D=sD=x]:xld [ given n (argc-n), print args ]ld
|
||||
0a1_+D=x""` [ simulation of /bin/echo ]ld
|
||||
```
|
||||
|
||||
This is a clone of `/bin/echo`, minus any argument processing and escape
|
||||
interpretation. (Note that, unlike some shells' echo, `/bin/echo` prints a
|
||||
@@ -90,8 +97,9 @@ newline even with no arguments.) Try `./sorta foo bar < iecho`.
|
||||
|
||||
# [sorta.ifact1](sorta.ifact1)
|
||||
|
||||
|
||||
```
|
||||
1#`ld2*#`ld3*#`ld4*#`ld5*#`ld6*#`ld7*#`ld8*#`ld9*#`ld10*#`ld
|
||||
```
|
||||
|
||||
This is a very straightforward factorial program: Take 1, print it,
|
||||
multiply by 2, print it, multiply by 3, print it, etc.
|
||||
@@ -99,10 +107,11 @@ multiply by 2, print it, multiply by 3, print it, etc.
|
||||
|
||||
# [sorta.ifact2](sorta.ifact2)
|
||||
|
||||
|
||||
```
|
||||
[1+D2s*#`ld1s]:f
|
||||
1 0
|
||||
1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f
|
||||
```
|
||||
|
||||
`ifact1` does a lot of repeated work. `ifact2` takes advantage of this by
|
||||
keeping the current `n!` `n` on the stack. Each call to routine `f (1=f)`
|
||||
@@ -111,10 +120,11 @@ increments `n` by `1` and prints out the factorial.
|
||||
|
||||
# [sorta.ifact3](sorta.ifact3)
|
||||
|
||||
|
||||
```
|
||||
[1+D2s*#`ld1s]:f [ given (n-1)! (n-1), print n!, put n! n ]
|
||||
[2s1=f2s1_+D0>=x]:x [ given n n! x, print (n+1)! through (n+x)! ]
|
||||
0 1 10 1=x
|
||||
```
|
||||
|
||||
Finally, `ifact3` removes all the redundancy from `ifact2`, and exhibits
|
||||
proper documentation of stack routines. You can replace the `10` by
|
||||
@@ -123,16 +133,18 @@ anything in this version.
|
||||
|
||||
# [sorta.iio](sorta.iio)
|
||||
|
||||
[ a simple example of interpreting code on the fly ]ld
|
||||
```
|
||||
[ a simple example of interpreting code on the fly ]ld
|
||||
|
||||
["] "2 2+":xT ["]T " produces "T 1=x#T " which should be 4."T`
|
||||
```
|
||||
|
||||
Notice that `"2 2+"` is a literal string inside the program.
|
||||
|
||||
|
||||
# [sorta.irot13](sorta.irot13)
|
||||
|
||||
|
||||
```
|
||||
"[] [.tr] "
|
||||
["]".[a-m][n-z][A-M][N-Z]"[" ]TTT ["]".[n-z][a-m][N-Z][A-M]"[" ]TTT
|
||||
"[tr] !q"T:xld
|
||||
@@ -142,6 +154,7 @@ Notice that `"2 2+"` is a literal string inside the program.
|
||||
1A 0 [ that 0 is for RDONLY ]ld
|
||||
0 'o D0 1s>=hld
|
||||
0Ou1=x [ in a more complex spawner, this would be done under a fork ]ld
|
||||
```
|
||||
|
||||
Despite its name, `irot13` is meant to show how to exec a program with
|
||||
redirection from within `sorta`. You run it as `./sorta blah < irot13`; it
|
||||
@@ -154,21 +167,24 @@ executes the `tr`.
|
||||
|
||||
# [sorta.isleep](sorta.isleep)
|
||||
|
||||
|
||||
```
|
||||
["" "+sleep" "+5" "sleep" !q]:S [F0>1_+=S]:s
|
||||
"forking sleep 5..."`ld
|
||||
1=s
|
||||
"waiting for sleep to finish..."`ld
|
||||
w
|
||||
"done, sleep exit code " #T`
|
||||
```
|
||||
|
||||
This script illustrates the classic fork-exec-wait.
|
||||
|
||||
|
||||
# [sorta.itailrec](sorta.itailrec)
|
||||
|
||||
```
|
||||
[3*#" "T$ldD=f]:f
|
||||
1=f
|
||||
```
|
||||
|
||||
The sole purpose of this script is to prove that `sorta` can do infinite
|
||||
tail recursion (in this case, in program `f`). Do `./sorta < itailrec | more`
|
||||
@@ -177,9 +193,11 @@ and watch the powers of 3 (mod your computer's word size) flow by.
|
||||
|
||||
# [sorta.iwhosort](sorta.iwhosort)
|
||||
|
||||
```
|
||||
[0Ou "" "+-u" "sort" !q]:S [F0>1_+=S]:s
|
||||
[1Ou "" "+-u" "who" !q]:W [F0>1_+=W]:w
|
||||
P1=wO1=sOww
|
||||
```
|
||||
|
||||
This final example is a simple pipeline, `who | sort`.
|
||||
|
||||
|
||||
@@ -216,11 +216,11 @@ to reach into arbitrary parcels of memory.</p>
|
||||
|
||||
You are free to share and adapt this file under the terms of this license:
|
||||
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
|
||||
For more information, see:
|
||||
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
-->
|
||||
|
||||
@@ -283,7 +283,7 @@ to reach into arbitrary parcels of memory.</p>
|
||||
<div class="footer">
|
||||
<h2>Copyright and CC BY-SA 4.0 License</h2>
|
||||
<p>This file and web page is:</p>
|
||||
<blockquote><p><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></p></blockquote>
|
||||
<blockquote><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></blockquote>
|
||||
<p>You are free to share and adapt this file under the terms of this license:</p>
|
||||
<blockquote><b>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</b></blockquote>
|
||||
<p>For more information, see:</p>
|
||||
|
||||
@@ -169,11 +169,11 @@ you to place the meaningful letters wherever you want.</p>
|
||||
|
||||
You are free to share and adapt this file under the terms of this license:
|
||||
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
|
||||
For more information, see:
|
||||
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
-->
|
||||
|
||||
@@ -235,7 +235,7 @@ you to place the meaningful letters wherever you want.</p>
|
||||
<div class="footer">
|
||||
<h2>Copyright and CC BY-SA 4.0 License</h2>
|
||||
<p>This file and web page is:</p>
|
||||
<blockquote><p><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></p></blockquote>
|
||||
<blockquote><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></blockquote>
|
||||
<p>You are free to share and adapt this file under the terms of this license:</p>
|
||||
<blockquote><b>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</b></blockquote>
|
||||
<p>For more information, see:</p>
|
||||
|
||||
@@ -230,11 +230,11 @@ on the screen, dominates the time to compute the next generation.</p>
|
||||
|
||||
You are free to share and adapt this file under the terms of this license:
|
||||
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
|
||||
For more information, see:
|
||||
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
-->
|
||||
|
||||
@@ -296,7 +296,7 @@ on the screen, dominates the time to compute the next generation.</p>
|
||||
<div class="footer">
|
||||
<h2>Copyright and CC BY-SA 4.0 License</h2>
|
||||
<p>This file and web page is:</p>
|
||||
<blockquote><p><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></p></blockquote>
|
||||
<blockquote><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></blockquote>
|
||||
<p>You are free to share and adapt this file under the terms of this license:</p>
|
||||
<blockquote><b>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</b></blockquote>
|
||||
<p>For more information, see:</p>
|
||||
|
||||
+3
-3
@@ -212,11 +212,11 @@ encoded by adding one to every character of it just to confuse you).</p>
|
||||
|
||||
You are free to share and adapt this file under the terms of this license:
|
||||
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
|
||||
For more information, see:
|
||||
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
-->
|
||||
|
||||
@@ -279,7 +279,7 @@ encoded by adding one to every character of it just to confuse you).</p>
|
||||
<div class="footer">
|
||||
<h2>Copyright and CC BY-SA 4.0 License</h2>
|
||||
<p>This file and web page is:</p>
|
||||
<blockquote><p><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></p></blockquote>
|
||||
<blockquote><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></blockquote>
|
||||
<p>You are free to share and adapt this file under the terms of this license:</p>
|
||||
<blockquote><b>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</b></blockquote>
|
||||
<p>For more information, see:</p>
|
||||
|
||||
@@ -219,11 +219,11 @@ for the student.</p>
|
||||
|
||||
You are free to share and adapt this file under the terms of this license:
|
||||
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
|
||||
For more information, see:
|
||||
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
-->
|
||||
|
||||
@@ -286,7 +286,7 @@ for the student.</p>
|
||||
<div class="footer">
|
||||
<h2>Copyright and CC BY-SA 4.0 License</h2>
|
||||
<p>This file and web page is:</p>
|
||||
<blockquote><p><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></p></blockquote>
|
||||
<blockquote><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></blockquote>
|
||||
<p>You are free to share and adapt this file under the terms of this license:</p>
|
||||
<blockquote><b>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</b></blockquote>
|
||||
<p>For more information, see:</p>
|
||||
|
||||
+3
-3
@@ -204,11 +204,11 @@ as assistant pizza chef. Larry Bassel was official taste tester. Yummo!</p>
|
||||
|
||||
You are free to share and adapt this file under the terms of this license:
|
||||
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
|
||||
For more information, see:
|
||||
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
-->
|
||||
|
||||
@@ -267,7 +267,7 @@ as assistant pizza chef. Larry Bassel was official taste tester. Yummo!</p>
|
||||
<div class="footer">
|
||||
<h2>Copyright and CC BY-SA 4.0 License</h2>
|
||||
<p>This file and web page is:</p>
|
||||
<blockquote><p><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></p></blockquote>
|
||||
<blockquote><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></blockquote>
|
||||
<p>You are free to share and adapt this file under the terms of this license:</p>
|
||||
<blockquote><b>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</b></blockquote>
|
||||
<p>For more information, see:</p>
|
||||
|
||||
+11
-11
@@ -182,23 +182,23 @@ write the smallest playable game, but keep the playability and
|
||||
enjoyment high.</p>
|
||||
<h3 id="instructions">Instructions:</h3>
|
||||
<p>Key to map:</p>
|
||||
<pre><code> |
|
||||
<pre><code> |
|
||||
###### | | | /\ /--\ ==| /\ | | Directonal keys
|
||||
###### Solid Wall | ----|| \/ /\ ||---- (unlock doors of
|
||||
###### | \/ ==| \--/ \/ the same direction)
|
||||
|\
|
||||
| << >> Doors. Unlocked by
|
||||
Blank space | << vvvvvv ^^^^^^ >> the above keys.
|
||||
| << >>
|
||||
|\
|
||||
|\
|
||||
| << >> 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.
|
||||
|</code></pre>
|
||||
|</code></pre>
|
||||
<p>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 <code>484</code>. (alter the value of <code>u</code> in
|
||||
@@ -216,11 +216,11 @@ Take care that it’s facing in the correct direction.</p>
|
||||
|
||||
You are free to share and adapt this file under the terms of this license:
|
||||
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
|
||||
For more information, see:
|
||||
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
-->
|
||||
|
||||
@@ -284,7 +284,7 @@ Take care that it’s facing in the correct direction.</p>
|
||||
<div class="footer">
|
||||
<h2>Copyright and CC BY-SA 4.0 License</h2>
|
||||
<p>This file and web page is:</p>
|
||||
<blockquote><p><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></p></blockquote>
|
||||
<blockquote><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></blockquote>
|
||||
<p>You are free to share and adapt this file under the terms of this license:</p>
|
||||
<blockquote><b>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</b></blockquote>
|
||||
<p>For more information, see:</p>
|
||||
|
||||
+13
-13
@@ -167,7 +167,7 @@ next move, recompile <code>nextmove.c</code> and play it again:</p>
|
||||
<p>We have provided the shell script, <a href="ttt.sh">ttt</a>, to make it easier to play the
|
||||
game:</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> ttt</span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./ttt</span> <span class="pp">[</span><span class="ss">first_move</span><span class="pp">]</span> <span class="co"># <- omit first arg to have it move first</span></span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./ttt</span> <span class="pp">[</span><span class="ss">first_move</span><span class="pp">]</span> <span class="co"># <- omit first arg to have it move first</span></span>
|
||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./ttt</span> next_move</span></code></pre></div>
|
||||
<p>The shell script determines when the game is over, and automatically replaces
|
||||
<code>merlyn.c</code> (copied from <a href="westley.c">westley.c</a> with an improved version after a
|
||||
@@ -179,9 +179,9 @@ loss). The <a href="ttt.sh">ttt</a> script has two other modes:</p>
|
||||
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./ttt</span> 4</span>
|
||||
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./ttt</span> 6</span></code></pre></div>
|
||||
<p>The final might look like:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a> a<span class="op">(</span>X<span class="op">){</span><span class="co">/*/X=- a(X){/*/</span>X<span class="op">=-</span></span>
|
||||
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a> X <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;</span>X<span class="op">=-</span> <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;</span>X<span class="op">=-</span></span>
|
||||
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a> <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;}</span><span class="co">/*/ -1;F;}/*/</span></span>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a> a<span class="op">(</span>X<span class="op">){</span><span class="co">/*/X=- a(X){/*/</span>X<span class="op">=-</span></span>
|
||||
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a> X <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;</span>X<span class="op">=-</span> <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;</span>X<span class="op">=-</span></span>
|
||||
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a> <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;}</span><span class="co">/*/ -1;F;}/*/</span></span>
|
||||
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> z<span class="op">[][</span><span class="dv">100</span><span class="op">]={</span><span class="st">"char z[][100]={"</span><span class="op">,</span><span class="st">"a(X){/*/X=-"</span><span class="op">,</span><span class="st">"-1;F;X=-"</span><span class="op">,</span><span class="st">"-1;F;}/*/"</span><span class="op">,</span><span class="st">"1999999999 :-) "</span><span class="op">,</span></span>
|
||||
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a><span class="st">"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(*"</span><span class="op">,</span></span>
|
||||
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a><span class="st">"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"</span><span class="op">,</span></span>
|
||||
@@ -191,9 +191,9 @@ loss). The <a href="ttt.sh">ttt</a> script has two other modes:</p>
|
||||
<span id="cb9-10"><a href="#cb9-10" aria-hidden="true" tabindex="-1"></a><span class="st">"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"</span><span class="op">,</span></span>
|
||||
<span id="cb9-11"><a href="#cb9-11" aria-hidden="true" tabindex="-1"></a><span class="st">",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"</span><span class="op">,</span></span>
|
||||
<span id="cb9-12"><a href="#cb9-12" aria-hidden="true" tabindex="-1"></a><span class="st">";s(q=12);P(48);P('}');P(59);N;q=0;L(1);for(i=5;i<13;)s(i++),N;L(2);}"</span><span class="op">,</span><span class="dv">0</span><span class="op">};</span></span>
|
||||
<span id="cb9-13"><a href="#cb9-13" aria-hidden="true" tabindex="-1"></a> b<span class="op">(</span>X<span class="op">){</span><span class="co">/*/X=- b(X){/*/</span>X<span class="op">=-</span></span>
|
||||
<span id="cb9-14"><a href="#cb9-14" aria-hidden="true" tabindex="-1"></a> X <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;</span>X<span class="op">=-</span> <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;</span>X<span class="op">=-</span> X</span>
|
||||
<span id="cb9-15"><a href="#cb9-15" aria-hidden="true" tabindex="-1"></a> <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;}</span><span class="co">/*/ -1;F;}/*/</span></span>
|
||||
<span id="cb9-13"><a href="#cb9-13" aria-hidden="true" tabindex="-1"></a> b<span class="op">(</span>X<span class="op">){</span><span class="co">/*/X=- b(X){/*/</span>X<span class="op">=-</span></span>
|
||||
<span id="cb9-14"><a href="#cb9-14" aria-hidden="true" tabindex="-1"></a> X <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;</span>X<span class="op">=-</span> <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;</span>X<span class="op">=-</span> X</span>
|
||||
<span id="cb9-15"><a href="#cb9-15" aria-hidden="true" tabindex="-1"></a> <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;}</span><span class="co">/*/ -1;F;}/*/</span></span>
|
||||
<span id="cb9-16"><a href="#cb9-16" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> q<span class="op">,</span>i<span class="op">,</span>j<span class="op">,</span>k<span class="op">,</span>X<span class="op">,</span>O<span class="op">=</span><span class="dv">0</span><span class="op">,</span>H<span class="op">;</span>S<span class="op">(</span>x<span class="op">)</span><span class="dt">int</span><span class="op">*</span>x<span class="op">;{</span>X<span class="op">+=</span>X<span class="op">;</span>O<span class="op">+=</span>O<span class="op">;*</span>x<span class="op">+</span><span class="dv">1</span><span class="op">?*</span>x<span class="op">+</span><span class="dv">2</span><span class="op">||</span>X<span class="op">++:</span>O<span class="op">++;*</span>x<span class="op">=</span><span class="dv">1</span><span class="op">;}</span>L<span class="op">(</span>n<span class="op">){</span><span class="cf">for</span><span class="op">(*</span></span>
|
||||
<span id="cb9-17"><a href="#cb9-17" aria-hidden="true" tabindex="-1"></a>z<span class="op">[</span>i<span class="op">=</span><span class="dv">1</span><span class="op">]=</span>n<span class="op">+</span><span class="dv">97</span><span class="op">;</span>i<span class="op"><</span><span class="dv">4</span><span class="op">;</span>i<span class="op">++)</span>M<span class="op">(</span><span class="dv">256</span><span class="op">),</span>s<span class="op">(</span>i<span class="op">),</span>M<span class="op">(</span><span class="dv">128</span><span class="op">),</span>s<span class="op">(</span>i<span class="op">),</span>M<span class="op">(</span><span class="dv">64</span><span class="op">),</span>N<span class="op">;</span>X<span class="op">*=</span><span class="dv">8</span><span class="op">;</span>O<span class="op">*=</span><span class="dv">8</span><span class="op">;}</span>s<span class="op">(</span>R<span class="op">){</span><span class="dt">char</span><span class="op">*</span>r<span class="op">=</span>z</span>
|
||||
<span id="cb9-18"><a href="#cb9-18" aria-hidden="true" tabindex="-1"></a><span class="op">[</span>R<span class="op">];</span><span class="cf">for</span><span class="op">(</span>q<span class="op">&&</span>Q<span class="op">;*</span>r<span class="op">;)</span>P<span class="op">(*</span>r<span class="op">++);</span>q<span class="op">&&(</span>Q<span class="op">,</span>P<span class="op">(</span><span class="dv">44</span><span class="op">));}</span>M<span class="op">(</span>m<span class="op">){</span>P<span class="op">(</span><span class="dv">9</span><span class="op">);</span>i<span class="op">-</span><span class="dv">2</span><span class="op">||</span>P<span class="op">(</span>X<span class="op">&</span>m<span class="op">?</span><span class="dv">88</span><span class="op">:</span>O<span class="op">&</span>m<span class="op">?</span><span class="dv">48</span><span class="op">:</span><span class="dv">32</span><span class="op">);</span>P<span class="op">(</span></span>
|
||||
@@ -202,9 +202,9 @@ loss). The <a href="ttt.sh">ttt</a> script has two other modes:</p>
|
||||
<span id="cb9-21"><a href="#cb9-21" aria-hidden="true" tabindex="-1"></a>c<span class="op">(</span><span class="dv">1</span><span class="op">);*</span>J<span class="op">=--</span>u<span class="op">?</span>O<span class="op">?*</span>J<span class="op">:*</span>v<span class="op">[</span><span class="dv">1</span><span class="op">]:</span><span class="dv">53</span><span class="op">;</span>X<span class="op">|=</span>u<span class="op"><<</span><span class="dv">57</span><span class="op">-*</span>v<span class="op">[</span>u<span class="op">];</span>y<span class="op">(</span>X<span class="op">);</span>K<span class="op">=</span><span class="dv">40</span><span class="op">+</span>q<span class="op">;</span>q<span class="op">?</span>e<span class="op">(</span>O<span class="op">,</span>X<span class="op">),</span>q<span class="op">&&(</span>K<span class="op">=</span><span class="ch">'|'</span><span class="op">),</span>e<span class="op">(</span>X</span>
|
||||
<span id="cb9-22"><a href="#cb9-22" aria-hidden="true" tabindex="-1"></a><span class="op">,</span>O<span class="op">),</span>R<span class="op">(),</span>O<span class="op">|=</span><span class="dv">1</span><span class="op"><<--</span>i<span class="op">:</span>J<span class="op">[*</span>J<span class="op">-</span><span class="dv">48</span><span class="op">+(</span>X<span class="op">=</span>O<span class="op">=</span><span class="dv">0</span><span class="op">)]--;</span>L<span class="op">(</span>q<span class="op">=</span><span class="dv">0</span><span class="op">);</span><span class="cf">for</span><span class="op">(</span>s<span class="op">(</span>i<span class="op">=</span><span class="dv">0</span><span class="op">);</span>q<span class="op">=</span>i<span class="op"><</span><span class="dv">12</span><span class="op">;)</span>s<span class="op">(</span>i<span class="op">++),</span>i<span class="op">></span><span class="dv">4</span><span class="op">&&</span>N</span>
|
||||
<span id="cb9-23"><a href="#cb9-23" aria-hidden="true" tabindex="-1"></a><span class="op">;</span>s<span class="op">(</span>q<span class="op">=</span><span class="dv">12</span><span class="op">);</span>P<span class="op">(</span><span class="dv">48</span><span class="op">);</span>P<span class="op">(</span><span class="ch">'}'</span><span class="op">);</span>P<span class="op">(</span><span class="dv">59</span><span class="op">);</span>N<span class="op">;</span>q<span class="op">=</span><span class="dv">0</span><span class="op">;</span>L<span class="op">(</span><span class="dv">1</span><span class="op">);</span><span class="cf">for</span><span class="op">(</span>i<span class="op">=</span><span class="dv">5</span><span class="op">;</span>i<span class="op"><</span><span class="dv">13</span><span class="op">;)</span>s<span class="op">(</span>i<span class="op">++),</span>N<span class="op">;</span>L<span class="op">(</span><span class="dv">2</span><span class="op">);}</span></span>
|
||||
<span id="cb9-24"><a href="#cb9-24" aria-hidden="true" tabindex="-1"></a> c<span class="op">(</span>X<span class="op">){</span><span class="co">/*/X=- c(X){/*/</span>X<span class="op">=-</span></span>
|
||||
<span id="cb9-25"><a href="#cb9-25" aria-hidden="true" tabindex="-1"></a> <span class="dv">0</span> <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;</span>X<span class="op">=-</span> <span class="dv">0</span> <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;</span>X<span class="op">=-</span> <span class="dv">0</span></span>
|
||||
<span id="cb9-26"><a href="#cb9-26" aria-hidden="true" tabindex="-1"></a> <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;}</span><span class="co">/*/ -1;F;}/*/</span></span>
|
||||
<span id="cb9-24"><a href="#cb9-24" aria-hidden="true" tabindex="-1"></a> c<span class="op">(</span>X<span class="op">){</span><span class="co">/*/X=- c(X){/*/</span>X<span class="op">=-</span></span>
|
||||
<span id="cb9-25"><a href="#cb9-25" aria-hidden="true" tabindex="-1"></a> <span class="dv">0</span> <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;</span>X<span class="op">=-</span> <span class="dv">0</span> <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;</span>X<span class="op">=-</span> <span class="dv">0</span></span>
|
||||
<span id="cb9-26"><a href="#cb9-26" aria-hidden="true" tabindex="-1"></a> <span class="op">-</span><span class="dv">1</span><span class="op">;</span>F<span class="op">;}</span><span class="co">/*/ -1;F;}/*/</span></span>
|
||||
<span id="cb9-27"><a href="#cb9-27" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb9-28"><a href="#cb9-28" aria-hidden="true" tabindex="-1"></a>ttt<span class="op">:</span> I win<span class="op">!</span></span></code></pre></div>
|
||||
<p>Redirects stderr to <code>/dev/null</code> by default. If you need errors or warnings use
|
||||
@@ -350,11 +350,11 @@ found. A template is scanned from bottom to top, right to left
|
||||
|
||||
You are free to share and adapt this file under the terms of this license:
|
||||
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
|
||||
For more information, see:
|
||||
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
-->
|
||||
|
||||
@@ -419,7 +419,7 @@ found. A template is scanned from bottom to top, right to left
|
||||
<div class="footer">
|
||||
<h2>Copyright and CC BY-SA 4.0 License</h2>
|
||||
<p>This file and web page is:</p>
|
||||
<blockquote><p><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></p></blockquote>
|
||||
<blockquote><b>Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></blockquote>
|
||||
<p>You are free to share and adapt this file under the terms of this license:</p>
|
||||
<blockquote><b>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</b></blockquote>
|
||||
<p>For more information, see:</p>
|
||||
|
||||
Reference in new issue
Block a user