• Re: Tic Tac Toe Quest

    From R Kym Horsell@kym@sdf.org to comp.lang.c++,comp.lang.c on Sun Aug 2 21:09:34 2026
    From Newsgroup: comp.lang.c

    In comp.lang.c Mike Terry <news.dead.person.stones@darjeeling.plus.com> wrote:
    On 02/08/2026 02:17, R Kym Horsell wrote:
    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
    On 2026-07-31 02:19, R Kym Horsell wrote:
    With no summetries and counting who start, the order of the squares >>>> marked, and the final position as all befining "the game"
    then there are a couple million possibilities.

    There's only 9 different choices for the first mark, 8 for the second,
    etc. Ignoring the victory conditions, that means at most 9! = 362,880
    games, no matter how you distinguish them. If you stop a game as soon as >>> one side wins, it's much smaller, I won't bother figuring out how many.

    I think you missed a few.

    James' account looks correct to me. 9! is just an upper bound, as he notes.

    Games can be shorted if there is a winner. That adds more possibilities.

    If a game ends with a winner in less than 9 moves, that /reduces/ the possibilities (i.e. reduces
    from 9!), not "adding more".

    If you have have long games and also short games then
    there are more than just the long games. Right?
    As I said you might suspect the number of games might be close to
    2^9 because each sq can be {x,0}. But it's more like 3^9 because
    some game are short and empty squares are left. I.e. {0,1,_}.

    But my suspicion there might be more than a million legal games
    is certainly wrong. More like a 1/4 million as someone pointed out
    and less than 50k of them draws.

    My old Prolog program had a severe problem with "marking off"
    the solutions and allowed games to run past their proper stopping point.
    I fixed that up and it now gets what I assume is a solution someone
    already posted.

    I'm almost totally blind so confirming some of these things is a bit
    of a chore for me nowadays. Sorry.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Mike Terry@news.dead.person.stones@darjeeling.plus.com to comp.lang.c++,comp.lang.c on Mon Aug 3 01:54:37 2026
    From Newsgroup: comp.lang.c

    On 02/08/2026 22:09, R Kym Horsell wrote:
    In comp.lang.c Mike Terry <news.dead.person.stones@darjeeling.plus.com> wrote:
    On 02/08/2026 02:17, R Kym Horsell wrote:
    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
    On 2026-07-31 02:19, R Kym Horsell wrote:
    With no summetries and counting who start, the order of the squares >>>>> marked, and the final position as all befining "the game"
    then there are a couple million possibilities.

    There's only 9 different choices for the first mark, 8 for the second, >>>> etc. Ignoring the victory conditions, that means at most 9! = 362,880
    games, no matter how you distinguish them. If you stop a game as soon as >>>> one side wins, it's much smaller, I won't bother figuring out how many. >>>
    I think you missed a few.

    James' account looks correct to me. 9! is just an upper bound, as he notes. >>
    Games can be shorted if there is a winner. That adds more possibilities. >>
    If a game ends with a winner in less than 9 moves, that /reduces/ the possibilities (i.e. reduces
    from 9!), not "adding more".

    If you have have long games and also short games then
    there are more than just the long games. Right?

    Well, yes, but maybe you're overlooking that ALL the longer play sequences that started with the
    short game are not valid games, and so must not be counted. The figure of 9! previously counted all
    those long play sequences, so the total is /reduced/ from the upper bound of 9!.

    As I said you might suspect the number of games might be close to
    2^9 because each sq can be {x,0}. But it's more like 3^9 because
    some game are short and empty squares are left. I.e. {0,1,_}.

    You're trying to count total board positions, but those are not what was asked for. The OP wanted
    possible /games/, where games consist of the sequence of moves made at each turn, not the final
    board possition. E.g. the board position

    X X X
    O O _
    _ _ _

    is a win for X, and there have been 5 moves, and I reckon there are 3!*2! = 12 possible ways that
    board position could have been reached in a valid game. I.e. that single board position would need
    to be counted somehow as 12 games in the total.

    Also, there is no valid game that reaches board position

    X X X
    _ _ _
    _ _ _

    which is one of you 3^9 board positions. So that board position needs to be counted as 0 in the
    game count, not 1.

    It would certainly be possible to get a correct game count by working through board positions, but
    its fiddly because assuming you work through all 3^9 positions, you would need to:
    a) identify whether the position can legally occur in a valid game, as the
    final position. I reckon the following conditions test this:
    - there is exactly one winning line
    - if X has the winning line, there is one more X than O on the board
    [because X went first, which is my working assumption]
    - if O has the winning line, the number of X's and O's on the board
    must match
    Ignore invalid positions!
    b) for each valid position, count the number of games (play
    sequences) that could lead to that position. This is easy -
    if there are m X's and n Y's on the board, there are m!n! possible
    sequences in which they could have been played, so count m!n!
    games for this board possition.

    Should give matching results with other methods. [Well, I've assumed X plays first, because that's
    how I've always played, but the adjustment is obvious if either player may start...]


    But my suspicion there might be more than a million legal games
    is certainly wrong. More like a 1/4 million as someone pointed out
    and less than 50k of them draws.

    My old Prolog program had a severe problem with "marking off"
    the solutions and allowed games to run past their proper stopping point.
    I fixed that up and it now gets what I assume is a solution someone
    already posted.

    I'm almost totally blind so confirming some of these things is a bit
    of a chore for me nowadays. Sorry.

    Sorry to hear that! (And certainly no need to apologise for anything...)

    Mike.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From James Kuyper@jameskuyper@alumni.caltech.edu to comp.lang.c++,comp.lang.c on Mon Aug 3 17:25:15 2026
    From Newsgroup: comp.lang.c

    On 2026-08-02 17:09, R Kym Horsell wrote:
    In comp.lang.c Mike Terry <news.dead.person.stones@darjeeling.plus.com> wrote:
    On 02/08/2026 02:17, R Kym Horsell wrote:
    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
    On 2026-07-31 02:19, R Kym Horsell wrote:
    With no summetries and counting who start, the order of the squares >>>>> marked, and the final position as all befining "the game"
    then there are a couple million possibilities.

    There's only 9 different choices for the first mark, 8 for the second, >>>> etc. Ignoring the victory conditions, that means at most 9! = 362,880
    games, no matter how you distinguish them. If you stop a game as soon as >>>> one side wins, it's much smaller, I won't bother figuring out how many. >>>
    I think you missed a few.

    James' account looks correct to me. 9! is just an upper bound, as he notes. >>
    Games can be shorted if there is a winner. That adds more possibilities. >>
    If a game ends with a winner in less than 9 moves, that /reduces/ the possibilities (i.e. reduces
    from 9!), not "adding more".

    If you have have long games and also short games then
    there are more than just the long games. Right?

    No, I specified stopping a game as soon as it is won. The moves of every
    short game are a subset of multiple longer games. For instance,
    (1,2,5,3,9) is a subset of (1,2,5,3,9,4,6,7), (1,2,5,3,9,6,7,4), (1,2,5,3,9,7,4,6), (1,2,5,3,9,7,6,4), (1,2,5,3,9,4,7,6) and
    (1,2,5,3,9,6,4,7). but those longer games shouldn't be included, only
    the shorter one, so stopping as soon as a game is won reduces the number
    of different games; it doesn't increase it.

    As I said you might suspect the number of games might be close to
    2^9 because each sq can be {x,0}. But it's more like 3^9 because
    some game are short and empty squares are left. I.e. {0,1,_}.

    I think it's inappropriate to consider games that reached the same final position by a different sequence of moves to be the same game. That's
    how you keep the count so low.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From R Kym Horsell@kym@sdf.org to comp.lang.c++,comp.lang.c on Mon Aug 3 21:33:15 2026
    From Newsgroup: comp.lang.c

    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
    On 2026-08-02 17:09, R Kym Horsell wrote:
    In comp.lang.c Mike Terry <news.dead.person.stones@darjeeling.plus.com> wrote:
    On 02/08/2026 02:17, R Kym Horsell wrote:
    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
    On 2026-07-31 02:19, R Kym Horsell wrote:
    With no summetries and counting who start, the order of the squares >>>>>> marked, and the final position as all befining "the game"
    then there are a couple million possibilities.

    There's only 9 different choices for the first mark, 8 for the second, >>>>> etc. Ignoring the victory conditions, that means at most 9! = 362,880 >>>>> games, no matter how you distinguish them. If you stop a game as soon as >>>>> one side wins, it's much smaller, I won't bother figuring out how many. >>>>
    I think you missed a few.

    James' account looks correct to me. 9! is just an upper bound, as he notes.

    Games can be shorted if there is a winner. That adds more possibilities. >>>
    If a game ends with a winner in less than 9 moves, that /reduces/ the possibilities (i.e. reduces
    from 9!), not "adding more".

    If you have have long games and also short games then
    there are more than just the long games. Right?

    No, I specified stopping a game as soon as it is won. The moves of every
    ...

    In my book

    1 2 3

    is different from

    1 2 3 4 5

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From R Kym Horsell@kym@sdf.org to comp.lang.c++,comp.lang.c on Mon Aug 3 22:00:16 2026
    From Newsgroup: comp.lang.c

    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
    On 2026-08-02 17:09, R Kym Horsell wrote:
    In comp.lang.c Mike Terry <news.dead.person.stones@darjeeling.plus.com> wrote:
    On 02/08/2026 02:17, R Kym Horsell wrote:
    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
    On 2026-07-31 02:19, R Kym Horsell wrote:
    With no summetries and counting who start, the order of the squares >>>>>> marked, and the final position as all befining "the game"
    then there are a couple million possibilities.

    There's only 9 different choices for the first mark, 8 for the second, >>>>> etc. Ignoring the victory conditions, that means at most 9! = 362,880 >>>>> games, no matter how you distinguish them. If you stop a game as soon as >>>>> one side wins, it's much smaller, I won't bother figuring out how many. >>>>
    I think you missed a few.

    James' account looks correct to me. 9! is just an upper bound, as he notes.

    Games can be shorted if there is a winner. That adds more possibilities. >>>
    If a game ends with a winner in less than 9 moves, that /reduces/ the possibilities (i.e. reduces
    from 9!), not "adding more".

    If you have have long games and also short games then
    there are more than just the long games. Right?

    No, I specified stopping a game as soon as it is won. The moves of every
    ...

    Maybe we are talking at cross-purposes.

    I think you're alluding to "no legal game can be a prefix of another
    legal game (although 2 legal games can share the prefix)".

    IOW the total number of possible games is the sum of the games of length
    5, length 6, ... length 9.

    I.e. the total is more than then number of games of length 9.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From bart@bc@freeuk.com to comp.lang.c on Tue Aug 4 01:37:02 2026
    From Newsgroup: comp.lang.c

    On 03/08/2026 23:00, R Kym Horsell wrote:
    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
    On 2026-08-02 17:09, R Kym Horsell wrote:
    In comp.lang.c Mike Terry <news.dead.person.stones@darjeeling.plus.com> wrote:
    On 02/08/2026 02:17, R Kym Horsell wrote:
    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote: >>>>>> On 2026-07-31 02:19, R Kym Horsell wrote:
    With no summetries and counting who start, the order of the squares >>>>>>> marked, and the final position as all befining "the game"
    then there are a couple million possibilities.

    There's only 9 different choices for the first mark, 8 for the second, >>>>>> etc. Ignoring the victory conditions, that means at most 9! = 362,880 >>>>>> games, no matter how you distinguish them. If you stop a game as soon as >>>>>> one side wins, it's much smaller, I won't bother figuring out how many. >>>>>
    I think you missed a few.

    James' account looks correct to me. 9! is just an upper bound, as he notes.

    Games can be shorted if there is a winner. That adds more possibilities. >>>>
    If a game ends with a winner in less than 9 moves, that /reduces/ the possibilities (i.e. reduces
    from 9!), not "adding more".

    If you have have long games and also short games then
    there are more than just the long games. Right?

    No, I specified stopping a game as soon as it is won. The moves of every
    ...

    Maybe we are talking at cross-purposes.

    I think you're alluding to "no legal game can be a prefix of another
    legal game (although 2 legal games can share the prefix)".

    IOW the total number of possible games is the sum of the games of length
    5, length 6, ... length 9.

    I.e. the total is more than then number of games of length 9.


    I've done a simulation. Figures may not be right, but they look plausible:

    Total number of games: 362880 (Ignores who goes first)
    Won by player 1: 212256
    Won by player 2: 104544
    Drawn: 46080

    Players make all possible permutations of moves in turn, with no
    strategy. Games last from 5 to 9 moves:

    34560 games with 5 moves (all won)
    31968 games with 6 moves
    95904 games with 7 moves
    72576 games with 8 moves
    127872 games with 9 moves (46080 were drawn)

    Drawn games always take 9 moves.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From bart@bc@freeuk.com to comp.lang.c on Tue Aug 4 01:58:42 2026
    From Newsgroup: comp.lang.c

    On 04/08/2026 01:37, bart wrote:
    On 03/08/2026 23:00, R Kym Horsell wrote:
    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
    On 2026-08-02 17:09, R Kym Horsell wrote:
    In comp.lang.c Mike Terry
    <news.dead.person.stones@darjeeling.plus.com> wrote:
    On 02/08/2026 02:17, R Kym Horsell wrote:
    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote: >>>>>>> On 2026-07-31 02:19, R Kym Horsell wrote:
    With no summetries and counting who start, the order of the >>>>>>> squares
    marked, and the final position as all befining "the game"
    then there are a couple million possibilities.

    There's only 9 different choices for the first mark, 8 for the
    second,
    etc. Ignoring the victory conditions, that means at most 9! =
    362,880
    games, no matter how you distinguish them. If you stop a game as >>>>>>> soon as
    one side wins, it's much smaller, I won't bother figuring out how >>>>>>> many.

    I think you missed a few.

    James' account looks correct to me.-a 9! is just an upper bound, as >>>>> he notes.

    Games can be shorted if there is a winner.-a That adds more
    possibilities.

    If a game ends with a winner in less than 9 moves, that /reduces/
    the possibilities (i.e. reduces
    from 9!), not "adding more".

    If you have have long games and also short games then
    there are more than just the long games. Right?

    No, I specified stopping a game as soon as it is won. The moves of every
    ...

    Maybe we are talking at cross-purposes.

    I think you're alluding to "no legal game can be a prefix of another
    legal game (although 2 legal games can share the prefix)".

    IOW the total number of possible games is the sum-a of the games of length >> 5, length 6, ... length 9.

    I.e. the total is more than then number of games of length 9.


    I've done a simulation. Figures may not be right, but they look plausible:

    Total number of games:-a 362880-a-a-a-a-a (Ignores who goes first)
    Won by player 1:-a-a-a-a-a-a-a 212256
    Won by player 2:-a-a-a-a-a-a-a 104544 Drawn:-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 46080

    Players make all possible permutations of moves in turn, with no
    strategy. Games last from 5 to 9 moves:

    34560 games with 5 moves (all won)
    31968 games with 6 moves
    95904 games with 7 moves
    72576 games with 8 moves
    127872 games with 9 moves (46080 were drawn)

    Drawn games always take 9 moves.

    No, I think this includes duplicates. If a particular 9-move sequence is
    won after 6 moves say, then the remaining combinations that start with
    the same 6 need to be skipped otherwise they are counted again.

    However the new figures seem too small! I'll have to look more closely.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Mike Terry@news.dead.person.stones@darjeeling.plus.com to comp.lang.c on Tue Aug 4 03:16:31 2026
    From Newsgroup: comp.lang.c

    On 04/08/2026 01:58, bart wrote:
    On 04/08/2026 01:37, bart wrote:
    On 03/08/2026 23:00, R Kym Horsell wrote:
    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
    On 2026-08-02 17:09, R Kym Horsell wrote:
    In comp.lang.c Mike Terry <news.dead.person.stones@darjeeling.plus.com> wrote:
    On 02/08/2026 02:17, R Kym Horsell wrote:
    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote: >>>>>>>> On 2026-07-31 02:19, R Kym Horsell wrote:
    With no summetries and counting who start, the order of the squares
    marked, and the final position as all befining "the game"
    then there are a couple million possibilities.

    There's only 9 different choices for the first mark, 8 for the second, >>>>>>>> etc. Ignoring the victory conditions, that means at most 9! = 362,880 >>>>>>>> games, no matter how you distinguish them. If you stop a game as soon as
    one side wins, it's much smaller, I won't bother figuring out how many.

    I think you missed a few.

    James' account looks correct to me.a 9! is just an upper bound, as he notes.

    Games can be shorted if there is a winner.a That adds more possibilities.

    If a game ends with a winner in less than 9 moves, that /reduces/ the possibilities (i.e. reduces
    from 9!), not "adding more".

    If you have have long games and also short games then
    there are more than just the long games. Right?

    No, I specified stopping a game as soon as it is won. The moves of every >>> ...

    Maybe we are talking at cross-purposes.

    I think you're alluding to "no legal game can be a prefix of another
    legal game (although 2 legal games can share the prefix)".

    IOW the total number of possible games is the suma of the games of length >>> 5, length 6, ... length 9.

    I.e. the total is more than then number of games of length 9.


    I've done a simulation. Figures may not be right, but they look plausible: >>
    Total number of games:a 362880aaaaa (Ignores who goes first)
    Won by player 1:aaaaaaa 212256
    Won by player 2:aaaaaaa 104544
    Drawn:aaaaaaaaaaaaaaaaaa 46080

    Players make all possible permutations of moves in turn, with no strategy. Games last from 5 to 9
    moves:

    34560 games with 5 moves (all won)

    So assuming X plays first, games of 5 moves would have 3 X's in a line, and 2 O's (anywhere).
    There are 8 lines where X can win, and for each of these there are Choose(6,2) = 15 choices for
    cells O has taken. Well that's counting final board positions, and each of those can occur in
    (3!)(2!) = 12

    So that gives 8 * 15 = 120 5 move (game ended) board positions
    120 * 12 = 1440 5 move games. (Not 34560)

    But if we then "complete" the games by playing 4 further moves to fill the grid, there are 4! = 24
    ways to do this for each 5 move game, giving

    1440 * 24 = 34560 (your figure)

    31968 games with 6 moves
    95904 games with 7 moves
    72576 games with 8 moves
    127872 games with 9 moves (46080 were drawn)

    Drawn games always take 9 moves.

    No, I think this includes duplicates. If a particular 9-move sequence is won after 6 moves say, then
    the remaining combinations that start with the same 6 need to be skipped otherwise they are counted
    again.

    Right - your 5 game figure suggests that's exactly what's happened. Probably the same for all the
    other counts, but I just looked at 5-move games because that's simple to calculate manually.

    Hmm, when we add all your possibilities together that gives exactly 362880 = 9! So the total of all
    games you counted was the full 9-move "completed game" count, supporting the idea that you made the
    same error in each case. If so, we could manually "correct" your results by dividing each of them
    by their duplication factor. [E.g. 6-move games have 3 cells unplayed, which can be filled in 3! =
    6 ways, so 6 is the duplication factor for these games.]

    That would give:

    moves 'completed'-games dup-factor actual-game-count
    5 34560 4!=24 34560/24 = 1440
    6 31968 3!=6 31968/6 = 5328
    7 95904 2!=2 95904/2 = 47952
    8 72576 1!=1 72576/1 = 72576
    9 127872 0!=1 127872/1 = 127872
    ------
    total 255168

    That agrees with Chris Ahlstrom's previous reporting of what some AI said which is encouraging! :)

    Mike.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From James Kuyper@jameskuyper@alumni.caltech.edu to comp.lang.c++,comp.lang.c on Tue Aug 4 01:05:38 2026
    From Newsgroup: comp.lang.c

    On 2026-08-03 18:00, R Kym Horsell wrote:
    I think you're alluding to "no legal game can be a prefix of another
    legal game (although 2 legal games can share the prefix)".

    IOW the total number of possible games is the sum of the games of length
    5, length 6, ... length 9.

    I.e. the total is more than then number of games of length 9.
    It's simpler than that. Every legal game ends as soon as there are three
    of one symbol in a row, column, or diagonal. The game cannot continue
    past that point.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Mr. Man-wai Chang@toylet.toylet@gmail.com to comp.lang.c++,comp.lang.c on Tue Aug 4 13:54:27 2026
    From Newsgroup: comp.lang.c

    On 8/4/2026 1:05 PM, James Kuyper wrote:


    It's simpler than that. Every legal game ends as soon as there are three
    of one symbol in a row, column, or diagonal. The game cannot continue
    past that point.


    No, you can flip the game board and
    star Kung Fu MMA, film the whole
    fight and upload it to TikTok or
    YouTube. :)
    --

    @~@ Simplicity is Beauty! Remain silent! Drink, Blink, Stretch!
    / v \ May the Force and farces be with you! Live long and prosper!!
    /( _ )\ https://sites.google.com/site/changmw/
    ^ ^ https://github.com/changmw/changmw
    The game is afoot... Meow...
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ike Naar@ike@sdf.org to comp.lang.c on Tue Aug 4 06:50:26 2026
    From Newsgroup: comp.lang.c

    On 2026-08-04, bart <bc@freeuk.com> wrote:
    Drawn games always take 9 moves.

    Here is a drawn game that took 8 moves:

    OXX
    X_O
    OOX
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From bart@bc@freeuk.com to comp.lang.c on Tue Aug 4 11:51:49 2026
    From Newsgroup: comp.lang.c

    On 04/08/2026 03:16, Mike Terry wrote:
    On 04/08/2026 01:58, bart wrote:
    On 04/08/2026 01:37, bart wrote:
    On 03/08/2026 23:00, R Kym Horsell wrote:
    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
    On 2026-08-02 17:09, R Kym Horsell wrote:
    In comp.lang.c Mike Terry
    <news.dead.person.stones@darjeeling.plus.com> wrote:
    On 02/08/2026 02:17, R Kym Horsell wrote:
    In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote: >>>>>>>>> On 2026-07-31 02:19, R Kym Horsell wrote:
    With no summetries and counting who start, the order of >>>>>>>>> the squares
    marked, and the final position as all befining "the game"
    then there are a couple million possibilities.

    There's only 9 different choices for the first mark, 8 for the >>>>>>>>> second,
    etc. Ignoring the victory conditions, that means at most 9! = >>>>>>>>> 362,880
    games, no matter how you distinguish them. If you stop a game >>>>>>>>> as soon as
    one side wins, it's much smaller, I won't bother figuring out >>>>>>>>> how many.

    I think you missed a few.

    James' account looks correct to me.-a 9! is just an upper bound, >>>>>>> as he notes.

    Games can be shorted if there is a winner.-a That adds more
    possibilities.

    If a game ends with a winner in less than 9 moves, that /reduces/ >>>>>>> the possibilities (i.e. reduces
    from 9!), not "adding more".

    If you have have long games and also short games then
    there are more than just the long games. Right?

    No, I specified stopping a game as soon as it is won. The moves of
    every
    ...

    Maybe we are talking at cross-purposes.

    I think you're alluding to "no legal game can be a prefix of another
    legal game (although 2 legal games can share the prefix)".

    IOW the total number of possible games is the sum-a of the games of
    length
    5, length 6, ... length 9.

    I.e. the total is more than then number of games of length 9.


    I've done a simulation. Figures may not be right, but they look
    plausible:

    Total number of games:-a 362880-a-a-a-a-a (Ignores who goes first)
    Won by player 1:-a-a-a-a-a-a-a 212256
    Won by player 2:-a-a-a-a-a-a-a 104544
    Drawn:-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 46080

    Players make all possible permutations of moves in turn, with no
    strategy. Games last from 5 to 9 moves:

    34560 games with 5 moves (all won)

    So assuming X plays first, games of 5 moves would have 3 X's-a in a line, and 2 O's (anywhere). There are 8 lines where X can win, and for each of these there are Choose(6,2) = 15 choices for cells O has taken.-a Well that's counting final board positions, and each of those can occur in (3!)(2!) = 12

    So that gives 8 * 15 = 120-a 5 move (game ended) board positions
    -a-a-a-a-a-a-a-a-a-a-a-a-a 120 * 12 = 1440-a 5 move games.-a (Not 34560)

    But if we then "complete" the games by playing 4 further moves to fill
    the grid, there are 4! = 24 ways to do this for each 5 move game, giving

    -a-a-a-a-a-a-a-a-a-a-a-a-a 1440 * 24 = 34560-a-a (your figure)

    31968 games with 6 moves
    95904 games with 7 moves
    72576 games with 8 moves
    127872 games with 9 moves (46080 were drawn)

    Drawn games always take 9 moves.

    No, I think this includes duplicates. If a particular 9-move sequence
    is won after 6 moves say, then the remaining combinations that start
    with the same 6 need to be skipped otherwise they are counted again.

    Right - your 5 game figure suggests that's exactly what's happened. Probably the same for all the other counts, but I just looked at 5-move games because that's simple to calculate manually.

    Hmm, when we add all your possibilities together that gives exactly
    362880 = 9!-a So the total of all games you counted was the full 9-move "completed game" count, supporting the idea that you made the same error
    in each case.-a If so, we could manually "correct" your results by
    dividing each of them by their duplication factor.-a [E.g. 6-move games
    have 3 cells unplayed, which can be filled in 3! = 6 ways, so 6 is the duplication factor for these games.]

    That would give:

    -a moves-a 'completed'-games-a dup-factor-a-a actual-game-count
    -a 5-a-a-a-a-a-a-a 34560-a-a-a-a-a-a-a-a-a-a-a-a-a 4!=24-a-a-a-a-a-a-a 34560/24 =-a-a 1440
    -a 6-a-a-a-a-a-a-a 31968-a-a-a-a-a-a-a-a-a-a-a-a-a 3!=6-a-a-a-a-a-a-a-a 31968/6-a =-a-a 5328
    -a 7-a-a-a-a-a-a-a 95904-a-a-a-a-a-a-a-a-a-a-a-a-a 2!=2-a-a-a-a-a-a-a-a 95904/2-a =-a 47952
    -a 8-a-a-a-a-a-a-a 72576-a-a-a-a-a-a-a-a-a-a-a-a-a 1!=1-a-a-a-a-a-a-a-a 72576/1-a =-a 72576
    -a 9-a-a-a-a-a-a 127872-a-a-a-a-a-a-a-a-a-a-a-a-a 0!=1-a-a-a-a-a-a-a 127872/1-a = 127872
    -a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a ------
    -a total-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 255168

    That agrees with Chris Ahlstrom's previous reporting of what some AI
    said which is encouraging! :)

    OK, that's a much easier way of working it out! I was using a
    dict/hashtable to record and count only unique sets of moves.

    I'm getting that 1440 figure now but the 6/7/8 ones are slightly higher
    (and they add up to 362880 still) Maybe I'll look at it some more, but
    now we have answers anyway.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From antispam@antispam@fricas.org (Waldek Hebisch) to comp.lang.c on Tue Aug 4 11:05:51 2026
    From Newsgroup: comp.lang.c

    Ike Naar <ike@sdf.org> wrote:
    On 2026-08-04, bart <bc@freeuk.com> wrote:
    Drawn games always take 9 moves.

    Here is a drawn game that took 8 moves:

    OXX
    X_O
    OOX

    No, if the player refuses to move, than it is walk-over. Note
    that if both players move with reasonable competence, then the
    play is always a draw. But this fact does not allow you declare
    a draw before any move.
    --
    Waldek Hebisch
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.c++,comp.lang.c on Tue Aug 4 11:50:53 2026
    From Newsgroup: comp.lang.c

    On 8/3/2026 10:05 PM, James Kuyper wrote:
    On 2026-08-03 18:00, R Kym Horsell wrote:
    I think you're alluding to "no legal game can be a prefix of another
    legal game (although 2 legal games can share the prefix)".

    IOW the total number of possible games is the sum of the games of length
    5, length 6, ... length 9.

    I.e. the total is more than then number of games of length 9.
    It's simpler than that. Every legal game ends as soon as there are three
    of one symbol in a row, column, or diagonal. The game cannot continue
    past that point.

    Right! To play after that is, well, wrong to me.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Johann 'Myrkraverk' Oskarsson@johann@myrkraverk.invalid to comp.lang.c++,comp.lang.c,comp.os.msdos.programmer on Wed Aug 5 04:13:14 2026
    From Newsgroup: comp.lang.c

    On 31/07/2026 10:42 PM, Mr. Man-wai Chang wrote:
    On 7/29/2026 8:57 PM, Bonita Montero wrote:

    I used TV in the 90s for a machine control app under DOS. I liked
    it also that days but from a today's view it's not good OOP, just
    as Microsoft Foundation Classes.


    I remember it. But it never took off, right?
    You have to mention DOS 5's shell as well,
    and maybe Norton Commander?

    The same went to Turbo C++ and then Borland
    C++.

    MS-DOS Shell - BetaWiki
    <https://betawiki.net/wiki/MS-DOS_Shell>

    Norton Commander - Wikipedia
    <https://en.wikipedia.org/wiki/Norton_Commander>


    I remember DOS 5's shell. I didn't use it much,
    nor Norton Commander. On the other tentacle, I
    sometimes use Far Manager in modern Windows. It's
    nice enough, but I've not gotten used to it yet.

    Can you recommend a better Norton Commander clone?
    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via Easynews.com https://bsky.app/profile/myrkraverk.bsky.social
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From usenet@usenet@dolik.dev (Andriy D) to comp.lang.c++,comp.lang.c,comp.os.msdos.programmer on Wed Aug 5 11:38:50 2026
    From Newsgroup: comp.lang.c

    In comp.os.msdos.programmer Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> wrote:

    I remember DOS 5's shell. I didn't use it much,
    nor Norton Commander. On the other tentacle, I
    sometimes use Far Manager in modern Windows. It's
    nice enough, but I've not gotten used to it yet.

    Can you recommend a better Norton Commander clone?

    You can try Total Commander for more 'windows' look & feel. Midnight Commander is an OSS NC clone close to the original NC worth looking at too, as it works on Linux and UNIX in general.

    TTY,
    \aID
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From JJ@jj4public@gmail.com to comp.lang.c++,comp.lang.c,comp.os.msdos.programmer on Wed Aug 5 20:46:31 2026
    From Newsgroup: comp.lang.c

    On Wed, 5 Aug 2026 04:13:14 +0800, Johann 'Myrkraverk' Oskarsson wrote:

    I remember DOS 5's shell. I didn't use it much,
    nor Norton Commander. On the other tentacle, I
    sometimes use Far Manager in modern Windows. It's
    nice enough, but I've not gotten used to it yet.

    Can you recommend a better Norton Commander clone?

    Volkov Commander shareware (but includes source code in their site).
    Probably the best one, assuming that, free and non-free is not an issue.

    https://en.wikipedia.org/wiki/Volkov_Commander?useskin=vector

    Dos Navigator open source freeware. The only alternative to NC which is
    free. But it uses Turbo Vision, so it's not memory efficient.

    https://en.wikipedia.org/wiki/DOS_Navigator?useskin=vector

    Other NC alternatives are not included, since they're either not true NC alternative (e.g. DOS Shell), or not a proper _DOS_ file manager (e.g.
    Midnight Commander, including all cross-platform ones).
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From steve g@Sgonedes1977@gmail.com to comp.lang.c++,comp.lang.c on Sat Aug 8 01:35:27 2026
    From Newsgroup: comp.lang.c

    R Kym Horsell <kym@sdf.org> writes:

    OK. It took a while to get an 8" floppy drive working to find
    the code but this is the way we did it in 1979:

    Reading it again it's very much in the line of what the kids these
    days call a "prompt".

    main :- assert(games(0)), assert(draws(0)),
    play(Winner,Moves,FinalBoard),
    inc_games,
    (Winner=draw -> inc_draws),
    fail %%% force it to try all possibilities (above) trying to succeed

    ; games(Games),writeln(Games),
    draws(Draws),writeln(Draws)
    .

    %% x goes first
    %% 1222560
    %% 362880

    play(Winner,G,B) :-
    empboard(B), InitEmp=[1,2,3,4,5,6,7,8,9],
    %% player(First),
    First=x,
    game(First,B,G,InitEmp,FinalEmp),
    ( player(Winner),won(Winner,B)
    ; Winner=draw, FinalEmp=[]
    )
    .

    game(_,_,[]) --> []. %% return short solutions first
    game(Me,B,[M|Ms]) --> select(M),
    { updboard(Me,B,M), opponent(Me,You) },
    game(You,B,Ms).

    updboard(Who,B,M) :- arg(M,B,Sq), empty(Sq), Sq=Who.

    won(Who,B) :- hasrow(Who,B)
    ; hascol(Who,B)
    ; hasdiag(Who,B)
    .

    %% 1 2 3
    %% 4 5 6
    %% 7 8 9

    hasrow(Who,B) :- checksqs([1,2,3],Who,B)
    ; checksqs([4,5,6],Who,B)
    ; checksqs([7,8,9],Who,B)
    .

    hascol(Who,B) :- checksqs([1,4,7],Who,B)
    ; checksqs([2,5,8],Who,B)
    ; checksqs([3,6,9],Who,B)
    .

    hasdiag(Who,B) :- checksqs([1,5,9],Who,B)
    ; checksqs([3,5,7],Who,B)
    .

    checksqs([],_,_).
    checksqs([I|Is],Who,B) :- arg(I,B,Sq), Sq == Who, checksqs(Is,Who,B).

    empboard(B) :- functor(B,board,9).

    empty(Sq) :- var(Sq).

    player(Who) :- opponent(Who,_).

    opponent(x,0).
    opponent(0,x).

    inc_games :- retract(games(X)),X1 is X+1,assert(games(X1)).

    inc_draws :- retract(draws(X)),X1 is X+1,assert(draws(X1)).


    some beautiful code. I wish I still had my cassette tapes..
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From R Kym Horsell@kym@sdf.org to comp.lang.c on Sat Aug 8 07:32:08 2026
    From Newsgroup: comp.lang.c

    In comp.lang.c steve g <Sgonedes1977@gmail.com> wrote:
    ...
    some beautiful code. I wish I still had my cassette tapes..

    I know how that is. Sitting next to me is a 30 yo hifi with double cas.
    Got a tape jammed in one side some time back. Getting it out
    stopped it playing altogether. But that's why put in 2. :)
    Then the other side jammed up and the same biz happened.
    No play == throw out all the casettes the next time you move.
    There were quite a few of them incl a few boxes of never-used
    long-play TSK SAs.
    --
    Grindr CEO says AI is doing work that would have required hiring 200
    additional engineers
    Yahoo Finance, 8 Aug 2026 02:11
    Grindr CEO George Arison said that AI had increased its engineering output 2.5-fold.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From steve g@Sgonedes1977@gmail.com to comp.lang.c on Sun Aug 9 19:18:58 2026
    From Newsgroup: comp.lang.c

    R Kym Horsell <kym@sdf.org> writes:

    In comp.lang.c steve g <Sgonedes1977@gmail.com> wrote:
    ...
    some beautiful code. I wish I still had my cassette tapes..

    I know how that is.

    Ha! But do you retention your cassettes? I tell you I did not :)
    --- Synchronet 3.22a-Linux NewsLink 1.2