From c42d524ab42d0dafc0b727f238837c7439cf4e1c Mon Sep 17 00:00:00 2001 From: JAMES RYAN Date: Thu, 22 Aug 2024 19:14:40 -0400 Subject: [PATCH] Updated make script. Started new slides for pseudocode --- make.sh | 34 ++++++++++++++++++++++++++++++++++ pseudocode/make.sh | 7 ------- pseudocode/pseudocode.md | 23 ++++++++++++++++++++--- 3 files changed, 54 insertions(+), 10 deletions(-) create mode 100755 make.sh delete mode 100755 pseudocode/make.sh diff --git a/make.sh b/make.sh new file mode 100755 index 0000000..29f3718 --- /dev/null +++ b/make.sh @@ -0,0 +1,34 @@ +#!/bin/bash -x +HELP=$( +cat << EOF + usage: $0 \n\n + include optional media in\n + .//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 diff --git a/pseudocode/make.sh b/pseudocode/make.sh deleted file mode 100755 index 7fb82ba..0000000 --- a/pseudocode/make.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -if ! [ $# -eq 1 ]; then - echo -e "usage: $0 \n\nmake sure media is in ./media!" | cowsay -n - exit 1 -fi - -mdslides $1 --include media --output_dir out_$1 diff --git a/pseudocode/pseudocode.md b/pseudocode/pseudocode.md index cfabcbd..37ee87f 100644 --- a/pseudocode/pseudocode.md +++ b/pseudocode/pseudocode.md @@ -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]: # (|||)