Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Excessive login or logout messages are a sure sign of senility.


devel / comp.lang.awk / zpsoli - Solitaire/Patience card game

SubjectAuthor
* zpsoli - Solitaire/Patience card gameRussell Marks
+* Re: zpsoli - Solitaire/Patience card gameBen Bacarisse
|`- Re: zpsoli - Solitaire/Patience card gameRussell Marks
`* Re: zpsoli - Solitaire/Patience card gameJanis Papanagnou
 `* Re: zpsoli - Solitaire/Patience card gameRussell Marks
  `* Re: zpsoli - Solitaire/Patience card gameJanis Papanagnou
   +- Re: zpsoli - Solitaire/Patience card gameJanis Papanagnou
   `* Re: zpsoli - Solitaire/Patience card gameRussell Marks
    `* Re: zpsoli - Solitaire/Patience card gameJanis Papanagnou
     `* Re: zpsoli - Solitaire/Patience card gameRussell Marks
      `* Re: zpsoli - Solitaire/Patience card gameKaz Kylheku
       +* Re: zpsoli - Solitaire/Patience card gameRussell Marks
       |`* Re: zpsoli - Solitaire/Patience card gameKaz Kylheku
       | `- Re: zpsoli - Solitaire/Patience card gameRussell Marks
       `* Re: zpsoli - Solitaire/Patience card gameAndreas Eder
        `* Re: zpsoli - Solitaire/Patience card gameKaz Kylheku
         `- Re: zpsoli - Solitaire/Patience card gameAndreas Eder

1
zpsoli - Solitaire/Patience card game

<KQ1yI.21562$RET.9460@usenetxs.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=801&group=comp.lang.awk#801

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!fdc3.netnews.com!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx40.ams4.POSTED!not-for-mail
From: zgedneil@spam^H^H^H^Hgmail.com (Russell Marks)
Newsgroups: comp.lang.awk
Subject: zpsoli - Solitaire/Patience card game
Organization: this space intentionally left blank
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
Lines: 13
Message-ID: <KQ1yI.21562$RET.9460@usenetxs.com>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Tue, 15 Jun 2021 13:22:50 UTC
Date: Tue, 15 Jun 2021 13:22:50 GMT
X-Received-Bytes: 1114
 by: Russell Marks - Tue, 15 Jun 2021 13:22 UTC

Maybe it's a bit of a stretch to be posting this, but presumably not
many games are written in awk so I thought I might as well. :-)

zpsoli is a one-player Solitaire/Patience card game in awk. By default
it uses VT100 control codes, but it also has optional generic output.
The standard version requires a new awk - there's also an old-awk
version which should run on almost everything, including V7 awk.

It's available here:

https://zgedneil.nfshost.com/zpsoli.html

-Rus.

Re: zpsoli - Solitaire/Patience card game

<87sg1jyzt2.fsf@bsb.me.uk>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=802&group=comp.lang.awk#802

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
Date: Tue, 15 Jun 2021 15:20:41 +0100
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <87sg1jyzt2.fsf@bsb.me.uk>
References: <KQ1yI.21562$RET.9460@usenetxs.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="60eff99cf16e4037f6cacda8960e483d";
logging-data="24355"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19er+PTMVIJ7NzZwxWJORcKSqcm926Wnp8="
Cancel-Lock: sha1:0xVMm0kXFXpq/eOYCsPM5J4oxyg=
sha1:P5HyjmLuawSKKNNPlhVn+Bt1W10=
X-BSB-Auth: 1.13cdb99f326d71ce2c00.20210615152041BST.87sg1jyzt2.fsf@bsb.me.uk
 by: Ben Bacarisse - Tue, 15 Jun 2021 14:20 UTC

Russell Marks <zgedneil@spam^H^H^H^Hgmail.com> writes:

> Maybe it's a bit of a stretch to be posting this, but presumably not
> many games are written in awk so I thought I might as well. :-)

Don't worry, the group is not overwhelmed by posts!

> zpsoli is a one-player Solitaire/Patience card game in awk. By default
> it uses VT100 control codes, but it also has optional generic output.
> The standard version requires a new awk - there's also an old-awk
> version which should run on almost everything, including V7 awk.
>
> It's available here:
>
> https://zgedneil.nfshost.com/zpsoli.html

Nice. I'm tempted to ask why here, but then why not?

I won't offer a code review, but you could make the play a little
simpler if a single digit was permitted as an abbreviation. The
simplest being that X means dX, but it could also mean Xa or one of
[1-7]X or X[1-7] provided the move is unique.

--
Ben.

Re: zpsoli - Solitaire/Patience card game

<saagpq$37n$1@news-1.m-online.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=803&group=comp.lang.awk#803

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_papanagnou@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
Date: Tue, 15 Jun 2021 17:25:46 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 58
Message-ID: <saagpq$37n$1@news-1.m-online.net>
References: <KQ1yI.21562$RET.9460@usenetxs.com>
NNTP-Posting-Host: 2001:a61:252a:da01:e49a:224d:860c:139d
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1623770746 3319 2001:a61:252a:da01:e49a:224d:860c:139d (15 Jun 2021 15:25:46 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Tue, 15 Jun 2021 15:25:46 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
X-Enigmail-Draft-Status: N1110
In-Reply-To: <KQ1yI.21562$RET.9460@usenetxs.com>
 by: Janis Papanagnou - Tue, 15 Jun 2021 15:25 UTC

On 15.06.2021 15:22, Russell Marks wrote:
> Maybe it's a bit of a stretch to be posting this, but presumably not
> many games are written in awk so I thought I might as well. :-)
>
> zpsoli is a one-player Solitaire/Patience card game in awk. By default
> it uses VT100 control codes, but it also has optional generic output.
> The standard version requires a new awk - there's also an old-awk
> version which should run on almost everything, including V7 awk.
>
> It's available here:
>
> https://zgedneil.nfshost.com/zpsoli.html

Nice.

One thing that I find inconvenient is when typing e.g. '1d' (i.e. an
illegal input); then you're getting a couple lines of warning messages
and - tempted to get rid of them and a fresh screen layout - hitting
<Enter> will draw a new card. - I think it would be more convenient to
just ignore that (illegal) move as done with other ineffective inputs.

Locating the deck to the left (with some more space to separate it and
distinguish it from the other seven heaps) might alleviate the display
issue you mention (and also the issue I mentioned above).

And one could homogenize the input syntax to numbers (with d realized
by number 0); but that's just a matter of taste. (Probably depends on
whether the existence of a(ce) as target is crucial.)

I'm also unsure why the %% besides the deck vanish occasionally; but I
haven't read the docs, maybe it's described? Also unclear to me is the
intention of the two .. lines below the stacks.

A quick look into the source code made me wonder why you documented
availabilities of system() while it's not used in the code (I checked
use of that function to get some insights about possible side effects);
probably part of an old portability consideration/documentation?

Code that appears a bit strange (to me) is e.g. where you use float
numbers in int contexts like the modulo calculation. And specifically
the intention of using -1 to shift the number to the range -1..+65335.

It's probably unnecessary to disallow blank characters in front of the
new and restart commands (while at the same time allowing "newbie" as
valid input for "new"). (Same with quit and exit.)

Terminating an array explicitly with an empty "" value and testing it
with newdeck[srcnum]!="" (instead of srcnum in newdeck ) might not
be necessary.

Since card strings are equal length and operations mainly done at the
end (or up to the end) of a pile one might consider implementing the
stacks as strings, it might simplify the card stack manipulations.

Just a few thoughts.

Janis

Re: zpsoli - Solitaire/Patience card game

<jD5yI.298719$N5n7.164553@usenetxs.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=804&group=comp.lang.awk#804

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!news-out.netnews.com!news.alt.net!fdc3.netnews.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx05.ams4.POSTED!not-for-mail
From: zgedneil@spam^H^H^H^Hgmail.com (Russell Marks)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
References: <KQ1yI.21562$RET.9460@usenetxs.com> <87sg1jyzt2.fsf@bsb.me.uk>
Organization: this space intentionally left blank
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
Lines: 39
Message-ID: <jD5yI.298719$N5n7.164553@usenetxs.com>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Tue, 15 Jun 2021 17:41:35 UTC
Date: Tue, 15 Jun 2021 17:41:35 GMT
X-Received-Bytes: 2389
 by: Russell Marks - Tue, 15 Jun 2021 17:41 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:

> Russell Marks <zgedneil@spam^H^H^H^Hgmail.com> writes:
>
>> Maybe it's a bit of a stretch to be posting this, but presumably not
>> many games are written in awk so I thought I might as well. :-)
>
> Don't worry, the group is not overwhelmed by posts!
[...]
> Nice. I'm tempted to ask why here, but then why not?

Is that ask (why here), or (ask why) here?

For ask (why here) - well I did say it was a bit of a stretch, I
figured it could be of some interest to those interested in awk. More
just that it exists, rather than being wonderful code or anything.

For (ask why) here - I commented on that in the code:

# Why do an awk version? I wanted to do something fun in awk that was
# more than the usual random tiny program stuffed in a shell script.

I do use awk a lot, but it's usually for that sort of thing, or even
tinier command-line uses - like most awk users probably. This may be
the longest awk program I've ever written, despite being well under a
thousand lines with many being comments.

> I won't offer a code review, but you could make the play a little
> simpler if a single digit was permitted as an abbreviation. The
> simplest being that X means dX, but it could also mean Xa or one of
> [1-7]X or X[1-7] provided the move is unique.

The game is partially based on an existing implementation (well two,
soliyawn and zcsoli) which worked with direct key-by-key input rather
than line-based input. So for that it needed the from-then-to. In this
version as you say it isn't strictly necessary, I just like the idea
of keeping it fairly consistent with the others.

-Rus.

Re: zpsoli - Solitaire/Patience card game

<TU5yI.298720$N5n7.62365@usenetxs.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=805&group=comp.lang.awk#805

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx05.ams4.POSTED!not-for-mail
From: zgedneil@spam^H^H^H^Hgmail.com (Russell Marks)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
References: <KQ1yI.21562$RET.9460@usenetxs.com>
<saagpq$37n$1@news-1.m-online.net>
Organization: this space intentionally left blank
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
Lines: 127
Message-ID: <TU5yI.298720$N5n7.62365@usenetxs.com>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Tue, 15 Jun 2021 18:00:19 UTC
Date: Tue, 15 Jun 2021 18:00:19 GMT
X-Received-Bytes: 6529
 by: Russell Marks - Tue, 15 Jun 2021 18:00 UTC

Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:

> On 15.06.2021 15:22, Russell Marks wrote:
>> Maybe it's a bit of a stretch to be posting this, but presumably not
>> many games are written in awk so I thought I might as well. :-)
>>
>> zpsoli is a one-player Solitaire/Patience card game in awk. By default
>> it uses VT100 control codes, but it also has optional generic output.
>> The standard version requires a new awk - there's also an old-awk
>> version which should run on almost everything, including V7 awk.
>>
>> It's available here:
>>
>> https://zgedneil.nfshost.com/zpsoli.html
>
> Nice.
>
> One thing that I find inconvenient is when typing e.g. '1d' (i.e. an
> illegal input); then you're getting a couple lines of warning messages
> and - tempted to get rid of them and a fresh screen layout - hitting
> <Enter> will draw a new card. - I think it would be more convenient to
> just ignore that (illegal) move as done with other ineffective inputs.

That's a tricky one, I suppose you could argue it both ways. You can
use "r" (redraw) to avoid drawing a card of course, but I know it's
not the most intuitive thing ever.

> Locating the deck to the left (with some more space to separate it and
> distinguish it from the other seven heaps) might alleviate the display
> issue you mention (and also the issue I mentioned above).

I might be misusing terminology, I'm not sure. On the left are the
main grouping of face-down cards (potentially not-yet-seen), and just
to the right of that is a pile of face-up cards that were turned over
from the top of that.

(I know the game messes about with the representation of the latter
pile so that all but the last card dealt are generally kept in a
face-down state, but from the player's perspective they're all meant
to be face-up.)

> And one could homogenize the input syntax to numbers (with d realized
> by number 0); but that's just a matter of taste. (Probably depends on
> whether the existence of a(ce) as target is crucial.)

Having the moves be purely numeric has an appeal, but I think I prefer
the existing approach.

> I'm also unsure why the %% besides the deck vanish occasionally; but I
> haven't read the docs, maybe it's described? Also unclear to me is the
> intention of the two .. lines below the stacks.

Leftmost is what I would call the deck, to the right of that is a pile
of turned-over cards from that deck. As cards are moved back and forth
one or both of the piles can be emptied.

".." is to represent the rest of the visible card area, because ASCII
is just wonderful for drawing cards in a 2x3 space. :-)

> A quick look into the source code made me wonder why you documented
> availabilities of system() while it's not used in the code (I checked
> use of that function to get some insights about possible side effects);
> probably part of an old portability consideration/documentation?

That table is almost entirely documenting what I couldn't use due to
allowing the use of old awk, since the old-awk version is extremely
similar and built from the same file.

The reason system() might have helped - with that and some assumptions
(requiring "tput" perhaps), I could have more supported more than just
VT100 and generic terminals. Well, I could have anyway, but then you
just end up writing termcap/terminfo again.

> Code that appears a bit strange (to me) is e.g. where you use float
> numbers in int contexts like the modulo calculation. And specifically
> the intention of using -1 to shift the number to the range -1..+65335.

In rndseed the range is 0..65535, converted to 1..65536 when
calculating the new seed value for the RNG. Obviously you don't want
to multiply by zero. :-) It's true that the seed could have been left
as non-zero, but that would have made it slightly harder to construct
the rand()-like random number - you'd end up doing much the same
either way.

Funnily enough, in a way you could argue this isn't really an int
context. Quite apart from awk itself being so keen on floating-point
AIUI, the Spectrum's ROM did all the RNG maths using FP. In software.
On a Z80. It wasn't fast.

Actually writing e.g. "65537." is useless I suppose, that's just old
habits from C and making clear it's not an int. Silly in awk, but
presumably not an actual problem.

> It's probably unnecessary to disallow blank characters in front of the
> new and restart commands (while at the same time allowing "newbie" as
> valid input for "new"). (Same with quit and exit.)

They're not documented as allowing an arbitrary number of blanks at
the start, so I don't see this as an issue really. Similarly, the
documentation is of the minimum form allowed (though it occurs to me
that "h" works for help, so that's an exception admittedly).

> Terminating an array explicitly with an empty "" value and testing it
> with newdeck[srcnum]!="" (instead of srcnum in newdeck ) might not
> be necessary.

There is some level of (ahem) awkwardness as an artifact of the
part-translation I did from Z80. I probably kept the code more similar
than I ideally should have done.

> Since card strings are equal length and operations mainly done at the
> end (or up to the end) of a pile one might consider implementing the
> stacks as strings, it might simplify the card stack manipulations.

That's an interesting idea, I should have thought of that. It would
probably be a bit too much of a rewrite to do that at this point
though, and I wonder if in practice it could actually be slower due to
partly avoiding the hashing that the awk implementation is likely
doing for the associative array. (Also the card strings do vary
between three and four characters in length currently, but that could
be changed.)

> Just a few thoughts.

Thanks for the feedback.

-Rus.

Re: zpsoli - Solitaire/Patience card game

<sad4cj$qtq$1@news-1.m-online.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=806&group=comp.lang.awk#806

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_papanagnou@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
Date: Wed, 16 Jun 2021 17:12:19 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 137
Message-ID: <sad4cj$qtq$1@news-1.m-online.net>
References: <KQ1yI.21562$RET.9460@usenetxs.com>
<saagpq$37n$1@news-1.m-online.net> <TU5yI.298720$N5n7.62365@usenetxs.com>
NNTP-Posting-Host: 2001:a61:252a:da01:133:c3a7:3558:d0b2
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1623856339 27578 2001:a61:252a:da01:133:c3a7:3558:d0b2 (16 Jun 2021 15:12:19 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Wed, 16 Jun 2021 15:12:19 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
X-Enigmail-Draft-Status: N1110
In-Reply-To: <TU5yI.298720$N5n7.62365@usenetxs.com>
 by: Janis Papanagnou - Wed, 16 Jun 2021 15:12 UTC

On 15.06.2021 20:00, Russell Marks wrote:
> Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
>>
>> One thing that I find inconvenient is when typing e.g. '1d' (i.e. an
>> illegal input); then you're getting a couple lines of warning messages
>> and - tempted to get rid of them and a fresh screen layout - hitting
>> <Enter> will draw a new card. - I think it would be more convenient to
>> just ignore that (illegal) move as done with other ineffective inputs.
>
> That's a tricky one, I suppose you could argue it both ways. You can
> use "r" (redraw) to avoid drawing a card of course, but I know it's
> not the most intuitive thing ever.

The main inconvenience here is the screen corruption; additional lines
scroll the previous statically (vt100) placed contents upwards. This
corruption fosters a hit on the <Enter>, and thinking at that moment
to issue a "non-standard" (in the sense of rarely or not at all used)
<r> command is not straightforward. And that way you'll spoil the game
input sequence by accident. It's a question of Input Ergonomics (User
Experience, as they often call such things today).

>
>> Locating the deck to the left (with some more space to separate it and
>> distinguish it from the other seven heaps) might alleviate the display
>> issue you mention (and also the issue I mentioned above).
>
> I might be misusing terminology, I'm not sure. On the left are the
> main grouping of face-down cards (potentially not-yet-seen), and just
> to the right of that is a pile of face-up cards that were turned over
> from the top of that.

Sorry for having been unclear. What I meant was a layout that requires
less rows (to prevent the undesired screen effects) and one more column,
like this

Deck Col1 Col2 ... Col7
: : :
: :
:
instead of

Col1 Col2 ... Col7
: : :
: :
:

Deck

>
>> Code that appears a bit strange (to me) is e.g. where you use float
>> numbers in int contexts like the modulo calculation. And specifically
>> the intention of using -1 to shift the number to the range -1..+65335.
>
> In rndseed the range is 0..65535, converted to 1..65536 when
> calculating the new seed value for the RNG. Obviously you don't want
> to multiply by zero. :-) It's true that the seed could have been left
> as non-zero, but that would have made it slightly harder to construct
> the rand()-like random number - you'd end up doing much the same
> either way.
>
> Funnily enough, in a way you could argue this isn't really an int
> context. Quite apart from awk itself being so keen on floating-point
> AIUI, the Spectrum's ROM did all the RNG maths using FP. In software.
> On a Z80. It wasn't fast.
>
> Actually writing e.g. "65537." is useless I suppose, that's just old
> habits from C and making clear it's not an int. Silly in awk, but
> presumably not an actual problem.

I think what you implemented looks a lot like a (standard or not)
Linear Congruential Pseudo Random Number Generator. These are purely
working in an integer domain. So it makes not much sense "to make
clear it's not an int".

But, as said, there seems also to be an inherent issue with it that
you even documented in the code ("It's tweaked to avoid zero"). But
you don't prevent that. The expression x % 65537 creates results
in the range 0..65536, and the -1 puts that in the range -1..65535,
obviously containing the 0.

>
>> It's probably unnecessary to disallow blank characters in front of the
>> new and restart commands (while at the same time allowing "newbie" as
>> valid input for "new"). (Same with quit and exit.)
>
> They're not documented as allowing an arbitrary number of blanks at
> the start, so I don't see this as an issue really. Similarly, the
> documentation is of the minimum form allowed (though it occurs to me
> that "h" works for help, so that's an exception admittedly).

This again is a question of interface ergonomics and user experience;
why abort a command with a blank that has been typed by accident?
The nice thing with awk is that you control the regexps and string
comparisons. Currently " new" is an error but "newbie" is okay. Why
not stay closer to the expectation where (leading/trailing) blanks
are insignificant. Instead of a match of $0 to /^new/ string-compare
$1 to "new"; this solves both issues without overhead.

>
>> Since card strings are equal length and operations mainly done at the
>> end (or up to the end) of a pile one might consider implementing the
>> stacks as strings, it might simplify the card stack manipulations.
>
> That's an interesting idea, I should have thought of that. It would
> probably be a bit too much of a rewrite to do that at this point
> though, and I wonder if in practice it could actually be slower due to
> partly avoiding the hashing that the awk implementation is likely
> doing for the associative array.

It was more the thought that iterations and copies/deletions across
array elements and ranges might be rather less efficient and let the
code also bloat.

(But that was anyway just a thought from an observation; I didn't mean
to suggest a redesign of the code.)

> (Also the card strings do vary
> between three and four characters in length currently, but that could
> be changed.)

Oh, the version I got from your link uses just (a bit cryptic but at
least constant-length) 2-letter card descriptions.[*]

Janis

[*] BTW, I think the 2-letter cards are difficult to visually parse
(letters and digits left, lowercase/uppercase letters to the right)
and since the card symbols are US-centric (Q, J, and H, D, s, c)
it's yet more confusing for non-US cultures. For my personal use I
adjusted the code to an easier recognizable more formal syntax; I use

valuetbl="MLKJIHGFEDCBA"
suittbl="++--"

(assuming H and D, and, s and c, respectively, are interchangeable;
I'm not too familiar with that game, to be honest).

Re: zpsoli - Solitaire/Patience card game

<sad4q5$qu5$1@news-1.m-online.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=807&group=comp.lang.awk#807

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.mixmin.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_papanagnou@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
Date: Wed, 16 Jun 2021 17:19:33 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 34
Message-ID: <sad4q5$qu5$1@news-1.m-online.net>
References: <KQ1yI.21562$RET.9460@usenetxs.com>
<saagpq$37n$1@news-1.m-online.net> <TU5yI.298720$N5n7.62365@usenetxs.com>
<sad4cj$qtq$1@news-1.m-online.net>
NNTP-Posting-Host: 2001:a61:252a:da01:133:c3a7:3558:d0b2
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1623856773 27589 2001:a61:252a:da01:133:c3a7:3558:d0b2 (16 Jun 2021 15:19:33 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Wed, 16 Jun 2021 15:19:33 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
In-Reply-To: <sad4cj$qtq$1@news-1.m-online.net>
 by: Janis Papanagnou - Wed, 16 Jun 2021 15:19 UTC

On 16.06.2021 17:12, Janis Papanagnou wrote:
>
> [*] BTW, I think the 2-letter cards are difficult to visually parse
> (letters and digits left, lowercase/uppercase letters to the right)
> and since the card symbols are US-centric (Q, J, and H, D, s, c)
> it's yet more confusing for non-US cultures. For my personal use I
> adjusted the code to an easier recognizable more formal syntax; I use
>
> valuetbl="MLKJIHGFEDCBA"
> suittbl="++--"

The result looks like this

1 2 3 4 5 6 7

A+ A+ A- A- %% %%
B- B- B+ B+ H+ %%
C+ C+ .. C- I- %%
D- D- .. D+ J+ H-
E+ E+ E- K- I+
F- F- F+ .. J-
G+ .. G- .. K+
H- .. H+ L-
I+ I- M+
J- J+ ..
K+ K- ..
L- L+
M+ M-
.. ..
.. ..

Janis

Re: zpsoli - Solitaire/Patience card game

<J8xyI.15153$um1.8381@usenetxs.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=808&group=comp.lang.awk#808

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx07.ams4.POSTED!not-for-mail
From: zgedneil@spam^H^H^H^Hgmail.com (Russell Marks)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
References: <KQ1yI.21562$RET.9460@usenetxs.com>
<saagpq$37n$1@news-1.m-online.net>
<TU5yI.298720$N5n7.62365@usenetxs.com>
<sad4cj$qtq$1@news-1.m-online.net>
Organization: this space intentionally left blank
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
Lines: 158
Message-ID: <J8xyI.15153$um1.8381@usenetxs.com>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Thu, 17 Jun 2021 01:00:25 UTC
Date: Thu, 17 Jun 2021 01:00:25 GMT
X-Received-Bytes: 7246
 by: Russell Marks - Thu, 17 Jun 2021 01:00 UTC

Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:

> On 15.06.2021 20:00, Russell Marks wrote:
>> Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
[...]
>>> Locating the deck to the left (with some more space to separate it and
>>> distinguish it from the other seven heaps) might alleviate the display
>>> issue you mention (and also the issue I mentioned above).
>>
>> I might be misusing terminology, I'm not sure. On the left are the
>> main grouping of face-down cards (potentially not-yet-seen), and just
>> to the right of that is a pile of face-up cards that were turned over
>> from the top of that.
>
> Sorry for having been unclear. What I meant was a layout that requires
> less rows (to prevent the undesired screen effects) and one more column,
> like this
>
> Deck Col1 Col2 ... Col7
> : : :
> : :
> :
> instead of
>
> Col1 Col2 ... Col7
> : : :
> : :
> :
>
> Deck

You have to put the four ace piles somewhere though (they're not
visible until aces are moved to them). They could go vertically under
the deck and turned-over pile, but I'm not sure I like that idea
really.

>>> Code that appears a bit strange (to me) is e.g. where you use float
>>> numbers in int contexts like the modulo calculation. And specifically
>>> the intention of using -1 to shift the number to the range -1..+65335.
>>
>> In rndseed the range is 0..65535, converted to 1..65536 when
>> calculating the new seed value for the RNG. Obviously you don't want
>> to multiply by zero. :-) It's true that the seed could have been left
>> as non-zero, but that would have made it slightly harder to construct
>> the rand()-like random number - you'd end up doing much the same
>> either way.
>>
>> Funnily enough, in a way you could argue this isn't really an int
>> context. Quite apart from awk itself being so keen on floating-point
>> AIUI, the Spectrum's ROM did all the RNG maths using FP. In software.
>> On a Z80. It wasn't fast.
>>
>> Actually writing e.g. "65537." is useless I suppose, that's just old
>> habits from C and making clear it's not an int. Silly in awk, but
>> presumably not an actual problem.
>
> I think what you implemented looks a lot like a (standard or not)
> Linear Congruential Pseudo Random Number Generator. These are purely
> working in an integer domain. So it makes not much sense "to make
> clear it's not an int".

Unless I missed something (other than e.g. gawk's option to use GMP)
awk maths is all doubles. I presume "%" would use fmod() for example.
Of course there is no need to use floating-point for the algorithm
but... it's in awk, so I don't generally get the choice. I did use
int() to limit cumulative error in this case, but that's all.

> But, as said, there seems also to be an inherent issue with it that
> you even documented in the code ("It's tweaked to avoid zero"). But
> you don't prevent that. The expression x % 65537 creates results
> in the range 0..65536, and the -1 puts that in the range -1..65535,
> obviously containing the 0.

Let's go step by step. rndseed is meant to be kept as 0<=x<65536.
Initially you have this to set that, from the seed as entered:

rndseed=0+$0
if(rndseed<0.) rndseed=0.
rndseed%=65536.

When the RNG is used (in the old-awk version only), there's this:

rndseed=int(((rndseed+1)*75.)%65537.-1)

For now, let's assume we're doing this with integers:

- rndseed beforehand is 0<=x<65536.

- rndseed+1 is 1<=x<65537.

- Then we do the multiply by 75, and the mod 65537.

- Result range so far is still 1<=x<65537 (because 65537 is a prime).

- Then subtract one. rndseed range is now 0<=x<65536, as intended.

I think you're assuming that there is some input which will result in
a zero at the "Result range so far" step above. But 65537 is a prime
number which by definition does not evenly divide by 75, so there is
no way for the mod-65537 step to give a zero result. (If it were
possible to get a zero at that stage the RNG wouldn't work.)

Now, you might be thinking, that'd be fine if this were all integer
maths, but with it all being floating-point does that break anything?
Well, I don't think so. Not with the int() happening each time.

It's easy enough to give a rough demonstration of the non-zero result
(and thus no negative rndseed happening) with:

awk 'BEGIN {
for(f=0;f<65536;f++)
{
rndseed=int(((f+1)*75.)%65537.-1)
if(rndseed<0) print f
}
exit
}'

If that prints anything the RNG is broken.

>>> It's probably unnecessary to disallow blank characters in front of the
>>> new and restart commands (while at the same time allowing "newbie" as
>>> valid input for "new"). (Same with quit and exit.)
>>
>> They're not documented as allowing an arbitrary number of blanks at
>> the start, so I don't see this as an issue really. Similarly, the
>> documentation is of the minimum form allowed (though it occurs to me
>> that "h" works for help, so that's an exception admittedly).
>
> This again is a question of interface ergonomics and user experience;
> why abort a command with a blank that has been typed by accident?
> The nice thing with awk is that you control the regexps and string
> comparisons. Currently " new" is an error but "newbie" is okay. Why
> not stay closer to the expectation where (leading/trailing) blanks
> are insignificant. Instead of a match of $0 to /^new/ string-compare
> $1 to "new"; this solves both issues without overhead.

Trailing everything is insignificant already. Ignoring leading blanks
is obviously not hard, but I don't see much point.

>> (Also the card strings do vary
>> between three and four characters in length currently, but that could
>> be changed.)
>
> Oh, the version I got from your link uses just (a bit cryptic but at
> least constant-length) 2-letter card descriptions.[*]

Internally the cards are represented a bit differently to how they're
displayed, I thought you were referring to that form.

> [*] BTW, I think the 2-letter cards are difficult to visually parse
> (letters and digits left, lowercase/uppercase letters to the right)
> and since the card symbols are US-centric (Q, J, and H, D, s, c)
> it's yet more confusing for non-US cultures.

I haven't found it confusing in the non-US culture here. :-)

-Rus.

Re: zpsoli - Solitaire/Patience card game

<san8gh$o5p$1@news-1.m-online.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=809&group=comp.lang.awk#809

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_papanagnou@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
Date: Sun, 20 Jun 2021 13:24:01 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 184
Message-ID: <san8gh$o5p$1@news-1.m-online.net>
References: <KQ1yI.21562$RET.9460@usenetxs.com>
<saagpq$37n$1@news-1.m-online.net> <TU5yI.298720$N5n7.62365@usenetxs.com>
<sad4cj$qtq$1@news-1.m-online.net> <J8xyI.15153$um1.8381@usenetxs.com>
NNTP-Posting-Host: 2001:a61:252a:da01:b99e:d49c:d820:ca3e
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1624188241 24761 2001:a61:252a:da01:b99e:d49c:d820:ca3e (20 Jun 2021 11:24:01 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Sun, 20 Jun 2021 11:24:01 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
X-Enigmail-Draft-Status: N1110
In-Reply-To: <J8xyI.15153$um1.8381@usenetxs.com>
 by: Janis Papanagnou - Sun, 20 Jun 2021 11:24 UTC

On 17.06.2021 03:00, Russell Marks wrote:
> Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
>> On 15.06.2021 20:00, Russell Marks wrote:
>>> Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
> [...]
>> Sorry for having been unclear. What I meant was a layout that requires
>> less rows (to prevent the undesired screen effects) and one more column,
>> like this
>>
>> Deck Col1 Col2 ... Col7
>> : : :
>> : :
>> :
>> instead of
>>
>> Col1 Col2 ... Col7
>> : : :
>> : :
>> :
>>
>> Deck
>
> You have to put the four ace piles somewhere though (they're not
> visible until aces are moved to them). They could go vertically under
> the deck and turned-over pile,

Not sure what you're trying to say here.

Your program should not corrupt the screen! - That's the main point.

That is something you should consider to fix if you want to make your
interface better.

There are many ways how you can achieve that. I have proposed two ways;
a functional one (create not an error unnecessarily) and a display one
(reorganize the screen layout). (There are yet more option; e.g. place
the [unnecessary] error message somewhere where there's still room, i.e.
where the screen will not corrupt.)

(Not that it would have any practical relevance in context of a funny
but otherwise meaningless piece of code.)

> but I'm not sure I like that idea really.

(It's your program, so be sure I care even less about it than you do.)

>
>>>> Code that appears a bit strange (to me) is e.g. where you use float
>>>> numbers in int contexts like the modulo calculation. And specifically
>>>> the intention of using -1 to shift the number to the range -1..+65335.
>>>
>>> In rndseed the range is 0..65535, converted to 1..65536 when
>>> calculating the new seed value for the RNG. Obviously you don't want
>>> to multiply by zero. :-) It's true that the seed could have been left
>>> as non-zero, but that would have made it slightly harder to construct
>>> the rand()-like random number - you'd end up doing much the same
>>> either way.
>>>
>>> Funnily enough, in a way you could argue this isn't really an int
>>> context. Quite apart from awk itself being so keen on floating-point
>>> AIUI, the Spectrum's ROM did all the RNG maths using FP. In software.
>>> On a Z80. It wasn't fast.
>>>
>>> Actually writing e.g. "65537." is useless I suppose, that's just old
>>> habits from C and making clear it's not an int. Silly in awk, but
>>> presumably not an actual problem.
>>
>> I think what you implemented looks a lot like a (standard or not)
>> Linear Congruential Pseudo Random Number Generator. These are purely
>> working in an integer domain. So it makes not much sense "to make
>> clear it's not an int".
>
> Unless I missed something (other than e.g. gawk's option to use GMP)
> awk maths is all doubles. I presume "%" would use fmod() for example.
> Of course there is no need to use floating-point for the algorithm
> but... it's in awk, so I don't generally get the choice. I did use
> int() to limit cumulative error in this case, but that's all.

Even if awk supports only FP numeric data type you can effectively
do integer arithmetic while you're staying within the integer range
with your numbers. So that is not an issue in the numeric range we
are considering here, and we can focus on the actual points I made.

>> But, as said, there seems also to be an inherent issue with it that
>> you even documented in the code ("It's tweaked to avoid zero"). But
>> you don't prevent that. The expression x % 65537 creates results
>> in the range 0..65536, and the -1 puts that in the range -1..65535,
>> obviously containing the 0.
>
> Let's go step by step. rndseed is meant to be kept as 0<=x<65536.
> Initially you have this to set that, from the seed as entered:
>
> rndseed=0+$0
> if(rndseed<0.) rndseed=0.
> rndseed%=65536.
>
> When the RNG is used (in the old-awk version only), there's this:
>
> rndseed=int(((rndseed+1)*75.)%65537.-1)
>
> For now, let's assume we're doing this with integers:
>
> - rndseed beforehand is 0<=x<65536.
>
> - rndseed+1 is 1<=x<65537.
>
> - Then we do the multiply by 75, and the mod 65537.
>
> - Result range so far is still 1<=x<65537 (because 65537 is a prime).

Whether 65537 is a prime or not, the modulo operation creates zeros!
(and results in the range 0..65536).

> - Then subtract one. rndseed range is now 0<=x<65536, as intended.

No.

> I think you're assuming that there is some input which will result in
> a zero at the "Result range so far" step above.

No, I am not assuming that.

> But 65537 is a prime
> number which by definition does not evenly divide by 75, so there is
> no way for the mod-65537 step to give a zero result. (If it were
> possible to get a zero at that stage the RNG wouldn't work.)
>
> Now, you might be thinking, that'd be fine if this were all integer
> maths, but with it all being floating-point does that break anything?
> Well, I don't think so. Not with the int() happening each time.
>
> It's easy enough to give a rough demonstration of the non-zero result
> (and thus no negative rndseed happening) with:
>
> awk 'BEGIN {
> for(f=0;f<65536;f++)
> {
> rndseed=int(((f+1)*75.)%65537.-1)
> if(rndseed<0) print f
> }
> exit
> }'
>
> If that prints anything the RNG is broken.

My point was that the modulus (rndseed) can become 0. (That's a plain
fact with any valid X % M expressions; the result range is 0..M-1 .)

So change your program to compare rndseed<=0 (or ==0) and you get the
obvious hit.

>>
>> This again is a question of interface ergonomics and user experience;
>> why abort a command with a blank that has been typed by accident?
>> The nice thing with awk is that you control the regexps and string
>> comparisons. Currently " new" is an error but "newbie" is okay. Why
>> not stay closer to the expectation where (leading/trailing) blanks
>> are insignificant. Instead of a match of $0 to /^new/ string-compare
>> $1 to "new"; this solves both issues without overhead.
>
> Trailing everything is insignificant already. Ignoring leading blanks
> is obviously not hard, but I don't see much point.

The point is just making the interface better. (Presuming you care.)

Since it's so simple to fix that, I cannot even understand why you are
so reluctant, and why you prefer typing long posts and not just change
a handful of characters in your code instead.

>
> I haven't found it confusing in the non-US culture here. :-)

I'm sure since you developed it that YOU are quite used to the behavior
and appearance as it is, that's not surprising.

As your statement made obvious, you don't seem to care about extending
your biased view by others' feedback, though. So I obviously wasted
enough time with providing constructive feedback, abstain from further
comments here, and "bail out" (as old awks would formulate it).

Have fun with your programs.

Janis

Re: zpsoli - Solitaire/Patience card game

<qb3AI.7423$Ttd.3818@usenetxs.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=810&group=comp.lang.awk#810

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.mixmin.net!npeer.as286.net!npeer-ng0.as286.net!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx28.ams4.POSTED!not-for-mail
From: zgedneil@spam^H^H^H^Hgmail.com (Russell Marks)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
References: <KQ1yI.21562$RET.9460@usenetxs.com>
<saagpq$37n$1@news-1.m-online.net>
<TU5yI.298720$N5n7.62365@usenetxs.com>
<sad4cj$qtq$1@news-1.m-online.net> <J8xyI.15153$um1.8381@usenetxs.com>
<san8gh$o5p$1@news-1.m-online.net>
Organization: this space intentionally left blank
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
Lines: 122
Message-ID: <qb3AI.7423$Ttd.3818@usenetxs.com>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Mon, 21 Jun 2021 16:33:26 UTC
Date: Mon, 21 Jun 2021 16:33:26 GMT
X-Received-Bytes: 5721
 by: Russell Marks - Mon, 21 Jun 2021 16:33 UTC

Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:

> On 17.06.2021 03:00, Russell Marks wrote:
>> Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
>>> On 15.06.2021 20:00, Russell Marks wrote:
[...]
>> You have to put the four ace piles somewhere though (they're not
>> visible until aces are moved to them). They could go vertically under
>> the deck and turned-over pile,
>
> Not sure what you're trying to say here.
>
> Your program should not corrupt the screen! - That's the main point.

It doesn't corrupt the screen in my experience, at most it scrolls it.

> (It's your program, so be sure I care even less about it than you do.)

You're welcome.

>>>>> Code that appears a bit strange (to me) is e.g. where you use float
>>>>> numbers in int contexts like the modulo calculation. And specifically
>>>>> the intention of using -1 to shift the number to the range -1..+65335.
>>>>
>>>> In rndseed the range is 0..65535, converted to 1..65536 when
>>>> calculating the new seed value for the RNG. Obviously you don't want
>>>> to multiply by zero. :-) It's true that the seed could have been left
>>>> as non-zero, but that would have made it slightly harder to construct
>>>> the rand()-like random number - you'd end up doing much the same
>>>> either way.
[...]
>>> I think what you implemented looks a lot like a (standard or not)
>>> Linear Congruential Pseudo Random Number Generator. These are purely
>>> working in an integer domain. So it makes not much sense "to make
>>> clear it's not an int".
>>
>> Unless I missed something (other than e.g. gawk's option to use GMP)
>> awk maths is all doubles. I presume "%" would use fmod() for example.
>> Of course there is no need to use floating-point for the algorithm
>> but... it's in awk, so I don't generally get the choice. I did use
>> int() to limit cumulative error in this case, but that's all.
[...]
>> When the RNG is used (in the old-awk version only), there's this:
>>
>> rndseed=int(((rndseed+1)*75.)%65537.-1)
>>
>> For now, let's assume we're doing this with integers:
>>
>> - rndseed beforehand is 0<=x<65536.
>>
>> - rndseed+1 is 1<=x<65537.
>>
>> - Then we do the multiply by 75, and the mod 65537.
>>
>> - Result range so far is still 1<=x<65537 (because 65537 is a prime).
>
> Whether 65537 is a prime or not, the modulo operation creates zeros!
> (and results in the range 0..65536).

Assuming integer maths as above, a multiply of a non-zero number by 75
followed by modulo of 65537 simply cannot produce a zero result -
there is no circumstance in which it can happen, as the following
program demonstrates.

>> awk 'BEGIN {
>> for(f=0;f<65536;f++)
>> {
>> rndseed=int(((f+1)*75.)%65537.-1)
>> if(rndseed<0) print f
>> }
>> exit
>> }'
>>
>> If that prints anything the RNG is broken.
>
> My point was that the modulus (rndseed) can become 0. (That's a plain

rndseed is *not* the modulus result, see above. Note the "-1".

> fact with any valid X % M expressions; the result range is 0..M-1 .)
>
> So change your program to compare rndseed<=0 (or ==0) and you get the
> obvious hit.

"modulus...can become 0" and "rndseed...==0" are two different things.
Modulus becoming 0 would mean rndseed being -1, while "rndseed...==0"
clearly does not.

For some reason you appear reluctant to accept that the program above
tests your claim *as-is*, with no modifications, but it does.

> Since it's so simple to fix that, I cannot even understand why you are
> so reluctant, and why you prefer typing long posts and not just change
> a handful of characters in your code instead.

If enough people find a lack of ignoring (e.g.) leading spaces to be a
problem I would probably make the change, even if I see little point
to it myself.

>> I haven't found it confusing in the non-US culture here. :-)
>
> I'm sure since you developed it that YOU are quite used to the behavior
> and appearance as it is, that's not surprising.

I was joking about the way you seemed to be demonstrating cultural
biases of your own while criticising mine - I'm not from the US,
English isn't US-only, and the style of playing cards used is of
French origin I believe. But you did have a point. There's no
localisation and the game will clearly be harder to play if you're not
familiar with the style of cards used and/or English terms for them.

> As your statement made obvious, you don't seem to care about extending
> your biased view by others' feedback, though. So I obviously wasted

FWIW I don't think that's a fair characterisation.

> enough time with providing constructive feedback, abstain from further
> comments here, and "bail out" (as old awks would formulate it).

Ok. Nothing here should directly call for a response.

-Rus.

Re: zpsoli - Solitaire/Patience card game

<20210621095542.24@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=811&group=comp.lang.awk#811

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 563-365-8930@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
Date: Mon, 21 Jun 2021 17:12:40 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <20210621095542.24@kylheku.com>
References: <KQ1yI.21562$RET.9460@usenetxs.com>
<saagpq$37n$1@news-1.m-online.net> <TU5yI.298720$N5n7.62365@usenetxs.com>
<sad4cj$qtq$1@news-1.m-online.net> <J8xyI.15153$um1.8381@usenetxs.com>
<san8gh$o5p$1@news-1.m-online.net> <qb3AI.7423$Ttd.3818@usenetxs.com>
Injection-Date: Mon, 21 Jun 2021 17:12:40 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="24fbbedc20ed69b049100b41b1701074";
logging-data="1572"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19AIytRN6HCBM/VY/BJyrFGgU12wmZ8JeI="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:cs3o8xe+DE0Ee5LZ9qqQToHN9fs=
 by: Kaz Kylheku - Mon, 21 Jun 2021 17:12 UTC

On 2021-06-21, Russell Marks <zgedneil@spam^H^H^H^Hgmail.com> wrote:
> Assuming integer maths as above, a multiply of a non-zero number by 75
> followed by modulo of 65537 simply cannot produce a zero result -
> there is no circumstance in which it can happen, as the following
> program demonstrates.

Yes, the additional constraint that the number is in the range
[1, 65536] makes it true

Thre is a is a fact in number theory: any two nonzero elements of a
residue system can be multiplied together modulo the modulus, resulting
in a nonzero element of the system.

Without that we could kiss other results goodbye, like Fermat's Little
Theorem and Euler's Theorem.

Re: zpsoli - Solitaire/Patience card game

<%b7AI.8408$gQt3.4161@usenetxs.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=812&group=comp.lang.awk#812

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx18.ams4.POSTED!not-for-mail
From: zgedneil@spam^H^H^H^Hgmail.com (Russell Marks)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
References: <KQ1yI.21562$RET.9460@usenetxs.com>
<saagpq$37n$1@news-1.m-online.net>
<TU5yI.298720$N5n7.62365@usenetxs.com>
<sad4cj$qtq$1@news-1.m-online.net> <J8xyI.15153$um1.8381@usenetxs.com>
<san8gh$o5p$1@news-1.m-online.net> <qb3AI.7423$Ttd.3818@usenetxs.com>
<20210621095542.24@kylheku.com>
Organization: this space intentionally left blank
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
Lines: 15
Message-ID: <%b7AI.8408$gQt3.4161@usenetxs.com>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Mon, 21 Jun 2021 21:07:07 UTC
Date: Mon, 21 Jun 2021 21:07:07 GMT
X-Received-Bytes: 1534
 by: Russell Marks - Mon, 21 Jun 2021 21:07 UTC

Kaz Kylheku <563-365-8930@kylheku.com> wrote:

> On 2021-06-21, Russell Marks <zgedneil@spam^H^H^H^Hgmail.com> wrote:
>> Assuming integer maths as above, a multiply of a non-zero number by 75
>> followed by modulo of 65537 simply cannot produce a zero result -
>> there is no circumstance in which it can happen, as the following
>> program demonstrates.
>
> Yes, the additional constraint that the number is in the range
> [1, 65536] makes it true

I really should have included that in the sentence. Obviously
(65537*75)%65537 would give zero, were 65537 a possible input. :-)

-Rus.

Re: zpsoli - Solitaire/Patience card game

<20210621145700.9@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=813&group=comp.lang.awk#813

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 563-365-8930@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
Date: Mon, 21 Jun 2021 22:03:05 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <20210621145700.9@kylheku.com>
References: <KQ1yI.21562$RET.9460@usenetxs.com>
<saagpq$37n$1@news-1.m-online.net> <TU5yI.298720$N5n7.62365@usenetxs.com>
<sad4cj$qtq$1@news-1.m-online.net> <J8xyI.15153$um1.8381@usenetxs.com>
<san8gh$o5p$1@news-1.m-online.net> <qb3AI.7423$Ttd.3818@usenetxs.com>
<20210621095542.24@kylheku.com> <%b7AI.8408$gQt3.4161@usenetxs.com>
Injection-Date: Mon, 21 Jun 2021 22:03:05 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="1136ed159d9cbfd6da39cf7a094c1677";
logging-data="28233"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19k8ic6jp5MLYG67L/pphfAVtLpJVHr8+Y="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:kPcGZJ0B4RMsSb3wsOugy7wRngU=
 by: Kaz Kylheku - Mon, 21 Jun 2021 22:03 UTC

On 2021-06-21, Russell Marks <zgedneil@spam^H^H^H^Hgmail.com> wrote:
> Kaz Kylheku <563-365-8930@kylheku.com> wrote:
>
>> On 2021-06-21, Russell Marks <zgedneil@spam^H^H^H^Hgmail.com> wrote:
>>> Assuming integer maths as above, a multiply of a non-zero number by 75
>>> followed by modulo of 65537 simply cannot produce a zero result -
>>> there is no circumstance in which it can happen, as the following
>>> program demonstrates.
>>
>> Yes, the additional constraint that the number is in the range
>> [1, 65536] makes it true
>
> I really should have included that in the sentence. Obviously
> (65537*75)%65537 would give zero, were 65537 a possible input. :-)

BTW the IDEA cipher makes use of modular multiplication aroudn 65537.

https://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm

There is a trick to doing it fast; i.e without actually dividing
by 65537.

From some IDEA code:

/*
* Multiplication, modulo (2**16)+1
* Note that this code is structured on the assumption that
* untaken branches are cheaper than taken branches, and the
* compiler doesn't schedule branches.
*/
#ifdef SMALL_CACHE
CONST static uint16
mul(register uint16 a, register uint16 b)
{ register word32 p;

p = (word32)a * b;
if (p) {
b = low16(p);
a = p>>16;
return (b - a) + (b < a);
} else if (a) {
return 1-b;
} else {
return 1-a;
}
} /* mul */
#endif /* SMALL_CACHE */

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

Re: zpsoli - Solitaire/Patience card game

<87tulp3g3p.fsf@eder.anydns.info>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=814&group=comp.lang.awk#814

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: a_eder_muc@web.de (Andreas Eder)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
Date: Tue, 22 Jun 2021 20:32:26 +0200
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <87tulp3g3p.fsf@eder.anydns.info>
References: <KQ1yI.21562$RET.9460@usenetxs.com>
<saagpq$37n$1@news-1.m-online.net> <TU5yI.298720$N5n7.62365@usenetxs.com>
<sad4cj$qtq$1@news-1.m-online.net> <J8xyI.15153$um1.8381@usenetxs.com>
<san8gh$o5p$1@news-1.m-online.net> <qb3AI.7423$Ttd.3818@usenetxs.com>
<20210621095542.24@kylheku.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="ff6e0a8c17194da3b7200e5bcb90724e";
logging-data="22218"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//izgLu9ElXhsbI+iK4gjD"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
Cancel-Lock: sha1:8nq6WvoXxxm1yzdmqPNubYZCUQw=
sha1:PvG/ZwC6ZS9FfPoxbXRz1g2uN/o=
 by: Andreas Eder - Tue, 22 Jun 2021 18:32 UTC

On Mo 21 Jun 2021 at 17:12, Kaz Kylheku <563-365-8930@kylheku.com> wrote:

> Thre is a is a fact in number theory: any two nonzero elements of a
> residue system can be multiplied together modulo the modulus, resulting
> in a nonzero element of the system.

Only if the modulus is prime!
Otherwise it is possible: 2 * 3 = 0 mod 6.

'Andreas

Re: zpsoli - Solitaire/Patience card game

<ijqAI.255115$TPRa.46851@usenetxs.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=815&group=comp.lang.awk#815

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx01.ams4.POSTED!not-for-mail
From: zgedneil@spam^H^H^H^Hgmail.com (Russell Marks)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
References: <KQ1yI.21562$RET.9460@usenetxs.com>
<saagpq$37n$1@news-1.m-online.net>
<TU5yI.298720$N5n7.62365@usenetxs.com>
<sad4cj$qtq$1@news-1.m-online.net> <J8xyI.15153$um1.8381@usenetxs.com>
<san8gh$o5p$1@news-1.m-online.net> <qb3AI.7423$Ttd.3818@usenetxs.com>
<20210621095542.24@kylheku.com> <%b7AI.8408$gQt3.4161@usenetxs.com>
<20210621145700.9@kylheku.com>
Organization: this space intentionally left blank
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
Lines: 32
Message-ID: <ijqAI.255115$TPRa.46851@usenetxs.com>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Tue, 22 Jun 2021 18:51:58 UTC
Date: Tue, 22 Jun 2021 18:51:58 GMT
X-Received-Bytes: 2235
 by: Russell Marks - Tue, 22 Jun 2021 18:51 UTC

Kaz Kylheku <563-365-8930@kylheku.com> wrote:

> On 2021-06-21, Russell Marks <zgedneil@spam^H^H^H^Hgmail.com> wrote:
>> Kaz Kylheku <563-365-8930@kylheku.com> wrote:
>>
>>> On 2021-06-21, Russell Marks <zgedneil@spam^H^H^H^Hgmail.com> wrote:
>>>> Assuming integer maths as above, a multiply of a non-zero number by 75
>>>> followed by modulo of 65537 simply cannot produce a zero result -
>>>> there is no circumstance in which it can happen, as the following
>>>> program demonstrates.
>>>
>>> Yes, the additional constraint that the number is in the range
>>> [1, 65536] makes it true
>>
>> I really should have included that in the sentence. Obviously
>> (65537*75)%65537 would give zero, were 65537 a possible input. :-)
>
> BTW the IDEA cipher makes use of modular multiplication aroudn 65537.
>
> https://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
>
> There is a trick to doing it fast; i.e without actually dividing
> by 65537.
[...]
> a = p>>16;

Interesting... maybe not ideal in awk as I think you'd still need
division to do the bitshift. I suppose gawk has rshift(), but the RNG
code I'd been commenting on is only really intended for old awk on
e.g. V7.

-Rus.

Re: zpsoli - Solitaire/Patience card game

<20210622115459.605@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=816&group=comp.lang.awk#816

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 563-365-8930@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
Date: Tue, 22 Jun 2021 18:59:26 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <20210622115459.605@kylheku.com>
References: <KQ1yI.21562$RET.9460@usenetxs.com>
<saagpq$37n$1@news-1.m-online.net> <TU5yI.298720$N5n7.62365@usenetxs.com>
<sad4cj$qtq$1@news-1.m-online.net> <J8xyI.15153$um1.8381@usenetxs.com>
<san8gh$o5p$1@news-1.m-online.net> <qb3AI.7423$Ttd.3818@usenetxs.com>
<20210621095542.24@kylheku.com> <87tulp3g3p.fsf@eder.anydns.info>
Injection-Date: Tue, 22 Jun 2021 18:59:26 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="1136ed159d9cbfd6da39cf7a094c1677";
logging-data="32320"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1997McJUMZVK6FaUPmz+WVtb7EECPiES9A="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:RKsyPpmB5rO/ma0cPlcwcm7l6Lo=
 by: Kaz Kylheku - Tue, 22 Jun 2021 18:59 UTC

On 2021-06-22, Andreas Eder <a_eder_muc@web.de> wrote:
> On Mo 21 Jun 2021 at 17:12, Kaz Kylheku <563-365-8930@kylheku.com> wrote:
>
>> Thre is a is a fact in number theory: any two nonzero elements of a
>> residue system can be multiplied together modulo the modulus, resulting
>> in a nonzero element of the system.
>
> Only if the modulus is prime!
> Otherwise it is possible: 2 * 3 = 0 mod 6.

ISTR, the condition may be weaker; namely that those two elements of the
residue system be coprime with the modulus.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

Re: zpsoli - Solitaire/Patience card game

<87o8bw2zw3.fsf@eder.anydns.info>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=817&group=comp.lang.awk#817

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: a_eder_muc@web.de (Andreas Eder)
Newsgroups: comp.lang.awk
Subject: Re: zpsoli - Solitaire/Patience card game
Date: Wed, 23 Jun 2021 20:34:52 +0200
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <87o8bw2zw3.fsf@eder.anydns.info>
References: <KQ1yI.21562$RET.9460@usenetxs.com>
<saagpq$37n$1@news-1.m-online.net> <TU5yI.298720$N5n7.62365@usenetxs.com>
<sad4cj$qtq$1@news-1.m-online.net> <J8xyI.15153$um1.8381@usenetxs.com>
<san8gh$o5p$1@news-1.m-online.net> <qb3AI.7423$Ttd.3818@usenetxs.com>
<20210621095542.24@kylheku.com> <87tulp3g3p.fsf@eder.anydns.info>
<20210622115459.605@kylheku.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="8b5eb42d46f7a131035681ca73c1e614";
logging-data="10948"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19UiVkuUiUbGFxSUVPNPaWF"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
Cancel-Lock: sha1:5eMX9uz27bh77JiDUWkcaXs+QkQ=
sha1:a9mFWThCyuP7JHQPECsQkeXiGHw=
 by: Andreas Eder - Wed, 23 Jun 2021 18:34 UTC

On Di 22 Jun 2021 at 18:59, Kaz Kylheku <563-365-8930@kylheku.com> wrote:

> On 2021-06-22, Andreas Eder <a_eder_muc@web.de> wrote:
>> On Mo 21 Jun 2021 at 17:12, Kaz Kylheku <563-365-8930@kylheku.com> wrote:
>>
>>> Thre is a is a fact in number theory: any two nonzero elements of a
>>> residue system can be multiplied together modulo the modulus, resulting
>>> in a nonzero element of the system.
>>
>> Only if the modulus is prime!
>> Otherwise it is possible: 2 * 3 = 0 mod 6.
>
> ISTR, the condition may be weaker; namely that those two elements of the
> residue system be coprime with the modulus.

Yes, that is true. Then you are computing in the prime residue group.

'Andreas

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor