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.
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?
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.
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?
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.
A modern port of Turbo Vision 2.0, the classical framework for text-
based user interfaces. Now cross-platform and with Unicode support.
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.
Totally wrong. Try it with some code.
As no one here shows a solution I show mine in C++23:
[snip code]
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.
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.
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.
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.
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.
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 );
ÿÿÿÿÿ |ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ^~~~
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.
It's not about writing a game but calculating the likhehood
of different outcomes.
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.
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? :)
It's not about writing a game but calculating the likhehood of
different outcomes.
[1] Dan Cross need not reply. Nor Keith, he can't code his own boolean matrices anyway.
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.
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.
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.)
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.)
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.
It's not about writing a game but calculating the likhehood
of different outcomes.
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.
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 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.)[*]
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.
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.
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.
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. ;-)
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.
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.
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.
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
[...]
Bonita said that her code compiles with gcc-14. [..]
BTW, it was not Paul's reply, but reply of co-pilot. [...]
| Sysop: | Jacob Catayoc |
|---|---|
| Location: | Pasay City, Metro Manila, Philippines |
| Users: | 4 |
| Nodes: | 4 (0 / 4) |
| Uptime: | 496009:12:40 |
| Calls: | 178 |
| Files: | 605 |
| D/L today: |
22 files (18,741K bytes) |
| Messages: | 70,152 |