• Tic Tac Toe Quest

    From Bonita Montero@3:633/10 to All on Wed Jul 29 14:10:33 2026
    Write a program that calculates the number of possible ways to
    win a Tic Tac Toe round and the number of possible undecided
    rounds. Don't show the code here immediately but after some
    days. Just show the results.
    C and C++ are allowed since the solution will be very similar.

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris Ahlstrom@3:633/10 to All on Wed Jul 29 08:14:49 2026
    Bonita Montero wrote this screed in ALL-CAPS (fixed):

    Write a program that calculates the number of possible ways to
    win a Tic Tac Toe round and the number of possible undecided
    rounds. Don't show the code here immediately but after some
    days. Just show the results.
    C and C++ are allowed since the solution will be very similar.

    "Yes, tic-tac-toe is a strongly solved game that always ends
    in a forced draw when both players use optimal strategy."

    I.e. You're beating a dead horse.

    --
    Second Law of Final Exams:
    In your toughest final -- for the first time all year -- the most
    distractingly attractive student in the class will sit next to you.

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bonita Montero@3:633/10 to All on Wed Jul 29 14:28:18 2026
    Am 29.07.2026 um 14:14 schrieb Chris Ahlstrom:

    "Yes, tic-tac-toe is a strongly solved game that always ends
    in a forced draw when both players use optimal strategy."

    I.e. You're beating a dead horse.

    Then show me the results, i.e. the number of possible
    wins and the number of possible undecided games.

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Johann 'Myrkraverk' Oskarsson@3:633/10 to All on Wed Jul 29 20:30:26 2026
    On 29/07/2026 8:28 PM, Bonita Montero wrote:
    Am 29.07.2026 um 14:14 schrieb Chris Ahlstrom:

    "Yes, tic-tac-toe is a strongly solved game that always ends
    in a forced draw when both players use optimal strategy."

    I.e. You're beating a dead horse.

    Then show me the results, i.e. the number of possible
    wins and the number of possible undecided games.

    Are you asking us to do your homework for you? Why can't you do
    your own homework?
    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via Easynews.com

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bonita Montero@3:633/10 to All on Wed Jul 29 14:38:44 2026
    Am 29.07.2026 um 14:30 schrieb Johann 'Myrkraverk' Oskarsson:

    Are you asking us to do your homework for you?ÿ Why can't you do
    your own homework?

    It's not my homework. I had this idea tomorrow and I solved it.
    And you're frustrated.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Johann 'Myrkraverk' Oskarsson@3:633/10 to All on Wed Jul 29 20:46:41 2026
    On 29/07/2026 8:38 PM, Bonita Montero wrote:
    Am 29.07.2026 um 14:30 schrieb Johann 'Myrkraverk' Oskarsson:

    Are you asking us to do your homework for you?ÿ Why can't you do
    your own homework?

    It's not my homework. I had this idea tomorrow and I solved it.
    And you're frustrated.


    Yes, I'm frustrated. Thank you for caring. I'm frustrated because
    I don't know how to update Visual Studio 2022 from the command line,
    and will have to start the GUI to get rid of some build error.

    In other news, I'm using Turbo Vision in that project. I really like
    that GUI. What GUI toolkits do you use, and why is Turbo Vision the
    best of them?

    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via Easynews.com

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bonita Montero@3:633/10 to All on Wed Jul 29 14:57:42 2026
    Am 29.07.2026 um 14:46 schrieb Johann 'Myrkraverk' Oskarsson:

    In other news, I'm using Turbo Vision in that project.ÿ I really like
    that GUI.ÿ What GUI toolkits do you use, and why is Turbo Vision the
    best of them?

    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.

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Johann 'Myrkraverk' Oskarsson@3:633/10 to All on Wed Jul 29 21:14:52 2026
    On 29/07/2026 8:57 PM, Bonita Montero wrote:
    Am 29.07.2026 um 14:46 schrieb Johann 'Myrkraverk' Oskarsson:

    In other news, I'm using Turbo Vision in that project.ÿ I really like
    that GUI.ÿ What GUI toolkits do you use, and why is Turbo Vision the
    best of them?

    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.

    These days, I use Magiblot's Turbo Vision.

    https://github.com/magiblot/tvision

    A modern port of Turbo Vision 2.0, the classical framework for text-
    based user interfaces. Now cross-platform and with Unicode support.

    It should work on Linux, Mac OS, OS X, FreeBSD, and Illumos; not to
    mention Windows 10 where I use it. I'll show screenshots. They'll
    be posted on Dropbox, so Dan Cross will not look at them. I hope
    you will. You'll just have to wait for something a little bit more
    substantial than the single empty window I have now.

    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via Easynews.com

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From DFS@3:633/10 to All on Wed Jul 29 15:04:12 2026
    On 7/29/2026 8:10 AM, Bonita Montero wrote:

    Write a program that calculates the number of possible ways to
    win a Tic Tac Toe round and the number of possible undecided
    rounds. Don't show the code here immediately but after some
    days. Just show the results.
    C and C++ are allowed since the solution will be very similar.

    Possible wins = 8

    Possible draw/undecided = 76


    reasoning below, no code shown

















































    Possible wins = 3 pieces in a row = 3 columns + 3 rows + 2 diagonals = 8

    Draw/Undecided = 3 items placed in any of 9 positions (less 8 winning positions) =

    9 choose 3

    n! / (n - r)!r!

    9! / (9 - 3)!3!

    362880 / (720 * 6) = 84

    84 - 8 = 76

    I had to look up the formula for 9 choose 3.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bonita Montero@3:633/10 to All on Wed Jul 29 21:28:43 2026
    Totally wrong. Try it with some code.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From DFS@3:633/10 to All on Wed Jul 29 16:25:10 2026
    On 7/29/2026 3:28 PM, Bonita Montero wrote:

    Totally wrong. Try it with some code.

    same results:


    #include <stdio.h>
    int main(void){
    printf("Possible wins = 8\n");
    printf("Possible draw/undecided = 76\n");
    return 0;
    }




    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bonita Montero@3:633/10 to All on Thu Jul 30 17:09:58 2026
    As no one here shows a solution I show mine in C++23:

    #include <iostream>
    #include <array>

    using namespace std;

    int main()
    {
    constexpr int8_t Free = -3, White = 0, Black = 1;
    array<array<int8_t, 3>, 3> board;
    board.fill( { Free, Free, Free } );
    unsigned undecided = 0, wins = 0;
    auto recurse = [&]( this auto &self, int8_t colour ) noexcept -> void
    {
    bool full = true;
    for( size_t row = 3; row--; )
    for( size_t col = 3; col--; )
    if( int8_t &coin = board[row][col]; coin == Free )
    {
    full = false;
    coin = colour;
    int needed = colour ? 3 : 0;
    bool won = board[row][0] + board[row][1] + board[row][2] == needed
    || board[0][col] + board[1][col] + board[2][col] == needed;
    if( int mid = board[1][1]; !won && (row == col || row + col == 2) )
    won = (board[0][0] + mid + board[2][2]) == needed
    || (board[0][2] + mid + board[2][0]) == needed;
    if( !won )
    self( colour == White ? Black : White );
    else
    ++wins;
    coin = Free;
    }
    undecided += full;
    };
    recurse( White );
    cout << "wins: " << 2 * wins << endl;
    cout << "undecided: " << 2 * undecided << endl;
    }

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Janis Papanagnou@3:633/10 to All on Thu Jul 30 17:53:55 2026
    On 2026-07-30 17:09, Bonita Montero wrote:
    As no one here shows a solution I show mine in C++23:

    [snip code]

    Since your code doesn't compile without errors with my g++ -std=c++23,
    and especially since you said in your OP: "Just show the results.",
    mind to post the result that your code is supposed to produce? Thanks.

    Janis


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mr. Man-wai Chang@3:633/10 to All on Fri Jul 31 00:45:48 2026
    On 7/29/2026 8:10 PM, Bonita Montero wrote:
    Write a program that calculates the number of possible ways to
    win a Tic Tac Toe round and the number of possible undecided
    rounds. Don't show the code here immediately but after some
    days. Just show the results.
    C and C++ are allowed since the solution will be very similar.

    Possibly a very famous assignment for students
    doing computer science. But I have never ever
    written a game.

    --

    @~@ 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...

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bonita Montero@3:633/10 to All on Thu Jul 30 21:59:40 2026
    Am 30.07.2026 um 17:53 schrieb Janis Papanagnou:

    Since your code doesn't compile without errors with my g++ -std=c++23,
    and especially since you said in your OP:ÿ "Just show the results.",
    mind to post the result that your code is supposed to produce? Thanks.

    It compiles with current MSVC, g++-14 and clang++-20.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bonita Montero@3:633/10 to All on Thu Jul 30 22:00:26 2026
    Am 30.07.2026 um 18:45 schrieb Mr. Man-wai Chang:
    On 7/29/2026 8:10 PM, Bonita Montero wrote:
    Write a program that calculates the number of possible ways to
    win a Tic Tac Toe round and the number of possible undecided
    rounds. Don't show the code here immediately but after some
    days. Just show the results.
    C and C++ are allowed since the solution will be very similar.

    Possibly a very famous assignment for students
    doing computer science. But I have never ever
    written a game.

    It's not about writing a game but calculating the likhehood
    of different outcomes.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Johann 'Myrkraverk' Oskarsson@3:633/10 to All on Fri Jul 31 04:17:05 2026
    On 31/07/2026 12:45 AM, Mr. Man-wai Chang wrote:
    On 7/29/2026 8:10 PM, Bonita Montero wrote:
    Write a program that calculates the number of possible ways to
    win a Tic Tac Toe round and the number of possible undecided
    rounds. Don't show the code here immediately but after some
    days. Just show the results.
    C and C++ are allowed since the solution will be very similar.

    Possibly a very famous assignment for students
    doing computer science. But I have never ever
    written a game.


    I recommend the exercise. It's quite different from the "normal" type
    of programming we do in every day programming. At least, those of us
    who don't work at gaming companies.

    In comp.lang.c, I recommend starting with /SDL Game Development/ by
    Shaun Mitchell. I prefer that book over the lazy fu tutorial, or what-
    ever it's called.

    It should be trivial to port the code to SDL3.

    That said, my professional game development "career" if we can use that
    term, was limited to C# in then-Unity. Since then, Unity has changed
    license terms, so I can't recommend it anymore.

    Maybe I'll make a commercial game in SDL one of these years.


    There's no C# group that I know of, so I'll add comp.theroy instead.
    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via Easynews.com

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Janis Papanagnou@3:633/10 to All on Thu Jul 30 23:00:30 2026
    On 2026-07-30 21:59, Bonita Montero wrote:
    Am 30.07.2026 um 17:53 schrieb Janis Papanagnou:

    Since your code doesn't compile without errors with my g++ -std=c++23,
    and especially since you said in your OP:ÿ "Just show the results.",
    mind to post the result that your code is supposed to produce? Thanks.

    It compiles with current MSVC, g++-14 and clang++-20.

    Maybe. (I'm no MS user, so that's quite meaningless for me.)[*]

    What about the actual result I had been kindly asking you to provide.

    Janis

    [*] In case you intend to "fix" your code here's the error messages:

    $ g++ -std=c++23 -o ttt_bm ttt_bm.cc

    ttt_bm.cc: In function ?int main()?:
    ttt_bm.cc:12:25: error: expected identifier before ?this?
    12 | auto recurse = [&]( this auto &self, int8_t colour )
    noexcept -> void
    | ^~~~
    ttt_bm.cc:12:25: error: expected ?,? or ?...? before ?this?
    ttt_bm.cc: In lambda function:
    ttt_bm.cc:20:28: error: ?colour? was not declared in this scope
    20 | coin = colour;
    | ^~~~~~
    ttt_bm.cc:28:25: error: ?self? was not declared in this scope
    28 | self( colour == White ? Black : White );
    | ^~~~


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Paul@3:633/10 to All on Thu Jul 30 18:56:15 2026
    On Thu, 7/30/2026 5:00 PM, Janis Papanagnou wrote:
    On 2026-07-30 21:59, Bonita Montero wrote:
    Am 30.07.2026 um 17:53 schrieb Janis Papanagnou:

    Since your code doesn't compile without errors with my g++ -std=c++23,
    and especially since you said in your OP:ÿ "Just show the results.",
    mind to post the result that your code is supposed to produce? Thanks.

    It compiles with current MSVC, g++-14 and clang++-20.

    Maybe. (I'm no MS user, so that's quite meaningless for me.)[*]

    What about the actual result I had been kindly asking you to provide.

    Janis

    [*] In case you intend to "fix" your code here's the error messages:

    $ g++ -std=c++23 -o ttt_bm ttt_bm.cc
    ttt_bm.cc: In function ?int main()?:
    ttt_bm.cc:12:25: error: expected identifier before ?this?
    ÿÿ 12 |ÿÿÿÿ auto recurse = [&]( this auto &self, int8_t colour ) noexcept -> void
    ÿÿÿÿÿ |ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ^~~~
    ttt_bm.cc:12:25: error: expected ?,? or ?...? before ?this?
    ttt_bm.cc: In lambda function:
    ttt_bm.cc:20:28: error: ?colour? was not declared in this scope
    ÿÿ 20 |ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ coin = colour;
    ÿÿÿÿÿ |ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ^~~~~~
    ttt_bm.cc:28:25: error: ?self? was not declared in this scope
    ÿÿ 28 |ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ self( colour == White ? Black : White );
    ÿÿÿÿÿ |ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ^~~~


    CoPilot gives me this.

    "The errors all come from one root cause: C++23 does not support this auto &self inside a lambda.
    That syntax was proposed for ?lambda recursion? but never made it into the standard.
    So g++ rejects it, and then all later errors are just fallout from the first one.
    "

    include <iostream>
    #include <array>
    #include <functional>

    using namespace std;

    int main()
    {
    constexpr int8_t Free = -3, White = 0, Black = 1;
    array<array<int8_t, 3>, 3> board;
    board.fill( { Free, Free, Free } );
    unsigned undecided = 0, wins = 0;

    std:function<void(int8_t)> recurse;

    recurse = [&](int8_t colour)
    {
    bool full = true;
    for (size_t row = 3; row--; )
    for (size_t col = 3; col--; )
    if (int8_t &coin = board[row][col]; coin == Free)
    {
    full = false;
    coin = colour;

    int needed = colour ? 3 : 0;
    bool won = board[row][0] + board[row][1] + board[row][2] == needed
    || board[0][col] + board[1][col] + board[2][col] == needed;

    if (int mid = board[1][1]; !won && (row == col || row + col == 2))
    won = (board[0][0] + mid + board[2][2]) == needed
    || (board[0][2] + mid + board[2][0]) == needed;

    if (!won)
    recurse(colour == White ? Black : White);
    else
    ++wins;

    coin = Free;
    }
    undecided += full;
    };

    recurse(White);

    cout << "wins: " << 2 * wins << endl;
    cout << "undecided: " << 2 * undecided << endl;
    }

    bullwinkle@SKYLARK:~/Downloads$ g++ -std=c++23 -o ttt_bm ttt_bm.cc bullwinkle@SKYLARK:~/Downloads$ ./ttt_bm
    wins: 418176
    undecided: 92160
    bullwinkle@SKYLARK:~/Downloads$ g++ -v
    ...
    gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04.1)

    Paul

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mr. Man-wai Chang@3:633/10 to All on Fri Jul 31 13:29:50 2026
    On 7/31/2026 4:00 AM, Bonita Montero wrote:
    Am 30.07.2026 um 18:45 schrieb Mr. Man-wai Chang:
    On 7/29/2026 8:10 PM, Bonita Montero wrote:
    Write a program that calculates the number of possible ways to
    win a Tic Tac Toe round and the number of possible undecided
    rounds. Don't show the code here immediately but after some
    days. Just show the results.

    Possibly a very famous assignment for students
    doing computer science. But I have never ever
    written a game.

    It's not about writing a game but calculating the likhehood
    of different outcomes.


    But do you have to use beautiful maths to
    solve maths problems? Could we just use
    fingers and counting, like programming? :)

    --

    @~@ 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...

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mr. Man-wai Chang@3:633/10 to All on Fri Jul 31 13:30:56 2026
    On 7/31/2026 4:00 AM, Bonita Montero wrote:

    It's not about writing a game but calculating the likhehood
    of different outcomes.


    discrete mathematics - Google ?? <https://www.google.com/search?q=discrete+mathematics>

    --

    @~@ 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...

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R Kym Horsell@3:633/10 to All on Fri Jul 31 06:19:19 2026
    In comp.lang.c Bonita Montero <Bonita.Montero@gmail.com> wrote:
    Am 29.07.2026 um 14:14 schrieb Chris Ahlstrom:

    "Yes, tic-tac-toe is a strongly solved game that always ends
    in a forced draw when both players use optimal strategy."

    I.e. You're beating a dead horse.

    Then show me the results, i.e. the number of possible
    wins and the number of possible undecided games.

    The problem seems to be under-specified.
    Does who plays first make a "different game".
    In some ways of looking at it only the final positions determine "the game"
    and if you want to solve it in your head you can rotate and flip
    all possible end positions down to a relatively small number.

    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.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Johann 'Myrkraverk' Oskarsson@3:633/10 to All on Fri Jul 31 14:54:39 2026
    On 31/07/2026 1:29 PM, Mr. Man-wai Chang wrote:
    On 7/31/2026 4:00 AM, Bonita Montero wrote:
    Am 30.07.2026 um 18:45 schrieb Mr. Man-wai Chang:
    On 7/29/2026 8:10 PM, Bonita Montero wrote:
    Write a program that calculates the number of possible ways to
    win a Tic Tac Toe round and the number of possible undecided
    rounds. Don't show the code here immediately but after some
    days. Just show the results.

    Possibly a very famous assignment for students
    doing computer science. But I have never ever
    written a game.

    It's not about writing a game but calculating the likhehood
    of different outcomes.


    But do you have to use beautiful maths to
    solve maths problems? Could we just use
    fingers and counting, like programming? :)


    There is a game called "lights out." I forgot the exact rules, but
    it has lights on a grid, and toggling one toggles four others in a
    cross pattern[1]. Some squares -- it depends on the size -- you can
    solve exactly, and some have no solutions. The "trick" here is to
    create a program that does boolean matrix algebra, and then it can
    tell you if the current board/position has a solution, or has no
    solution.

    The object of the game is to start with all lights on, and then turn
    them all off.

    Do you like to create programs that solve such games?


    [1] Dan Cross need not reply. Nor Keith, he can't code his own boolean matrices anyway.

    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via Easynews.com

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Fri Jul 31 07:31:43 2026
    On Thu, 30 Jul 2026 22:00:26 +0200, Bonita Montero wrote:

    It's not about writing a game but calculating the likhehood of
    different outcomes.

    A player who doesn?t make mistakes is going to choose a losing move,
    where there is a non-losing alternative available, with a likelihood
    of zero.

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Keith Thompson@3:633/10 to All on Fri Jul 31 03:00:12 2026
    Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> writes:
    [...]
    [1] Dan Cross need not reply. Nor Keith, he can't code his own boolean matrices anyway.

    Your apparent obsession with me is annoying. I intend this to be
    my last communication with you. Please consider not mentioning
    me ever again. (If you could refrain from making off-topic posts
    to these newsgroups, that would be great, but I don't expect that
    kind of self-control.)

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    void Void(void) { Void(); } /* The recursive call of the void */

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bonita Montero@3:633/10 to All on Fri Jul 31 14:20:35 2026
    Am 31.07.2026 um 08:19 schrieb R Kym Horsell:

    Does who plays first make a "different game".

    I count boards with the first player starting first and
    the second player doing the same by taking two times the
    outcome; that's the same as if you inverted the board.

    In some ways of looking at it only the final positions determine "the game" and if you want to solve it in your head you can rotate and flip
    all possible end positions down to a relatively small number.

    Show me the code. ;-)

    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.

    Absolutely not. There was the same discussion on Quora and
    the results shown are exactly the half of mine, because I
    take both players starting first.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bonita Montero@3:633/10 to All on Fri Jul 31 14:21:46 2026
    Am 31.07.2026 um 09:31 schrieb Lawrence D?Oliveiro:

    A player who doesn?t make mistakes is going to choose a losing move,
    where there is a non-losing alternative available, with a likelihood
    of zero.

    That's not what I asked for.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Johann 'Myrkraverk' Oskarsson@3:633/10 to All on Fri Jul 31 20:57:25 2026
    On 31/07/2026 6:00 PM, Keith Thompson wrote:
    Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> writes:
    [...]
    [1] Dan Cross need not reply. Nor Keith, he can't code his own boolean
    matrices anyway.

    Your apparent obsession with me is annoying. I intend this to be
    my last communication with you. Please consider not mentioning
    me ever again. (If you could refrain from making off-topic posts
    to these newsgroups, that would be great, but I don't expect that
    kind of self-control.)


    You broke your own rule, and replied to me. Do you have amnesia?

    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via Easynews.com

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Kenny McCormack@3:633/10 to All on Fri Jul 31 14:08:56 2026
    In article <114hrne$2jldf$1@kst.eternal-september.org>,
    Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> writes:
    [...]
    [1] Dan Cross need not reply. Nor Keith, he can't code his own boolean
    matrices anyway.

    Your apparent obsession with me is annoying. I intend this to be
    my last communication with you. Please consider not mentioning
    me ever again. (If you could refrain from making off-topic posts
    to these newsgroups, that would be great, but I don't expect that
    kind of self-control.)

    The Lord & Master has spoken.

    --
    The last time a Republican cared about you, you were a fetus.

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mr. Man-wai Chang@3:633/10 to All on Fri Jul 31 22:18:08 2026
    On 7/29/2026 8:10 PM, Bonita Montero wrote:

    Write a program that calculates the number of possible ways to
    win a Tic Tac Toe round and the number of possible undecided
    rounds. Don't show the code here immediately but after some
    days. Just show the results.
    C and C++ are allowed since the solution will be very similar.

    On 7/31/2026 4:00 AM, Bonita Montero wrote:

    It's not about writing a game but calculating the likhehood
    of different outcomes.


    Spoiler alert .....





















    Okay, first one needs to define victory and draw.
    Then, you can just iterate all possible endgames.
    No actual calculations needed?


    --

    @~@ 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...

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mr. Man-wai Chang@3:633/10 to All on Fri Jul 31 22:42:47 2026
    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>

    --

    @~@ 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...

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mr. Man-wai Chang@3:633/10 to All on Fri Jul 31 22:43:07 2026
    On 7/29/2026 8:10 PM, Bonita Montero wrote:
    Write a program that calculates the number of possible ways to
    win a Tic Tac Toe round and the number of possible undecided
    rounds. Don't show the code here immediately but after some
    days. Just show the results.
    C and C++ are allowed since the solution will be very similar.


    Don't forget to ask A.I.! You can
    at last compare your solution
    against A.I.'s results.

    vibe coding - Google ??
    <https://www.google.com/search?q=vibe coding>

    vibe coding wargames - Google ?? <https://www.google.com/search?q=vibe+coding+wargames>

    WarGames (10/11) Movie CLIP -
    Tic Tac Toe With Joshua (1983) HD - YouTube <https://www.youtube.com/watch?v=F7qOV8xonfY>

    --

    @~@ 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...

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Michael S@3:633/10 to All on Fri Jul 31 17:53:13 2026
    On Thu, 30 Jul 2026 23:00:30 +0200
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

    On 2026-07-30 21:59, Bonita Montero wrote:
    Am 30.07.2026 um 17:53 schrieb Janis Papanagnou:

    Since your code doesn't compile without errors with my g++
    -std=c++23, and especially since you said in your OP:? "Just show
    the results.", mind to post the result that your code is supposed
    to produce? Thanks.

    It compiles with current MSVC, g++-14 and clang++-20.

    Maybe. (I'm no MS user, so that's quite meaningless for me.)[*]


    gcc-14 and clang-20 are certainly available on many (most ?) Linux distributions. May be, getting them on some distros is less easy than
    it is on Windows/msys2, but it is not a rocket science.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From James Kuyper@3:633/10 to All on Fri Jul 31 11:22:59 2026
    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.

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Janis Papanagnou@3:633/10 to All on Fri Jul 31 18:17:58 2026
    On 2026-07-31 16:53, Michael S wrote:
    On Thu, 30 Jul 2026 23:00:30 +0200
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

    On 2026-07-30 21:59, Bonita Montero wrote:
    Am 30.07.2026 um 17:53 schrieb Janis Papanagnou:

    Since your code doesn't compile without errors with my g++
    -std=c++23, and especially since you said in your OP:ÿ "Just show
    the results.", mind to post the result that your code is supposed
    to produce? Thanks.

    It compiles with current MSVC, g++-14 and clang++-20.

    Maybe. (I'm no MS user, so that's quite meaningless for me.)[*]

    gcc-14 and clang-20 are certainly available on many (most ?) Linux distributions. May be, getting them on some distros is less easy than
    it is on Windows/msys2, but it is not a rocket science.

    Availability of the GNU CC on Linux was not the problem with BM's code.
    See Paul's reply for details.

    Janis


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bonita Montero@3:633/10 to All on Fri Jul 31 20:33:40 2026
    Am 31.07.2026 um 00:56 schrieb Paul:

    CoPilot gives me this.

    "The errors all come from one root cause: C++23 does not support this auto &self inside a lambda.
    That syntax was proposed for ?lambda recursion? but never made it into the standard.
    So g++ rejects it, and then all later errors are just fallout from the first one.

    I guess Copilot is wrong. Grok, Claude and GPT say it's part of the
    standard. Maybe the initial compiler was too old. And it's not plausible
    why this shouldn't have gone into the standard since it's simple and
    useful.

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R Kym Horsell@3:633/10 to All on Fri Jul 31 22:05:04 2026
    In comp.lang.c Bonita Montero <Bonita.Montero@gmail.com> wrote:
    Am 31.07.2026 um 08:19 schrieb R Kym Horsell:

    Does who plays first make a "different game".

    I count boards with the first player starting first and
    the second player doing the same by taking two times the
    outcome; that's the same as if you inverted the board.

    In some ways of looking at it only the final positions determine "the game" >> and if you want to solve it in your head you can rotate and flip
    all possible end positions down to a relatively small number.

    Show me the code. ;-)
    ...

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


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Fri Jul 31 19:53:56 2026
    On 7/31/2026 11:33 AM, Bonita Montero wrote:
    Am 31.07.2026 um 00:56 schrieb Paul:

    CoPilot gives me this.

    "The errors all come from one root cause: C++23 does not support this
    auto &self inside a lambda.
    ÿ That syntax was proposed for ?lambda recursion? but never made it
    into the standard.
    ÿ So g++ rejects it, and then all later errors are just fallout from
    the first one.

    I guess Copilot is wrong. Grok, Claude and GPT say it's part of the
    standard. Maybe the initial compiler was too old. And it's not plausible
    why this shouldn't have gone into the standard since it's simple and
    useful.

    Code and research for yourself. Sigh. The AI can help make a moron sound
    half way smart?

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Fri Jul 31 20:00:38 2026
    On 7/31/2026 8:22 AM, James Kuyper 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.

    8 winning positions afaict. For all of the losing positions, not sure.
    Working on other things right now.

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris Ahlstrom@3:633/10 to All on Sat Aug 1 07:40:56 2026
    Bonita Montero wrote this screed in ALL-CAPS (fixed):

    Am 29.07.2026 um 14:14 schrieb Chris Ahlstrom:

    "Yes, tic-tac-toe is a strongly solved game that always ends
    in a forced draw when both players use optimal strategy."

    I.e. You're beating a dead horse.

    Then show me the results, i.e. the number of possible
    wins and the number of possible undecided games.

    AI Overview

    There are 255,168 possible valid games of standard
    tic-tac-toe, 19,683 total board positions, and 765 essentially
    different board states.

    Total Game Sequences

    255,168 total playable games: This counts every unique sequence of moves
    from start to finish, stopping as soon as a player wins or the
    board fills up.

    131,184 wins for X (the first player)

    77,904 wins for O (the second player)

    46,080 draws (cats' games

    Now back to coding my MIDI program.

    --
    It usually takes more than three weeks to prepare a good impromptu speech.
    -- Mark Twain

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Michael S@3:633/10 to All on Sat Aug 1 21:44:05 2026
    On Fri, 31 Jul 2026 18:17:58 +0200
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

    On 2026-07-31 16:53, Michael S wrote:
    On Thu, 30 Jul 2026 23:00:30 +0200
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

    On 2026-07-30 21:59, Bonita Montero wrote:
    Am 30.07.2026 um 17:53 schrieb Janis Papanagnou:

    Since your code doesn't compile without errors with my g++
    -std=c++23, and especially since you said in your OP:? "Just show
    the results.", mind to post the result that your code is supposed
    to produce? Thanks.

    It compiles with current MSVC, g++-14 and clang++-20.

    Maybe. (I'm no MS user, so that's quite meaningless for me.)[*]

    gcc-14 and clang-20 are certainly available on many (most ?) Linux distributions. May be, getting them on some distros is less easy
    than it is on Windows/msys2, but it is not a rocket science.

    Availability of the GNU CC on Linux was not the problem with BM's
    code. See Paul's reply for details.

    Janis


    It was, actually. Not on any Linux, but on your specific Linux
    instalation.
    Bonita said that her code compiles with gcc-14. I see no reason
    to not believe her.

    BTW, it was not Paul's reply, but reply of co-pilot. Which I don't
    trust.



    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Janis Papanagnou@3:633/10 to All on Sat Aug 1 21:43:10 2026
    On 2026-08-01 20:44, Michael S wrote:
    [...]
    Bonita said that her code compiles with gcc-14. [..]

    What she originally said was: "I show mine in C++23".

    And I did: g++ -std=c++23 -o ttt_bm ttt_bm.cc
    and got errors.

    BTW, it was not Paul's reply, but reply of co-pilot. [...]

    The point is that BM's code didn't compile with -std=c++23
    and Paul's code - that fixes the issue - compiled well.

    All that wouldn't have been necessary in the first place if
    Bonita would have just shown her results - as she requested
    also from the audience! - but no, not even after I asked for
    that, twice.

    Paul's response (with or without AI) was helpful - in *both*
    respects, code and result! - Bonita's (and yours) were not.

    (You can continue squirming around these obvious facts, but
    don't expect that I'll respond to more useless rubbish like
    that.)

    Janis

    BTW, providing some code is hardly evidence for the original
    question. A formal mathematical deduction would be in order
    to get any results to be verified. - Otherwise you can only
    compare all programs' results and make guesses (or ask an AI -
    which might be okay given that this is such a trivial "quest"
    that had certainly be "solved" many times in every language,
    so easily to be identified by the AIs - I've just tested that
    and got code, code that compiles correctly and that produces
    the equivalent results, modulo the symmetries, of course).


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R Kym Horsell@3:633/10 to All on Sun Aug 2 01:17:41 2026
    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.
    Games can be shorted if there is a winner. That adds more possibilities.

    There are 2^9 possible ttt boards if the games goes to 9 moves.
    But the number of possible boards not looking at symmetries
    is more like 3^9 i.e. 38x more.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mike Terry@3:633/10 to All on Sun Aug 2 03:41:28 2026
    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".

    Lets represent a game by the sequence of cells (1 to 9) that are taken in succession. If the rules
    said all games continue until the grid is full, then there would be exactly 9! games, e.g.
    [123456789]
    [174698523]
    [523416789]

    To see the effect of games ending in fewer moves, imagine the rules declared the first person a
    winner if he takes cell 1, ending the game. Then we could allow players to continue playing, while
    understanding that the game was won at move 1, just for fun! to see what might have happened in the
    remaining 8 moves.

    So of the 3 "extended games" having the full 9 moves I listed above, the first two were both won on
    move 1. In fact all extended games starting [1...] are just one "real" game as counted by our
    program, so instead of counting 9! extended games we would count only 9!-8! real games.

    There are 2^9 possible ttt boards if the games goes to 9 moves.
    But the number of possible boards not looking at symmetries
    is more like 3^9 i.e. 38x more.


    No, you're overcounting! Your 3^9 boards include the one where every cell has an x, but there is no
    legal game that results in that - players have to alternate in their play.

    Mike.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mike Terry@3:633/10 to All on Sun Aug 2 04:19:58 2026
    On 02/08/2026 03:41, Mike Terry 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".

    Lets represent a game by the sequence of cells (1 to 9) that are taken in succession.? If the rules
    said all games continue until the grid is full, then there would be exactly 9! games, e.g.
    ?? [123456789]
    ?? [174698523]
    ?? [523416789]

    To see the effect of games ending in fewer moves, imagine the rules declared the first person a
    winner if he takes cell 1, ending the game.? Then we could allow players to continue playing, while
    understanding that the game was won at move 1, just for fun! to see what might have happened in the
    remaining 8 moves.

    So of the 3 "extended games" having the full 9 moves I listed above, the first two were both won on
    move 1.? In fact all extended games starting [1...] are just one "real" game as counted by our
    program, so instead of counting 9! extended games we would count only 9!-8! real games.

    There are 2^9 possible ttt boards if the games goes to 9 moves.
    But the number of possible boards not looking at symmetries
    is more like? 3^9? i.e. 38x more.


    No, you're overcounting!? Your 3^9 boards include the one where every cell has an x, but there is no
    legal game that results in that - players have to alternate in their play.

    But also you're undercounting, because board-positions are not games - a given position could be
    reached by many different games, where the order of play is important...


    Mike.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Sun Aug 2 03:57:53 2026
    On Fri, 31 Jul 2026 14:21:46 +0200, Bonita Montero wrote:

    Am 31.07.2026 um 09:31 schrieb Lawrence D?Oliveiro:

    A player who doesn?t make mistakes is going to choose a losing
    move, where there is a non-losing alternative available, with a
    likelihood of zero.

    That's not what I asked for.

    That?s how tic-tac-toe is played, in case you didn?t know.

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From bart@3:633/10 to All on Sun Aug 2 11:25:29 2026
    On 31/07/2026 16:22, James Kuyper 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.

    There may be twice as many depending on whether X or O goes first.

    If the board has only two adjacent cells, these are all the possible games:

    -- empty board
    X- X goes first
    XO Then O

    --
    -X
    OX

    --
    O-
    OX

    --
    -O
    XO

    Here each game always has two moves (and nobody can win). But there are
    2x2! distinct games, not 2! (More if you allow 90-degree rotations.)

    If you don't care who goes first (say the first player is always A, the
    second B), then it will be 2 games. And taking out reflections (same as 180-degree rotations), then it will be only one game,

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From James Kuyper@3:633/10 to All on Sun Aug 2 12:30:35 2026
    On 2026-08-01 21: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.
    Games can be shorted if there is a winner. That adds more possibilities.

    No, every short game is the beginning part of a 9-move game. therefore,
    9! is an overcount, not an undercount. If you win a game in 5 moves, the shortest possible, there's still 4 unmarked boxes. If we ignore that
    it's a victory and continue playing, that's 4 choices for the next box,
    3 choices for the following one, 2 for the one after that, and the last
    move is forced. That means there's 4*3*2*1 = 12 different unstopped game
    for that one game that stops as soon as victory is reached.
    There are 2^9 possible ttt boards if the games goes to 9 moves.

    If you count games only by the ending position, and not by the order in
    which the squares were marked, and continue playing after victory until
    all boxes are marked, then 2^9 is the correct figure. To me, the order

    But the number of possible boards not looking at symmetries
    is more like 3^9 i.e. 38x more.

    I would guess you get the 3 by considering, X, O, and unmarked? If so,
    you're counting incomplete games in that 3^9. In completed games there
    must always be at least 5 marked boxes. Also, in legal games, the number
    of Xs minus the number of O's can only have the values -1, 0, or 1. Your
    count includes games that violate that rule. Therefore, if you ignore
    the order in which the squares are marked, the count is a lot less than 3^9.
    If you take count games as equivalent if they can be rotated and/or
    mirrored to match each other, and always start with an X, the number of distinct games is MUCH smaller.

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R Kym Horsell@3:633/10 to All on Sun Aug 2 21:09:34 2026
    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.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mike Terry@3:633/10 to All on Mon Aug 3 01:54:37 2026
    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.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From James Kuyper@3:633/10 to All on Mon Aug 3 17:25:15 2026
    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.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R Kym Horsell@3:633/10 to All on Mon Aug 3 21:33:15 2026
    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


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From R Kym Horsell@3:633/10 to All on Mon Aug 3 22:00:16 2026
    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.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)