|
Pattern Deduction AI in Connect Four in 2 Moves 2024-09-08: An AI trying to do it the Human way - Patterns re1ppp and re0ppp
The automated pattern deduction for connect four in 1 move is done. Next up in this article is discovery and automation of the pattern deduction for connect four in 2 moves. See the following link for the connect 4 in 1 move Tumia article and some other relevant information:
http://tumia.org/en/directory/en/instance.php?tiname=
Pattern%20Deduction%20AI%20in%20Connect%20Four%202023-09-21:
%20An%20AI%20trying%20to%20do%20it%20the%20Human%20way-Pattern%20re0ppp
&tiname_sel=&relationship=All&drsid=0&pisid=0&tiname_dno=1&page=1
See this link for the automated pattern deduction for connect four in 1 move:
http://tumia.org/en/directory/en/instance.php?tiname=
Pattern%20Deduction:%20Connect%204%20in%201%20Move
&relationship=All&drsid=0&pisid=0&page=1
See this link for the currently ongoing objectoriented programming for automating the pattern deduction for connect four in 2 moves:
http://tumia.org/en/directory/en/instance.php?tiname=
Pattern%20Deduction:%20Connect%204%20in%202%20Moves
&tiname_sel=&relationship=All&drsid=0&pisid=0&tiname_dno=1&page=1
According to the human intelligence elaborations of my own brain the above pattern deduction 4 in 2 moves results in the three pattern sets (psets) below each of them implying a win in 2 moves. A pattern set (pset) is a cohesive set of patterns realising a win in x moves. A standalone pset is a pset that does not depend on extra conditions for all the remaining columns of the board. The first two psets below are standalone. The third one not. This is an all columns pset.
There exist two main paths for deducing standalone psets going from connects 4 in 1 to connects 4 in 2 (1->2 winning moves) and for 3->4 winning moves, 5->6 winning moves and so on. In other words two main paths for deducing the standalone psets for connects 4 in 2 from the psets of connects 4 in 1. 4 in 1 has only one pset namely re0ppp.
The first path is combining two psets from 4 in 1, two psets that have at least two active positions (re0 in case of re0ppp) different from eachother (two different positions the opponent has to defend upon by moving on it). This is a fork. The opponent can only defend on one active position leaving one winning pset (re0ppp) for the player to connect four in 1. This first path coresponds with pset 2.1 below.
The second path is combining two psets from 4 in 1, two psets that have two active positions (re0 of re0ppp) sharing the same (active) column, thus a top re on top of a sub re in the same column (the same active column the opponent has to defend upon by moving on it). This opponents move will transform the two psets and has to transform them in such a way it creates a winning pset (re0ppp) for 4 in 1. The sub re is an re0 from a re0ppp. The top re must then, by game definition, be an re1 from a re1ppp. If the opponent does not defend on the active column he simply leaves the re0ppp untransformed for the player to win in 1 move. If the oppponent defends on the active column he destroys the re0ppp but transforms re1ppp into re0ppp leaving this re0ppp for the player to win in 1 move. This second path coresponds with pset 2.2 below.
Standalone Pset 2.1
There exists on the game matrix at least two re0ppp patterns of which the x coordinate of their empty position is different from eachother. Rotatable means the one empty position of the pattern could occupy any position in the pattern, thus: eppp, pepp, ppep and pppe. The one re0ppp pattern forces the opponent to play its empty x leaving the other re0ppp pattern for the player to win. See these examples of two such combined re0ppp patterns with screenshot further down:
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SEEPPPEEEEESEEEEEESEEEEEEEEEEEEEEEEEEEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SPSSPPPEPPPESEESSEEEEEESEEEEEEEEEEEEEEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SEPPPSSPESEEPPSESEEEPPEEEEESEEEEEESEEEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SEESPSSEEEPPSSEEESPPEEEEPEPEEEEPEEEEEESEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SSPSPSSEESSPPEEEPSSPEEEEPPSEEEESPSEEEEPEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SSPSSPSSPSPSSSPPESSPPPPEPPSPESESPPSESEEESPE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SSSSPSPEPPPSSSEEESPPSEEEPEPPEEEPESEEEEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SPSPSSSPSEPSSSPPEPPSPPPESPPSSEEPESSPEEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SEPPPSSSESEEPEEESEEPEEEEEEPEEEEEEEEEEEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SPSPSSEEPSPSEEEPEPEEEEEEEEEEEEEEEEEEEEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SSSSPEEEPSSPEEEEPPPEEEEEEEEEEEEEEEEEEEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SPSSPSPESSSPEEEPEPPEEEEEEEEEEEEEEEEEEEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SPSPPPSSPSSSPPSPPPESPPSSPEPSEPSSEPSESPSEPSE
&relationship=All&drsid=0&pisid=0&page=1
Twitter:
https://x.com/nesta_red/status/1877267352464568741
Standalone Pset 2.2
There exists a re1ppp on top of a re0ppp pattern. The latter means the x coordinates of their (rotatable) empty position are the same. Similar to re0ppp, re1ppp is a pattern of four in a row except one empty rotatable position with in the re1ppp pattern one extra empty position below the empty rotatable position. The re0ppp pattern forces the opponent to move on that x and doing so transforms the re1ppp pattern into a re0ppp pattern enabling the player to win. See these examples of two such combined patterns with screenshot further down:
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SESPPSPPEPSSPSEESSPPPEEPSSPSEEEPPSEEEESSPEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SPSSEPPPPPPESEESSEEEEEESEEEEEEEEEEEEEEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SEESPSEEEEPPPEEEEEPSEEEEESPEEEEESEEEEEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SSPSPSSSPSSPSSSPESSPPSPEPPSSPSEPEPPSSEEEPPP
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SSPSSPSSPSPSSSPPESSPPEPEPPSPESEEPPSESEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SSSSPSPEPPPSSSEEESEPSEEEPEPPEEEPESPEEEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SSSPPPSSEESSPEEEEPPPEEEEEPSEEEEESPEEEEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:PPSSPSPPSEPSSSPPEPPPSPPEPESSSEESEEPEEESEESE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SPSSPSPPSEPSSSPPEPPPSPEEPPSSSEESEEPEEEEEESE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SSSSPEEEPSSPEEESPPPEEEEEPEEEEEEEEEEEEEEEEEE
&relationship=All&drsid=0&pisid=0&page=1
Twitter:
https://x.com/nesta_red/status/1878866768233709715
All Columns Pset 2.3
All columns are or closed (full of disks) or have a re1ppp pattern. The latter means the x coordinate of the empty position of re1ppp corresponds with x of the open column. The opponent must play one of those open columns with re1ppp and doing so transforms the re1ppp pattern into a re0ppp pattern enabling the player to win. See these two examples (with 1 open column and with 2 open columns) with screenshots further down:
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SSSPPSPSPPSSPEPSSSPPESPPSSPEPSSPPSESPPSSPEP
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:PSPSSSPPPPSPPSSESPSSPPESSPPESEPSSSEPESPPPES
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SSPSSSPPPPSPPSSPPPSSPPSSSPPSSSSPSSPEPSSPPPE
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:PSSPSPSPPPSSSPPESPPSPPEPSPPSSEPPSSPPESSSPSS
&relationship=All&drsid=0&pisid=0&page=1
https://www.tumia.org/en/directory/en/instance.php?tiname=
Connect%20Four:SPSPPPSSPSSEPPSPPPESPESSPEPSEPSSEPSESPSEPSE
&relationship=All&drsid=0&pisid=0&page=1
Twitter:
https://x.com/nesta_red/status/1880142440570683879
https://tumia.org/en/directory/en/instance.php?tiname=
Pattern%20Deduction:%20Connect%204%20in%202%20Moves
&tiname_sel=&relationship=All&drsid=0&pisid=0&tiname_dno=1&page=1
I'm kinda stuck with the pattern deduction for 4 in 2 moves (see above link to the automated pattern deduction) at step 2 and 3. If I simply continue with the pattern deduction strategy used for 4 in 1 move I'll deduce case 3 above, but not the two other cases. Also very relevant to further deductions and for being stuck at step 2-3 is the fact that the impact of a move on a pattern with a rotatable empty position like re0ppp is fundamentally different if x of the move equals x of the empty position of the pattern versus it differs:
- If it equals the pattern is transformed. For example re0ppp is transformed into pppp in case the p player makes the move and the pattern is destroyed if the opponent makes the move.
- If x move differs from x empty the pattern remains unchanged. For example re0ppp remains re0ppp.
Because of the above I'll introduce a variable rex (x of the rotatable empty position) into the predefined pattern function re0ppp(player) for it to become re0ppp(player, rex). Of course I'll incorporate rex into the equivalance definition of the pattern. This way, when using the pattern in a deduction, rex of the pattern can be bound to certain conditions outside the pattern solving the issues mentioned in the above paragraph. Furthermore I'll do some deductions for the impact of moves on patterns with rotatable empty positions to enable reuse of those deduced pattern functions in the main deductions for 4 in 1, 2, 3, ... moves.
The different impact types (transformation or unchanged) on patterns and the fact that the opponent player can play only one x in a move indicate that the ∀ xMove construct of the opponent player can also be satisfied with the following two constructs:
- Ǝ two different rex of a pattern
- Ǝ one rex of two patterns (on top of eachother)
So the AI will have to introduce into (expand) the main deductions (with) those two constructions as two more ways to satisfy the ∀ xMove construct. I wonder how the AI would ever come to that conclusion by itself? Also how to deduce or mathematically proof that conclusion?
Furthermore keeping the depth of the rotatable empty position (for example in re0ppp, re1ppp, ... the depth is 0, 1, ...) in the pattern name will lead to many similar pattern function definitions, one for each depth, and to lack of reuse. Therefore the depth will be taken out of the pattern name and added as the variable red (rotatable empty position depth) to the pattern function. As such we get reppp(player, red, rex). As such the former re0ppp(player) and re1ppp(player) correspond with the new reppp(player, 0, rex) and reppp(player, 1, rex).
Finally lets not neglect the opponent of the player. For the player to win in 2 moves the opponent must not be able to win in 1 move. Thus the deduction must also result in reppp(opponent(player), 0, rex) being false.
"Pattern Deduction AI in Connect Four in 2 Moves 2024-09-08: An AI trying to do it the Human way - Patterns re1ppp and re0ppp” was written by Paka Small – 2024/09/08.
|
|
|
|