[Tutor] Proper SQLite cursor handling?

boB Stepp robertvstepp at gmail.com
Wed Jul 7 19:58:36 EDT 2021


On Wed, Jul 7, 2021 at 6:44 PM Alan Gauld via Tutor <tutor at python.org> wrote:
>
> On 06/07/2021 10:06, Alan Gauld via Tutor wrote:
>
> > So the object model becomes (I need really UML for this!):
> > Warning ASCII art coming up! Monospace font needed...
> >
> > +++++++++++++++++++
> > Hand
> >  |
> > Game<-boBSolitair1
> >  |
> > Strategy
> > +++++++++++++++++++=
>
> I've been thinking about this and am unclear about the strategy business.

I thought I addressed the definitions of strategy, hands and games
yesterday, but perhaps you missed that post -- it was the one with the
mangled tables.

I said:

-------------------------------------------------------------------------------------------
By "game" I mean a particular kind of solitaire game with its own
scoring parameters.  Further if I decide to try out different
strategies of playing that particular type of solitaire game then that
would count as a separate entry in the games table.  For instance if
there were such a thing as "boBSolitaire" then there might be in the
games table entries for "boBSolitaireMinimizeReservePile",
"boBSolitaireMaximizeFoundationPiles", etc.

Dennis asked what I meant by "hand".  I defined what I meant in the
module docstring, but it is simply "I just now played a hand of
boBSolitaire."  There would be a score for that hand which would be
added to the running total score.  So the games table would look like
(I bet this will get mangled in the archive):
-------------------------------------------------------------------------------------------

And from a slightly later post:

-------------------------------------------------------------------------------------------
...The "strategy" field will be for an
expanded description of what strategy the user wishes to employ for
that particular game.  It might just be a word or two or be a lengthy
paragraph.
-------------------------------------------------------------------------------------------

> Can a Player change strategy for every hand? Or is it fixed
> during a game? In other words if I start a Game of AlanSolitair1
> can I play one hand with Strategy1 then play the next with
> Strategy2 and then switch back to Strategy1? And how would
> the scoring and reporting work in that case?

So a particular "game" is the collection of hands played, all with the
same rules, using the same strategy throughout.

> I'm suspecting that the strategy should be the same for
> every set of hands - let's call it a Session? So does that
> mean we have another conceptual class - a Session - to
> consider. Or is a Session the same as a Game?

Yes, as you state Session and Game would be synonymous.

> What exactly is a Game? - is it a set of rules/plays or is
> it just a set of hands? I'm assuming it's the former, in
> which case a session is a contiguous set of hands using
> the same Game (but possibly different Strategies?)

See above.

> Or is a Game a set of hands with each hand associated
> with a GameType(which holds the rules/plays?) and Strategy?
> (Or does a Game/Session only have one GameType?)

Same set of rules, same strategy.

> There are many ambiguities in the specification. But
> those need to be resolved before the database schema
> design can be completed.

I pray that all ambiguities have been removed?!?

boB Stepp


More information about the Tutor mailing list