• Tic Tac Toe Quest

    From Bonita Montero@3:633/10 to All on Wednesday, July 29, 2026 14:10:33
    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 Wednesday, July 29, 2026 08:14:49
    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 Wednesday, July 29, 2026 14:28:18
    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 Wednesday, July 29, 2026 20:30:26
    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 Wednesday, July 29, 2026 14:38:44
    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 Wednesday, July 29, 2026 20:46:41
    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 Wednesday, July 29, 2026 14:57:42
    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 Wednesday, July 29, 2026 21:14:52
    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 Wednesday, July 29, 2026 15:04:12
    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 Wednesday, July 29, 2026 21:28:43
    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 Wednesday, July 29, 2026 16:25:10
    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 Thursday, July 30, 2026 17:09:58
    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 Thursday, July 30, 2026 17:53:55
    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 Friday, July 31, 2026 00:45:48
    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 Thursday, July 30, 2026 21:59:40
    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 Thursday, July 30, 2026 22:00:26
    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 Friday, July 31, 2026 04:17:05
    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 Thursday, July 30, 2026 23:00:30
    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 Thursday, July 30, 2026 18:56:15
    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 Friday, July 31, 2026 13:29:50
    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 Friday, July 31, 2026 13:30:56
    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 Friday, July 31, 2026 06:19:19
    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 Friday, July 31, 2026 14:54:39
    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 Friday, July 31, 2026 07:31:43
    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 Friday, July 31, 2026 03:00:12
    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 Friday, July 31, 2026 14:20:35
    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 Friday, July 31, 2026 14:21:46
    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 Friday, July 31, 2026 20:57:25
    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 Friday, July 31, 2026 14:08:56
    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 Friday, July 31, 2026 22:18:08
    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 Friday, July 31, 2026 22:42:47
    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 Friday, July 31, 2026 22:43:07
    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 Friday, July 31, 2026 17:53:13
    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 Friday, July 31, 2026 11:22:59
    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 Friday, July 31, 2026 18:17:58
    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 Friday, July 31, 2026 20:33:40
    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 Friday, July 31, 2026 22:05:04
    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 Friday, July 31, 2026 19:53:56
    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 Friday, July 31, 2026 20:00:38
    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 Saturday, August 01, 2026 07:40:56
    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 Saturday, August 01, 2026 21:44:05
    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 Saturday, August 01, 2026 21:43:10
    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)