[Tutor] Proper SQLite cursor handling?

boB Stepp robertvstepp at gmail.com
Mon Jul 5 20:20:49 EDT 2021


I haven't had a chance to dive into your responses yet, but it looks
like I have not clearly communicated how I am using the tables and
what I mean by "game".

On Mon, Jul 5, 2021 at 6:27 PM Cameron Simpson <cs at cskk.id.au> wrote:
>
> On 05Jul2021 12:17, Alan Gauld <alan.gauld at yahoo.co.uk> wrote:
> >On 05/07/2021 02:33, boB Stepp wrote:
> >> 4)  I haven't made it this far yet, but part of each game will be a
> >> record of each hand played.  The current table "games" will refer to
> >> these tables, one per game.
> >
> >Can you elaborate by what you mean by games?
> >Do you mean each type of game(clock, spyder, canfield, etc)
> >will have its own table or do you mean each game session?
> >(game1,game2 etc.)
> >
> >If the latter I'd expect it all to be a single table.
> >But if the former you may have different attributes
> >per game type and multiple tables makes sense.
>
> We may have a nomenclature problem here.

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):

game_id | game_name | strategy |  max_num_reserve_cards |
max_num_foundation_cards | reserve_card_value | foundation_card_value
| total_score
==================================================================================================================
1             | boBSolitair1 | myidea1 | 13
          | 52                                           | -1
                   | 1                                   | - 548
2             | boBSolitair2 | myidea2 | 13
          | 52                                           | -1
                   | 1                                   | 0
3             | AlanSolitair1 | hisidea1 | 28
            | 104                                         | -2
                    | 1                                   | 291
4              ...

Each one of these solitaire games would have its own collection of
hands played over time and look like:

boBSolitair
=========
hand_num | date_played | time_recorded | hand_score
==========================================
1                | 2021-07-04  | 1342                | -5
2                | 2021-07-04  | 1356                | 43
3                | 2021-07-05  |  0704               | -26
4                ...

Likewise "boBSolitair2" and "AlanSolitair1" would have their own hands
played tables.

So each "game" is a combination of a particular type of solitaire
played with a certain strategy applied.  Each such game will have a
record of ALL of the hands played using that type of solitaire with a
particular strategy used in the game play.  Later I will compare all
solitaire games played of the same kind of solitaire to determine the
effectiveness of the different strategies applied.

Does this help make things clearer?

boB Stepp


More information about the Tutor mailing list