In particular, the game discussed is trying to find cubefree words over a two-letter alphabet. The sample infinite game seems to agree with the listed sequence on OEIS for the lexicographically earliest infinite cubefree word, though your method of generation appears to be different from the one in the comments. (I haven't analyzed it in detail.)
From your link it seems it is a conjecture that this is the lexicographically earliest one. Very interesting!
The article is also notable for its consistency in spelling "lose" as "loose".
One could interpret the outcome of the game as a number by ○ being the digit 0 and ● being 1. For fun we could also say that if there is a repeating subsequence at the end (someone lost), then that is repeated infinitely. I suggest this because any won game has a sub-string repeated three times at the end, so we might as well repeat it to infinity!
Say the example game, ● ● ○ ○ ● ● ○ ○ ● ● ○ ● ● ○ ● ○ ○ ● ● ○ ○ ● ● ○ ○ ●, would be 0.11001100110110100110011001, or perhaps 0.11001100110110(1001) where the parenthesis express infinite repetition. If we choose the first, it is 768160/959951 and the second would be 65553/81920.
In any case, a won game would be a rational number, while a game which goes on forever would be an irrational! One could then wonder which irrational numbers are represented by such games.
Without having a proof ready at hand, I am quite sure that the `generate` sequence from my post represents a transcendental number.
Seems like there should be a bijection there no?
We can define two different sequences of three characters that start with 0 and end with 1: 001 and 011. Because they each start and end with a different character, we can never create a series of three characters by chaining two of these sequences.
Now we can go one step deeper and encode the "001" sequence as 0, and the "011" sequence as 1. We can generate our 001 and 011 pattern again, but with our encoded versions of 0 and 1, giving us these sequences: 001001011 and 001011011. These sequences again have the same characteristics, they start and end with different sub-sequences (001 and 011) so they can be chained without creating a series of three sub-sequences.
We can now use these larger sequences and encode these as 0 and 1, and so forth ad infinitum.
I guess it also hints at why the sequences keep getting smaller when you compress it several times (as mentioned in a footnote). Each compression peels away layers in this expansion. That’s my intuition at least.
After player 1s first move there is one stone in the sequence.
After player 2s first move there are three stones.
After player 1s next move there are five stones.
After player 2s next move there are seven stones.
Etc. Usually this completely removes first player advantage. It’s obvious that this removes player 1s potential advantage since black or white, his move is symmetrical without loss of generality.
Player 2 actually has the first consequential move, with three possible options — again, taking player 1s move as a given color, player 2 can play
DD DS SD
where S means “same” and D means “different”. Technically player 2 has four options: he could also play SS and lose immediately :-)
Would your intuition be that this makes it so that neither player has a winning strategy? That perfect play would yield an infinite sequence?
>> A pattern is a sequence of pebbles repeated three times in a row.
By that logic, player 2 would have lost at their fifth turn. ... And 'in a row' is open to interpretation since it is additional information to 'repeated three times'.
EDIT: Clarify that only y is nonempty.
Could you tell us more about this? I am curious how this problem was formulated using modal logic. Seems fascinating
My brain hurts when thinking about that. How could 512 bytes be enough to store ~3 million bytes? I know that compression is basically about finding patterns and this sequences should be very compressible.
This is not exactly what happens here, but many compression algorithms work by recognising that certain substrings are very common, and give them a "shorter code". In this game, there are some quite long such strings, giving a good compression rate. Furthermore, because of the recursive nature, it can find such patterns again after the common substrings are replaced by shorter codes, because these codes again form patterns with repeated substrings. This goes on until there is almost just a bit of meta data and an "ur-pattern".
Compression is fascinating in many ways. For instance, since there are a fixed number of files of a certain size and some bigger files are made smaller, some smaller files must be made bigger by the compression! Of course, this could be as simple as attaching a header or flag which says "I could not compress this. Here is the old file verbatim." But that is still a bit longer than the original!
Precisely computing the Kolmogorov complexity of a given string could be very difficult, though. In general, it is uncomputable because we cannot decide if a given program will output a given string.
(For the initiated, I should mention that it is related to Thue–Morse sequences.)
The anti-pattern game is about extending words such that they do not contain a pattern word.
I wonder how the situation changes if 2 times repetitions would count as pattern (i.e. non-primitive words).
For primitive words, it is an open problem if the language of primitive words (over any non-trivial finite alphabet) is context free.
I wonder if the language of words that don't contain patterns (or non-primitive words) is context free.
I might be misunderstanding, but do you mean that you cannot even have two of the same colour in a row? This is a very simple win for first player:
W B W ?
0 1 0 2 0 1 2 0 1 0 2 0 2 1
but I stopped there because it gets tedious to check manually for repetition. Might be worth writing a little script to produce the word where each letter is the smallest possible number that doesn't create repetition.On p.2 they follow my idea of adding the lowest possible letter at the end, although they generalise it to adding the letter as close to the end as possible. They conjecture that this process does not stop. I'm always amazed with combinatorics how quickly you arrive at questions that no one knows the answer to.
https://gowers.wordpress.com/2013/08/23/determinacy-of-borel...
runnable version
The AI game seems to go on forever. It hasn’t found the winning strategy. Which is fine. The infinite sequences seem to be getting the most juice in the discussion here.
The short version: By representing the game coalgebraically, one can use modal logic to solve it (find a winning strategy for player 1) by brute force.
The old code looks like:
-- Modal operators
e = modal any' (Coalg possible)
a = modal all' (Coalg possible)
-- Test for winning strategy within a limited number of moves.
winning :: Integer -> Player -> State -> Bool
winning 0 _ _ = False
winning n p s = wonAlready || e (a (winning (n-1) p)) s where
wonAlready = (winner s == Just p)
We can translate this into more standard modal logic: Letting ◇ be "There is a move a player could make", and □ be any move a player makes. We define the existence of a winnning strategy for player 1 inductively: S(0) = ⊥
S(n+1) = W(p₁) ∨ ◇ □ S(n)
Intuitively, you have a winning strategy if you won already, or if there is a move you make, such that whatever move the opponent makes you, you still have a winning strategy.[0]: https://hakon.gylterud.net/programming/applicative-logic.htm...
[1]: https://github.com/typeterrorist/applicative-logic/blob/moda... – this is a branch with the modal logic operators defined.
-- Game data
data Player = P1 | P2
deriving (Eq, Show)
data Color = Red | Blue
deriving (Eq, Show)
data State = S [Color]
deriving (Eq, Show)
data Strategy = Won
| Force Color Strategy
| Choice (Color -> Strategy)
-- Modal operators
e' = modal sany' (Coalg possible')
a' = modal sall' (Coalg possible')
-- Test for winning strategy within a limited number of moves.
winning' :: Integer -> Player -> State -> Maybe Strategy
winning' 0 _ _ = Nothing
winning' n p s = wonAlready <|> (e' (a' (winning' (n-1) p)) s) where
wonAlready = if (winner s == Just p) then Just Won else Nothing