• Boogle: Word Grid Game

    From porkchop@porkchop@invalid.foo (Mike Sanders) to comp.lang.awk on Thu Nov 2 00:42:00 2023
    From Newsgroup: comp.lang.awk

    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

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.lang.awk on Thu Nov 2 05:26:36 2023
    From Newsgroup: comp.lang.awk

    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", ... :-)

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@864-117-4973@kylheku.com to comp.lang.awk on Thu Nov 2 04:45:16 2023
    From Newsgroup: comp.lang.awk

    On 2023-11-02, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    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", ... :-)

    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: @Kazinator@mstdn.ca
    NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From porkchop@porkchop@invalid.foo (Mike Sanders) to comp.lang.awk on Thu Nov 2 18:14:33 2023
    From Newsgroup: comp.lang.awk

    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

    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

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Ed Morton@mortonspam@gmail.com to comp.lang.awk on Sun Nov 5 08:48:32 2023
    From Newsgroup: comp.lang.awk

    On 11/1/2023 7:42 PM, Mike Sanders wrote:
    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.


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From porkchop@porkchop@invalid.foo (Mike Sanders) to comp.lang.awk on Mon Nov 6 02:37:09 2023
    From Newsgroup: comp.lang.awk

    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 =)
    --
    :wq
    Mike Sanders

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Ed Morton@mortonspam@gmail.com to comp.lang.awk on Mon Nov 6 06:56:08 2023
    From Newsgroup: comp.lang.awk

    On 11/5/2023 8:37 PM, Mike Sanders wrote:
    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.

    I won't be compelled to do that.


    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.


    bad:

    w[1] = x
    w[2] = y
    w[3] = z

    [...]

    w[100]...

    Looking forward to seeing what you come up with =)


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From porkchop@porkchop@invalid.foo (Mike Sanders) to comp.lang.awk on Mon Nov 6 19:39:59 2023
    From Newsgroup: comp.lang.awk

    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.
    --
    :wq
    Mike Sanders

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Ed Morton@mortonspam@gmail.com to comp.lang.awk on Mon Nov 6 20:18:53 2023
    From Newsgroup: comp.lang.awk

    On 11/6/2023 1:39 PM, Mike Sanders wrote:
    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.

    Sorry, I thought you were posting scripts because you wanted to get feedback/suggestions on them.

    Ed.


    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.


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From porkchop@porkchop@invalid.foo (Mike Sanders) to comp.lang.awk on Tue Nov 7 18:41:47 2023
    From Newsgroup: comp.lang.awk

    Ed Morton <mortonspam@gmail.com> wrote:

    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

    --- Synchronet 3.20a-Linux NewsLink 1.114