Boogle is a fun little word game. There are 100 words and E H X B
you have 3 attempts to guess the word hidden in the grid. S M P S
Look for words: horizontally, vertically, or diagonally. O Z T B
J A D E
On 02.11.2023 01:42, Mike Sanders wrote:
Boogle is a fun little word game. There are 100 words and E H X B
you have 3 attempts to guess the word hidden in the grid. S M P S
Look for words: horizontally, vertically, or diagonally. O Z T B
J A D E
How many words are hidden in there? - Are names or acronyms allowed?
Country codes? Organizations? Units? May they be of arbitrary length?
"jade", "so", "be", "Oz", "SMP", "DE", "BE", "ESO", "em", ... :-)
How many words are hidden in there? - Are names or acronyms allowed?
Country codes? Organizations? Units? May they be of arbitrary length?
"jade", "so", "be", "Oz", "SMP", "DE", "BE", "ESO", "em", ... :-)
Crude REPL of sorts. Quite pastime to fritter away a few moments.Regarding:
Download: https://busybox.neocities.org/notes/boogle.txt
Regarding:
# requires awk, an ANSI capable terminal & the sleep command
...
sub(/^[[:space:]]+/, "", str)
...
system("sleep 0.00001")
Not all awk variants support POSIX character classes like `[[:space:]]`
and not all platforms support sleep intervals at a lower granularity
than 1 second intervals so your comment should say:
# requires a POSIX awk, an ANSI capable terminal & a sleep command that supports microsecond intervals
or similar.
For your `load_words()` function, consider doing this instead:
$ awk '
function load_words(words) {
return \
split("\
ABLY ACID AGES ALOE BARK BOLT BULK CALM CLAD DAZE \
DEAF EASE ECHO EDGE FAME FAWN FLOW GAZE GEAR HALT \
", words, " ")
}
BEGIN {
n = load_words(w)
for (i=1; i<=n; i++) {
print i, w[i]
}
}
'
1 ABLY
2 ACID
3 AGES
4 ALOE
5 BARK
6 BOLT
7 BULK
8 CALM
9 CLAD
10 DAZE
11 DEAF
12 EASE
13 ECHO
14 EDGE
15 FAME
16 FAWN
17 FLOW
18 GAZE
19 GEAR
20 HALT
to make listing your words less typing and easier to modify if you have
to, so you don't need to hard-code `100` in the return statement, and so
you don't NEED to end up with a global array named `w[]`. Obviously add
the other words inside the string in `split()`.
As I mentioned in another post a few minutes ago, don't use all upper
case variable names for user-defined variables.
Ed Morton <mortonspam@gmail.com> wrote:
Regarding:
# requires awk, an ANSI capable terminal & the sleep command
...
sub(/^[[:space:]]+/, "", str)
...
system("sleep 0.00001")
Not all awk variants support POSIX character classes like `[[:space:]]`
and not all platforms support sleep intervals at a lower granularity
than 1 second intervals so your comment should say:
# requires a POSIX awk, an ANSI capable terminal & a sleep command that
supports microsecond intervals
or similar.
For your `load_words()` function, consider doing this instead:
$ awk '
function load_words(words) {
return \
split("\
ABLY ACID AGES ALOE BARK BOLT BULK CALM CLAD DAZE \
DEAF EASE ECHO EDGE FAME FAWN FLOW GAZE GEAR HALT \
", words, " ")
}
BEGIN {
n = load_words(w)
for (i=1; i<=n; i++) {
print i, w[i]
}
}
'
1 ABLY
2 ACID
3 AGES
4 ALOE
5 BARK
6 BOLT
7 BULK
8 CALM
9 CLAD
10 DAZE
11 DEAF
12 EASE
13 ECHO
14 EDGE
15 FAME
16 FAWN
17 FLOW
18 GAZE
19 GEAR
20 HALT
to make listing your words less typing and easier to modify if you have
to, so you don't need to hard-code `100` in the return statement, and so
you don't NEED to end up with a global array named `w[]`. Obviously add
the other words inside the string in `split()`.
As I mentioned in another post a few minutes ago, don't use all upper
case variable names for user-defined variables.
Ed, all sounds good to me, really busy next few days at work...
If so compelled, please refactor/optimise & post the reworked &
*complete script* here & I'll credit you as a contribiting author.
Two caveats kind sir...
1. generatic awk only
2. cram multiple w[]'s onto a single line, eg...
good: w[1] = x; w[2] = y; w[3] = z
bad:
w[1] = x
w[2] = y
w[3] = z
[...]
w[100]...
Looking forward to seeing what you come up with =)
I won't be compelled to do that.
Ed Morton <mortonspam@gmail.com> wrote:
I won't be compelled to do that.
I'm in the same boat with you: Folks offer
suggestions but dont want to get their hands dirty.
Too busy to apply much more than a line or so of
change. Honestly, I'm good to go as is. Folks
can always download & rework as they see fit.
Sorry, I thought you were posting scripts because you wanted to get feedback/suggestions on them.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 991 |
Nodes: | 10 (1 / 9) |
Uptime: | 131:00:42 |
Calls: | 12,960 |
Calls today: | 2 |
Files: | 186,574 |
Messages: | 3,266,055 |