Update 1992/buzzard.1

Format fixes in README.md.

Note that it'll crash without two args both in bugs.md and README.md.
This commit is contained in:
Cody Boone Ferguson committed 2023-04-09 09:32:03 -07:00
1 parent 460443fa48
commit 48559c1f16
2 files changed
+100 -71

No files matched your search

+92 -71
View File
@@ -1,36 +1,51 @@
Most Obfuscated Algorithm: # Most Obfuscated Algorithm:
Sean Barrett Sean Barrett
Software Construction Company Software Construction Company
430 Southwest Parkway, #1906 430 Southwest Parkway, #1906
College Station, TX 77840 College Station, TX 77840
USA USA
## To build: ## To build:
make all ```sh
make all
```
## To run ## To run
./buzzard.1 0 10 ```sh
./buzzard.1 56 720 ./buzzard.1 num num
./buzzard.1 1 521
## Judges' comments ```
NOTE: this program will crash without two args.
## Try:
```sh
./buzzard.1 0 10
./buzzard.1 56 720
./buzzard.1 1 521
```
## Judges' comments:
To see good C Preprocessor buzzard.1, try: To see good C Preprocessor buzzard.1, try:
make babble.cppcb ```sh
cat babble.cppcb make babble.cppcb
cat babble.cppcb
```
Notice how many statements it takes to do anything useful? Notice how many statements it takes to do anything useful?
## Author's comments; ## Author's comments:
What you shouldn't think about buzzard.1: What you shouldn't think about `buzzard.1`:
`buzzard.1` doesn't just do a mass of #defines as its obfuscation. `buzzard.1` doesn't just do a mass of `#define`s as its obfuscation.
### What you should be glad about: ### What you should be glad about:
@@ -75,8 +90,8 @@ error message.
`buzzard.1` is a translator from a pseudo-assembly language into a subset of C `buzzard.1` is a translator from a pseudo-assembly language into a subset of C
suitable for execution on Charles Babbage's Analytical Engine. Or rather, the suitable for execution on Charles Babbage's Analytical Engine. Or rather, the
`#define`s in `buzzard.1` are that translator. The rest of buzzard.1 is a `#define`s in `buzzard.1` are that translator. The rest of `buzzard.1` is a
buzzard.1 program. If you run the whole mess through CPP and a beautifier, you `buzzard.1` program. If you run the whole mess through CPP and a beautifier, you
will see that all you have is a loop that runs until a variable is not 0, and a will see that all you have is a loop that runs until a variable is not 0, and a
sequence of assignment statements. The assignment statements are all of the sequence of assignment statements. The assignment statements are all of the
form `a op= b` or `a = b`. The Engine actually allowed 'a = b op c'. Only `+`, form `a op= b` or `a = b`. The Engine actually allowed 'a = b op c'. Only `+`,
@@ -102,58 +117,56 @@ themselves to it.
### Theoretical observations: ### Theoretical observations:
The simulated comparison operations only work with a certain The simulated comparison operations only work with a certain range of numbers;
range of numbers; numbers that are too large will cause the numbers that are too large will cause the output code to fail to simulate the
output code to fail to simulate the input code. This means input code. This means that this implementation of `buzzard.1` would not be
that this implementation of buzzard.1 would not be Turing-complete, Turing-complete, even if the AE could process indefinitely-sized numbers.
even if the AE could process indefinitely-sized numbers. However, this is actually a constraint that no actual computer can meet, either,
However, this is actually a constraint that no actual computer so we can conclude that if an AE, with card bins connected as suggested above,
can meet, either, so we can conclude that if an AE, with were hooked up to a memory unit of sufficient size, it would be as Turing
card bins connected as suggested above, were hooked up to complete as any existing machine (or, for those who interpret that excessively
a memory unit of sufficient size, it would be as Turing critically, i.e. "not at all" for both, we can simply say that the AE could
complete as any existing machine (or, for those who simulate any existing machine--although not quickly). This would be a good
interpret that excessively critically, i.e. "not at all" for place to site some references on the AE, but I don't have any.
both, we can simply say that the AE could simulate any
existing machine--although not quickly). This would be a
good place to site some references on the AE, but I don't
have any.
### Definition of the input language to buzzard.1 (OR What Exactly Do All The Macros Do?): ### Definition of the input language to buzzard.1 (OR What Exactly Do All The Macros Do?):
[Don't read this unless you're stumped!] [Don't read this unless you're stumped!]
MACRO FUNCTION MNEMONIC ```
V begin variable declarations Variable MACRO FUNCTION MNEMONIC
C begin program Code
Q(b,a) let b = a eQuals V begin variable declarations Variable
A(c,a,b) let c = a + b Add C begin program Code
S(c,a,b) let c = a - b Subtract
D(c,a,b) let c = a / b, where b is a *constant* Divide
U(c,a,b) let c = a / b, where b is anything Unknown
M(c,a,b) let c = a * b Multiply
O(c,a,b) let c = a boolean-or b (a,b are 0 or 1) Or Q(b,a) let b = a eQuals
B(b, a) let b = boolean value of a Boolean A(c,a,b) let c = a + b Add
P(b, a) let b = 1 if a>0, else 0. Positive S(c,a,b) let c = a - b Subtract
D(c,a,b) let c = a / b, where b is a *constant* Divide
U(c,a,b) let c = a / b, where b is anything Unknown
M(c,a,b) let c = a * b Multiply
l emit next sequential label Label O(c,a,b) let c = a boolean-or b (a,b are 0 or 1) Or
J(x) goto label #x Jump B(b, a) let b = boolean value of a Boolean
P(b, a) let b = 1 if a>0, else 0. Positive
Z(a,d) if a is 0 goto d (a is 0 or 1) Zero l emit next sequential label Label
E(a,d) if a is 1 goto d (a is 0 or 1) Else J(x) goto label #x Jump
H halt Haly Z(a,d) if a is 0 goto d (a is 0 or 1) Zero
E(a,d) if a is 1 goto d (a is 0 or 1) Else
K(x) let x = number of cmd line arguments Kount H halt Haly
G(x,y) let x = the value if the yth argument Get argument
T end of code; begin output section Terminate K(x) let x = number of cmd line arguments Kount
X(y) print out hexadecimal value of y heXadecimal G(x,y) let x = the value if the yth argument Get argument
T end of output section and program Terminate
T end of code; begin output section Terminate
X(y) print out hexadecimal value of y heXadecimal
T end of output section and program Terminate
```
You can figure out the other macros yourself. In the sample program, I've You can figure out the other macros yourself. In the sample program, I've
actually implemented subroutines by saving a return address in a variable and actually implemented subroutines by saving a return address in a variable and
@@ -168,32 +181,40 @@ programs is the conditional (given that we have loops).
Since all you can do in the given operation output set is Since all you can do in the given operation output set is
assignment, we implement "conditional assignment": assignment, we implement "conditional assignment":
if (x) y = z; ```
if (x) y = z;
```
To implement this, we constrain x to be either 0 or 1, and To implement this, we constrain x to be either 0 or 1, and
simply compute: simply compute:
y = (z * x) + (y * (1-x)); ```
y = (z * x) + (y * (1-x));
```
This is more obscured by factoring out common terms and restricting This is more obscured by factoring out common terms and restricting
ourselves to two operand operations: ourselves to two operand operations:
temp = z; (temp == z) ```
temp -= y; (temp == z-y) temp = z; (temp == z)
temp *= x; (temp == (z-y)*x) temp -= y; (temp == z-y)
y += temp; (y == (z-y)*x + y) temp *= x; (temp == (z-y)*x)
( == z*x - y*x + y) y += temp; (y == (z-y)*x + y)
( == z*x + y*(1-x)) ( == z*x - y*x + y)
( == z*x + y*(1-x))
```
Next we imagine we have a pc. "I'm supposed to execute statement Next we imagine we have a [pc](https://en.wikipedia.org/wiki/Program_counter).
pc next", says our emulator. But suppose we're not currently "I'm supposed to execute statement pc next", says our emulator. But suppose
coming up on statement pc. To handle this, we simply make every we're not currently coming up on statement pc. To handle this, we simply make
operation conditional on the pc having the correct value: every operation conditional on the pc having the correct value:
if (pc == some_constant) y = z; ```
if (pc == some_constant) y = z;
```
To combine this with other operations, we simply multiply by our To combine this with other operations, we simply multiply by our
(`pc == some_constant`) flag right after the above 'temp `*= x'`. (`pc == some_constant`) flag right after the above `temp *= x`.
To evaluate `pc == some_constant` requires one more trick. We assume that To evaluate `pc == some_constant` requires one more trick. We assume that
numbers can only be in some limited range. Then we use successive additions and numbers can only be in some limited range. Then we use successive additions and
+8
View File
@@ -498,6 +498,14 @@ This program crashes. This will be worked on in the near future.
# 1992 # 1992
## [1992/buzzard.1](1992/buzzard.1/buzzard.1.c) ([README.md](1992/buzzard.1/README.md))
## STATUS: INABIAF - please **DO NOT** fix
This entry will crash without enough args (2). At this time this is not
considered a bug to fix so it should not be fixed.
## [1992/lush](1992/lush/lush.c) ([README.md](1992/lush/README.md)) ## [1992/lush](1992/lush/lush.c) ([README.md](1992/lush/README.md))
## STATUS: doesn't work with some compilers - please provide alternative code ## STATUS: doesn't work with some compilers - please provide alternative code