Discussion:
Boogle: Word Grid Game
(too old to reply)
Mike Sanders
2023-11-02 00:42:00 UTC
Permalink
Crude REPL of sorts. Quite pastime to fritter away a few moments.

Download: https://busybox.neocities.org/notes/boogle.txt

Here's a screen dump...


BOOGLE | Q=Quit | Word: 001/100 | Guess: 1/3 | Ready...

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
Guess 1: _


Idea was to teach myself how to inject words into a matrix in
differing dimensions. Part of a larger game coming that injects
several words into a grid without destroying pre-existing words.
Hope to have that out in a couple of weeks. At any rate, enjoy,
life is short have some fun =)
--
:wq
Mike Sanders
Janis Papanagnou
2023-11-02 04:26:36 UTC
Permalink
Post by Mike Sanders
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", ... :-)

Janis
Kaz Kylheku
2023-11-02 04:45:16 UTC
Permalink
Post by Janis Papanagnou
Post by Mike Sanders
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", ... :-)
Don't forget "SMPS": switched mode power supply.
--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @***@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.
Mike Sanders
2023-11-02 18:14:33 UTC
Permalink
Post by Janis Papanagnou
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", ... :-)
Only 1 word of 4 letters per grid iteration BUT... I think (knock on wood)
I've managed to understand how to inject multiple words:

C G M O W I L D F I R E F P B AVALANCHE
H U R R I C A N E M Z U E P F BLIZZARD
V C I T B J U B Y P D E D E U CYCLONE
T S U N A M I M V K K C L A H DROUGHT
D E T E H C N A L A V A T T B EARTHQUAKE
Z J R P Y D H G U F A W C O L ERUPTION
F M P U R H U Q B K C X Y R I FLOOD
G C H N P V H L N L T P C N Z HAILSTORM
H A I L S T O R M U U Z L A Z HURRICANE
A A D G R E I F L O O D O D A TORNADO
L I B A B P W O U M K K N O R TSUNAMI
M J E W W J O L N I W B E I D WILDFIRE
--
:wq
Mike Sanders
Ed Morton
2023-11-05 14:48:32 UTC
Permalink
Post by Mike Sanders
Crude REPL of sorts. Quite pastime to fritter away a few moments.
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.
Mike Sanders
2023-11-06 02:37:09 UTC
Permalink
Post by Ed Morton
# 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
# requires a POSIX awk, an ANSI capable terminal & a sleep command that
supports microsecond intervals
or similar.
$ 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 =)
--
:wq
Mike Sanders
Ed Morton
2023-11-06 12:56:08 UTC
Permalink
Post by Mike Sanders
Post by Ed Morton
# 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
# requires a POSIX awk, an ANSI capable terminal & a sleep command that
supports microsecond intervals
or similar.
$ 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.
I won't be compelled to do that.
Post by Mike Sanders
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
No, good is:

split("x y z",w)

as shown in my previous post above.

Ed.
Post by Mike Sanders
w[1] = x
w[2] = y
w[3] = z
[...]
w[100]...
Looking forward to seeing what you come up with =)
Mike Sanders
2023-11-06 19:39:59 UTC
Permalink
Post by Ed Morton
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.
--
:wq
Mike Sanders
Ed Morton
2023-11-07 02:18:53 UTC
Permalink
Post by Mike Sanders
Post by Ed Morton
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.
Sorry, I thought you were posting scripts because you wanted to get
feedback/suggestions on them.

Ed.
Post by Mike Sanders
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.
Mike Sanders
2023-11-07 18:41:47 UTC
Permalink
Post by Ed Morton
Sorry, I thought you were posting scripts because you wanted to get
feedback/suggestions on them.
No biggie Ed (I meant I'm too busy or busier than I want to be).
Comment/suggest all you want, sometimes I just cant apply it
all due to work. But lots to learn in your replies.
--
:wq
Mike Sanders
Loading...