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".
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:I think you missed a few.
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. >>>
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.
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:I think you missed a few.
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. >>>
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,_}.
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:I think you missed a few.
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. >>>>
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
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:I think you missed a few.
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. >>>>
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 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:
I think you missed a few.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. >>>>>
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.
On 03/08/2026 23:00, R Kym Horsell wrote:
In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
On 2026-08-02 17:09, R Kym Horsell wrote:...
In comp.lang.c Mike Terry
<news.dead.person.stones@darjeeling.plus.com> wrote:
On 02/08/2026 02:17, R Kym Horsell wrote:
In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote: >>>>>>> On 2026-07-31 02:19, R Kym Horsell wrote:
With no summetries and counting who start, the order of the >>>>>>> squares
marked, and the final position as all befining "the game"
then there are a couple million possibilities.
There's only 9 different choices for the first mark, 8 for the
second,
etc. Ignoring the victory conditions, that means at most 9! =
362,880
games, no matter how you distinguish them. If you stop a game as >>>>>>> soon as
one side wins, it's much smaller, I won't bother figuring out how >>>>>>> many.
I think you missed a few.
James' account looks correct to me.-a 9! is just an upper bound, as >>>>> he notes.
Games can be shorted if there is a winner.-a That adds more
possibilities.
If a game ends with a winner in less than 9 moves, that /reduces/
the possibilities (i.e. reduces
from 9!), not "adding more".
If you have have long games and also short games then
there are more than just the long games. Right?
No, I specified stopping a game as soon as it is won. The moves of every
Maybe we are talking at cross-purposes.
I think you're alluding to "no legal game can be a prefix of another
legal game (although 2 legal games can share the prefix)".
IOW the total number of possible games is the sum-a of the games of length >> 5, length 6, ... length 9.
I.e. the total is more than then number of games of length 9.
I've done a simulation. Figures may not be right, but they look plausible:
Total number of games:-a 362880-a-a-a-a-a (Ignores who goes first)
Won by player 1:-a-a-a-a-a-a-a 212256
Won by player 2:-a-a-a-a-a-a-a 104544 Drawn:-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 46080
Players make all possible permutations of moves in turn, with no
strategy. Games last from 5 to 9 moves:
34560 games with 5 moves (all won)
31968 games with 6 moves
95904 games with 7 moves
72576 games with 8 moves
127872 games with 9 moves (46080 were drawn)
Drawn games always take 9 moves.
On 04/08/2026 01:37, bart wrote:
On 03/08/2026 23:00, R Kym Horsell wrote:
In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
On 2026-08-02 17:09, R Kym Horsell wrote:
In comp.lang.c Mike Terry <news.dead.person.stones@darjeeling.plus.com> wrote:
On 02/08/2026 02:17, R Kym Horsell wrote:
In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote: >>>>>>>> On 2026-07-31 02:19, R Kym Horsell wrote:
With no summetries and counting who start, the order of the squares
marked, and the final position as all befining "the game"
then there are a couple million possibilities.
There's only 9 different choices for the first mark, 8 for the second, >>>>>>>> etc. Ignoring the victory conditions, that means at most 9! = 362,880 >>>>>>>> games, no matter how you distinguish them. If you stop a game as soon as
one side wins, it's much smaller, I won't bother figuring out how many.
I think you missed a few.
James' account looks correct to me.a 9! is just an upper bound, as he notes.
Games can be shorted if there is a winner.a That adds more possibilities.
If a game ends with a winner in less than 9 moves, that /reduces/ the possibilities (i.e. reduces
from 9!), not "adding more".
If you have have long games and also short games then
there are more than just the long games. Right?
No, I specified stopping a game as soon as it is won. The moves of every >>> ...
Maybe we are talking at cross-purposes.
I think you're alluding to "no legal game can be a prefix of another
legal game (although 2 legal games can share the prefix)".
IOW the total number of possible games is the suma of the games of length >>> 5, length 6, ... length 9.
I.e. the total is more than then number of games of length 9.
I've done a simulation. Figures may not be right, but they look plausible: >>
Total number of games:a 362880aaaaa (Ignores who goes first)
Won by player 1:aaaaaaa 212256
Won by player 2:aaaaaaa 104544
Drawn:aaaaaaaaaaaaaaaaaa 46080
Players make all possible permutations of moves in turn, with no strategy. Games last from 5 to 9
moves:
34560 games with 5 moves (all won)
31968 games with 6 moves
95904 games with 7 moves
72576 games with 8 moves
127872 games with 9 moves (46080 were drawn)
Drawn games always take 9 moves.
No, I think this includes duplicates. If a particular 9-move sequence is won after 6 moves say, then
the remaining combinations that start with the same 6 need to be skipped otherwise they are counted
again.
I think you're alluding to "no legal game can be a prefix of anotherIt's simpler than that. Every legal game ends as soon as there are three
legal game (although 2 legal games can share the prefix)".
IOW the total number of possible games is the sum of the games of length
5, length 6, ... length 9.
I.e. the total is more than then number of games of length 9.
It's simpler than that. Every legal game ends as soon as there are three
of one symbol in a row, column, or diagonal. The game cannot continue
past that point.
Drawn games always take 9 moves.
On 04/08/2026 01:58, bart wrote:
On 04/08/2026 01:37, bart wrote:
On 03/08/2026 23:00, R Kym Horsell wrote:
In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
On 2026-08-02 17:09, R Kym Horsell wrote:...
In comp.lang.c Mike Terry
<news.dead.person.stones@darjeeling.plus.com> wrote:
On 02/08/2026 02:17, R Kym Horsell wrote:
In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote: >>>>>>>>> On 2026-07-31 02:19, R Kym Horsell wrote:
With no summetries and counting who start, the order of >>>>>>>>> the squares
marked, and the final position as all befining "the game"
then there are a couple million possibilities.
There's only 9 different choices for the first mark, 8 for the >>>>>>>>> second,
etc. Ignoring the victory conditions, that means at most 9! = >>>>>>>>> 362,880
games, no matter how you distinguish them. If you stop a game >>>>>>>>> as soon as
one side wins, it's much smaller, I won't bother figuring out >>>>>>>>> how many.
I think you missed a few.
James' account looks correct to me.-a 9! is just an upper bound, >>>>>>> as he notes.
Games can be shorted if there is a winner.-a That adds more
possibilities.
If a game ends with a winner in less than 9 moves, that /reduces/ >>>>>>> the possibilities (i.e. reduces
from 9!), not "adding more".
If you have have long games and also short games then
there are more than just the long games. Right?
No, I specified stopping a game as soon as it is won. The moves of
every
Maybe we are talking at cross-purposes.
I think you're alluding to "no legal game can be a prefix of another
legal game (although 2 legal games can share the prefix)".
IOW the total number of possible games is the sum-a of the games of
length
5, length 6, ... length 9.
I.e. the total is more than then number of games of length 9.
I've done a simulation. Figures may not be right, but they look
plausible:
Total number of games:-a 362880-a-a-a-a-a (Ignores who goes first)
Won by player 1:-a-a-a-a-a-a-a 212256
Won by player 2:-a-a-a-a-a-a-a 104544
Drawn:-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 46080
Players make all possible permutations of moves in turn, with no
strategy. Games last from 5 to 9 moves:
34560 games with 5 moves (all won)
So assuming X plays first, games of 5 moves would have 3 X's-a in a line, and 2 O's (anywhere). There are 8 lines where X can win, and for each of these there are Choose(6,2) = 15 choices for cells O has taken.-a Well that's counting final board positions, and each of those can occur in (3!)(2!) = 12
So that gives 8 * 15 = 120-a 5 move (game ended) board positions
-a-a-a-a-a-a-a-a-a-a-a-a-a 120 * 12 = 1440-a 5 move games.-a (Not 34560)
But if we then "complete" the games by playing 4 further moves to fill
the grid, there are 4! = 24 ways to do this for each 5 move game, giving
-a-a-a-a-a-a-a-a-a-a-a-a-a 1440 * 24 = 34560-a-a (your figure)
31968 games with 6 moves
95904 games with 7 moves
72576 games with 8 moves
127872 games with 9 moves (46080 were drawn)
Drawn games always take 9 moves.
No, I think this includes duplicates. If a particular 9-move sequence
is won after 6 moves say, then the remaining combinations that start
with the same 6 need to be skipped otherwise they are counted again.
Right - your 5 game figure suggests that's exactly what's happened. Probably the same for all the other counts, but I just looked at 5-move games because that's simple to calculate manually.
Hmm, when we add all your possibilities together that gives exactly
362880 = 9!-a So the total of all games you counted was the full 9-move "completed game" count, supporting the idea that you made the same error
in each case.-a If so, we could manually "correct" your results by
dividing each of them by their duplication factor.-a [E.g. 6-move games
have 3 cells unplayed, which can be filled in 3! = 6 ways, so 6 is the duplication factor for these games.]
That would give:
-a moves-a 'completed'-games-a dup-factor-a-a actual-game-count
-a 5-a-a-a-a-a-a-a 34560-a-a-a-a-a-a-a-a-a-a-a-a-a 4!=24-a-a-a-a-a-a-a 34560/24 =-a-a 1440
-a 6-a-a-a-a-a-a-a 31968-a-a-a-a-a-a-a-a-a-a-a-a-a 3!=6-a-a-a-a-a-a-a-a 31968/6-a =-a-a 5328
-a 7-a-a-a-a-a-a-a 95904-a-a-a-a-a-a-a-a-a-a-a-a-a 2!=2-a-a-a-a-a-a-a-a 95904/2-a =-a 47952
-a 8-a-a-a-a-a-a-a 72576-a-a-a-a-a-a-a-a-a-a-a-a-a 1!=1-a-a-a-a-a-a-a-a 72576/1-a =-a 72576
-a 9-a-a-a-a-a-a 127872-a-a-a-a-a-a-a-a-a-a-a-a-a 0!=1-a-a-a-a-a-a-a 127872/1-a = 127872
-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a ------
-a total-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 255168
That agrees with Chris Ahlstrom's previous reporting of what some AI
said which is encouraging! :)
On 2026-08-04, bart <bc@freeuk.com> wrote:
Drawn games always take 9 moves.
Here is a drawn game that took 8 moves:
OXX
X_O
OOX
On 2026-08-03 18:00, R Kym Horsell wrote:
I think you're alluding to "no legal game can be a prefix of anotherIt's simpler than that. Every legal game ends as soon as there are three
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.
of one symbol in a row, column, or diagonal. The game cannot continue
past that point.
On 7/29/2026 8:57 PM, Bonita Montero wrote:
I used TV in the 90s for a machine control app under DOS. I liked
it also that days but from a today's view it's not good OOP, just
as Microsoft Foundation Classes.
I remember it. But it never took off, right?
You have to mention DOS 5's shell as well,
and maybe Norton Commander?
The same went to Turbo C++ and then Borland
C++.
MS-DOS Shell - BetaWiki
<https://betawiki.net/wiki/MS-DOS_Shell>
Norton Commander - Wikipedia
<https://en.wikipedia.org/wiki/Norton_Commander>
I remember DOS 5's shell. I didn't use it much,
nor Norton Commander. On the other tentacle, I
sometimes use Far Manager in modern Windows. It's
nice enough, but I've not gotten used to it yet.
Can you recommend a better Norton Commander clone?
I remember DOS 5's shell. I didn't use it much,
nor Norton Commander. On the other tentacle, I
sometimes use Far Manager in modern Windows. It's
nice enough, but I've not gotten used to it yet.
Can you recommend a better Norton Commander clone?
OK. It took a while to get an 8" floppy drive working to find
the code but this is the way we did it in 1979:
Reading it again it's very much in the line of what the kids these
days call a "prompt".
main :- assert(games(0)), assert(draws(0)),
play(Winner,Moves,FinalBoard),
inc_games,
(Winner=draw -> inc_draws),
fail %%% force it to try all possibilities (above) trying to succeed
; games(Games),writeln(Games),
draws(Draws),writeln(Draws)
.
%% x goes first
%% 1222560
%% 362880
play(Winner,G,B) :-
empboard(B), InitEmp=[1,2,3,4,5,6,7,8,9],
%% player(First),
First=x,
game(First,B,G,InitEmp,FinalEmp),
( player(Winner),won(Winner,B)
; Winner=draw, FinalEmp=[]
)
.
game(_,_,[]) --> []. %% return short solutions first
game(Me,B,[M|Ms]) --> select(M),
{ updboard(Me,B,M), opponent(Me,You) },
game(You,B,Ms).
updboard(Who,B,M) :- arg(M,B,Sq), empty(Sq), Sq=Who.
won(Who,B) :- hasrow(Who,B)
; hascol(Who,B)
; hasdiag(Who,B)
.
%% 1 2 3
%% 4 5 6
%% 7 8 9
hasrow(Who,B) :- checksqs([1,2,3],Who,B)
; checksqs([4,5,6],Who,B)
; checksqs([7,8,9],Who,B)
.
hascol(Who,B) :- checksqs([1,4,7],Who,B)
; checksqs([2,5,8],Who,B)
; checksqs([3,6,9],Who,B)
.
hasdiag(Who,B) :- checksqs([1,5,9],Who,B)
; checksqs([3,5,7],Who,B)
.
checksqs([],_,_).
checksqs([I|Is],Who,B) :- arg(I,B,Sq), Sq == Who, checksqs(Is,Who,B).
empboard(B) :- functor(B,board,9).
empty(Sq) :- var(Sq).
player(Who) :- opponent(Who,_).
opponent(x,0).
opponent(0,x).
inc_games :- retract(games(X)),X1 is X+1,assert(games(X1)).
inc_draws :- retract(draws(X)),X1 is X+1,assert(draws(X1)).
some beautiful code. I wish I still had my cassette tapes..
In comp.lang.c steve g <Sgonedes1977@gmail.com> wrote:
...
some beautiful code. I wish I still had my cassette tapes..
I know how that is.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 74 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 47:44:36 |
| Calls: | 1,100 |
| Files: | 1,339 |
| Messages: | 275,630 |