Add alt code to 2020/ferguson2
This alt code prints out the text one character at a time to make it
easier to read and more generally so it's not dumped out at once. This
also makes it a bit more like the original thing (at least as I recall
it :-) ).
The default sleep time is 400000 microseconds but one can change it
like:
make clobber SLEEP=0 alt
which would disable the delay, making it like the original.
If it's < 0 then it's set to the default.
I did not yet add a try.sh script. That'll likely come later when
working on 2020. I only did this now as I thought of this idea and
didn't want to forget it.
This commit is contained in:
1 parent
0f3a4b8a68
commit
4d0b3a25fc
4 files changed
+117
-2
No files matched your search
@@ -4,6 +4,10 @@
|
||||
make
|
||||
```
|
||||
|
||||
The author provided alternate code that prints the output one character at a
|
||||
time to make it a bit more like the real thing in that it isn't dumped out all
|
||||
at once. See [Alternate code](#alternate-code) below.
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
@@ -87,6 +91,50 @@ echo | ./recode -v
|
||||
do?
|
||||
|
||||
|
||||
## Alternate code:
|
||||
|
||||
This version, [prog.alt.c](prog.alt.c), writes a character at a time, sleeping
|
||||
after each character, so that one can read it more easily (for longer output)
|
||||
and to make it a bit more like the real thing.
|
||||
|
||||
|
||||
### Alternate build:
|
||||
|
||||
|
||||
```sh
|
||||
make alt
|
||||
```
|
||||
|
||||
The default time to sleep is 400000 microseconds but you can change this by
|
||||
doing:
|
||||
|
||||
```sh
|
||||
make clobber SLEEP=600000 alt
|
||||
```
|
||||
|
||||
to change it to 600000 microseconds. It guards against negative numbers.
|
||||
|
||||
|
||||
### Alternate use:
|
||||
|
||||
Use `prog.alt` as you would `prog` above.
|
||||
|
||||
|
||||
### Alternate try:
|
||||
|
||||
|
||||
```sh
|
||||
# encipher input.txt with default settings:
|
||||
cat input.txt | ./prog.alt
|
||||
|
||||
# decipher enciphered input.txt with default settings:
|
||||
cat input.txt | ./prog| ./prog.alt
|
||||
```
|
||||
|
||||
Notice how only the last part should use the `prog.alt`. Why? Try it and find
|
||||
out! Can you figure out why this works this way?
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
This code is an [enigma](https://youtu.be/ybkkiGtJmkM). Try to decode it!
|
||||
|
||||
Reference in new issue
Block a user