diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-03-27 15:42:52 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-03-27 15:42:52 +0200 |
commit | 446f7a2761b3f15e52f396ec337799d788efac97 (patch) | |
tree | 5ac72ae3a92470eb6b2f875506438385d3f7be4c /os1eindopdracht/uhm.awk | |
parent | 1ea23e3b923ea89b97a51edc75e1a8d13264e758 (diff) |
add manpage and check requirements
Diffstat (limited to 'os1eindopdracht/uhm.awk')
-rwxr-xr-x | os1eindopdracht/uhm.awk | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/os1eindopdracht/uhm.awk b/os1eindopdracht/uhm.awk index c34333f..c57f7c5 100755 --- a/os1eindopdracht/uhm.awk +++ b/os1eindopdracht/uhm.awk @@ -1,7 +1,5 @@ #!/bin/awk -f -function prompt() { - printf "> " -} +function prompt() { printf "> " } BEGIN { word=word @@ -11,15 +9,6 @@ BEGIN { prompt() } -function header() { - printf "\n\n\n" - hidden_word = word - # replace all characters not in set `guessed_letters` with "_" - gsub("[^'"guessed_letters"]", "_", hidden_word) - print "current word: " hidden_word - print "you have " guesses " guess" (guesses == 1 ? "" : "es") " left" -} - function guess(a) { if (index(guessed_letters, a) != 0) { print "already guessed " a "!" @@ -41,7 +30,14 @@ function guess(a) { exit 0 } - header() + # print header + printf "\n\n\n" + hidden_word = word + # replace all characters not in set `guessed_letters` with "_" + gsub("[^'"guessed_letters"]", "_", hidden_word) + print "current word: " hidden_word + print "guessed letters: " guessed_letters + print "you have " guesses " guess" (guesses == 1 ? "" : "es") " left" } { |