Tic Tac Toe

[[[ Nik’s version: (with alternation built in) ]]]
This version is incorrect:
In[]:=
TicTacFunction[k_Integer]:=Function[list,With[{a=First[Mod[Commonest[DeleteCases[Flatten@list,0]],k]+1,1]},ReplacePart[list,#a]&/@Position[list,0]]]
In[]:=
TicTacFunction[k_Integer,t_Integer]:=Function[list,With[{a=Mod[t,k,1]},ReplacePart[list,#a]&/@Position[list,0]]]
SW’s version:
In[]:=
CheckWin[list_]:=Catch[Module[{n=First[Dimensions[list]],u},Do[u=Part[list,i,All];If[!AllTrue[u,#0&]&&SameQ@@u,Throw[First[u]]],{i,n}];Do[u=Part[list,All,i];If[!AllTrue[u,#0&]&&SameQ@@u,Throw[First[u]]],{i,n}];​​u=Table[list[[i,i]],{i,n}];If[!AllTrue[u,#0&]&&SameQ@@u,Throw[First[u]]];u=Table[list[[-i,i]],{i,n}];If[!AllTrue[u,#0&]&&SameQ@@u,Throw[First[u]]];False]]
In[]:=
Clear[CheckWin]
Nik’s version:
In[]:=
CheckWin[board_]:=With[{dims=Dimensions@board},First[Keys@Select[KeySelect[Merge[Map[Counts,Join[board,Transpose@board,{Diagonal@board,ResourceFunction["Antidiagonal"]@board}]],AnyTrue[EqualTo[First@dims]]],GreaterThan[0]],Identity],False]/;Length[dims]===2&&SameQ@@dims]
In[]:=
PlotBoard[list_String,sz_:40]:=PlotBoard[ToExpression[list],sz]
In[]:=
PlotBoard[list:{{_Integer..}..},sz_:40]:=ArrayPlot[list,ImageSizesz,ColorRules{0White,1Orange,2Purple},MeshTrue]
In[]:=
PlotBoard[i_Integer,sz_:40]:=Framed[Framed[PlotBoard[{{i}},sz]]]
In[]:=
TicTacWinAssociation[k_:2]:=<|"StateEvolutionFunction"(With[{t=First[#],s=Last[#]},Thread[t+1->If[IntegerQ[s],{s},With[{w=CheckWin[s]},If[w=!=False,{w},TicTacFunction[k,t+1][s]]]]]]&),"StateEquivalenceFunction"SameQ,"StateEventFunction"Identity,"EventDecompositionFunction"Identity,"EventApplicationFunction"Identity,"SystemType""None","EventSelectionFunction"Identity|>;
In[]:=
TicTacWinBeforeAssociation[k_:2]:=<|"StateEvolutionFunction"(With[{t=First[#],s=Last[#]},Thread[t+1->If[IntegerQ[s],{s},With[{w=CheckWin[s]},If[w=!=False,{w},With[{c=CheckWin[#]},If[c=!=False,c,#]]&/@TicTacFunction[k,t+1][s]]]]]]&),"StateEquivalenceFunction"SameQ,"StateEventFunction"Identity,"EventDecompositionFunction"Identity,"EventApplicationFunction"Identity,"SystemType""None","EventSelectionFunction"Identity|>;
In[]:=
TicTacAssociation[k_:2]:=<|"StateEvolutionFunction"(With[{t=First[#],s=Last[#]},Thread[t+1TicTacFunction[k,t+1][s]]]&),"StateEquivalenceFunction"SameQ,"StateEventFunction"Identity,"EventDecompositionFunction"Identity,"EventApplicationFunction"Identity,"SystemType""None","EventSelectionFunction"Identity|>;
In[]:=
ResourceFunction["MultiwaySystem"][TicTacAssociation[2],{Table[0,2,2]},1,"StatesGraph","StateRenderingFunction"(Inset[PlotBoard[Last[#2],30],#1]&),"IncludeStepNumber"True,GraphLayout"SpringElectricalEmbedding"]
In[]:=
ResourceFunction["MultiwaySystem"][TicTacAssociation[2],{Table[0,2,2]},2,"StatesGraph","StateRenderingFunction"(Inset[PlotBoard[Last[#2],30],#1]&),"IncludeStepNumber"True,GraphLayout"SpringElectricalEmbedding"]
Out[]=
In[]:=
ResourceFunction["MultiwaySystem"][TicTacAssociation[2],{Table[0,2,2]},3,"StatesGraph","StateRenderingFunction"(Inset[PlotBoard[Last[#2],30],#1]&),"IncludeStepNumber"True,GraphLayout"SpringElectricalEmbedding"]
Out[]=
In[]:=
ResourceFunction["MultiwaySystem"][TicTacAssociation[2],{Table[0,2,2]},4,"StatesGraph","StateRenderingFunction"(Inset[PlotBoard[Last[#2],30],#1]&),"IncludeStepNumber"True,GraphLayout"SpringElectricalEmbedding"]
Out[]=
One unit in branchial space = one move was made differently
All specific games are paths (which are geodesic paths) in this graph....
https://en.wikipedia.org/wiki/Quantum_tic-tac-toe
In ordinary QTTT, one is doing operations (including measurement) separately on every square.
We can color this picture by orange and purple wins, and ties.
A failure to entangle in the branchial graph (AKA an event horizon) is a boring game whose outcome is very predetermined...
NOTE: 2 in a row diagonally is not considered a win here
The win states are generational states because “something has happened” at every element.
There are no branchlike separated configurations because every square is spatially distinct.

A “complete completion” would give only one possible outcome for the game

Each outcome in the “real game” is equivalence class of states.

Definition of a quantum experiment: divide the states of the universe into equivalence classes labeled by the results of the measurement

[ Somewhat weird that in the game there is not time invariance, because of back-and-forth moves ]

[Could avoid by simultaneous doing O and X moves]

Double-move case

Can have a double win in this case....

Non-physicality of reference frames ↔ general covariance

There is no observational difference between a different coordinatization and a different spacetime geometry / gravitational field
Geometry of branchial/multispace determines the particular “coordinatized measurement”

E.g. Wheeler-de Witt should be able to be written as a tensor eqn

Path integral “as a tensor equation”

The standard Lagrangian action principle is an extremization of an action
​
R Sqrt[g] relativistic case
(R + T) Sqrt[g]
Einstein equations relate R and T; therefore for extremization you can extremize
In QM case, there is a R somewhere in the Fubini-Study of Hilbert space .... but you can apply the equation of motion to get rid of it, and

Add in completions ... get Born rule

Will the quantum and classical cases behave the same? [What about biased case?]

Score difference ~ phase difference

Analog of double slit: where did the win happen on the board?

Given a board position, if I am going to place another mark, how are my possible moves “rated” in score/phase...