Updated make script. Started new slides for pseudocode

This commit is contained in:
james ryan 2024-08-22 19:14:40 -04:00
parent 9390ec3aeb
commit c42d524ab4
3 changed files with 54 additions and 10 deletions

34
make.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash -x
HELP=$(
cat << EOF
usage: $0 <presentation dir>\n\n
include optional media in\n
./<presentation dir>/media!
EOF
)
if ! [ -d $1 ]; then
echo -e "Please enter a directory that exists!"
exit 1
fi
if ! [ $# -eq 1 ]; then
cowsay_avail=
if type -a cowsay&>2; then
echo -e $HELP | cowsay -n
else
echo -e $HELP
fi
exit 1
fi
if [ ${1: -1} = '/' ]; then
echo $1 | head -c-2 | set -- - # clears rest of args
fi
ARGS=--output_dir\ ./$1/out
if [[ -d ./$1/media ]]; then
ARGS=$ARGS\ --include\ ./$1/media
fi
mdslides ./$1/$1.md $ARGS

View File

@ -1,7 +0,0 @@
#!/bin/bash
if ! [ $# -eq 1 ]; then
echo -e "usage: $0 <presentation.md>\n\nmake sure media is in ./media!" | cowsay -n
exit 1
fi
mdslides $1 --include media --output_dir out_$1

View File

@ -129,14 +129,31 @@ You may work in groups, or work alone.
[comment]: # (|||)
## Example algorithm: Finding numbers
## Example solution
[comment]: # (|||)
## Lets review: Fibonnaci
[comment]: # (!!!)
## A puzzle! Finding numbers
Ok, heres a scenario: Lets say we have a computer with a clock speed of
`1 Hz`, or 1 calculation per second. This is our only tool for getting into
a room which has a passcode thats a random number between 1 & 100.
If we guess wrong, it tells us "higher" or "lower", to indicate what our
next guess could be (provided by a built-in `bool guess(int)` function.
How do we break in?
next guess could be (provided by a built-in `bool guess(int try)` function.
How do we break in, taking as little time as possible?
Note:
if this is too easy or if someone finishes really early, change it up:
It now generates a *determined* `n` number of numbers.
`guess` has a second arg, `int position`.
All `n` numbers must add to a *determined* sum to let you in.
`direction` tells you how close you are to this sum.
[comment]: # (|||)