SlideShare une entreprise Scribd logo
1  sur  4
Télécharger pour lire hors ligne
3-D Tic-Tac-Toe: A Rule-Based Approach
Andrew Kennihan
PSU CSE Dept.
ask5127@psu.edu

Phil Myers
PSU CSE Dept.
prm5031@psu.edu

ABSTRACT
Tic-Tac-Toe is a popular game played throughout the world. The
most common version consists of a board with 3 X 3 dimensions.
This game is not very interesting in regards to artificial
intelligence, as it has already been solved. In a 3 X 3 game, the
second player can force a draw by playing optimally. However,
there are more interesting versions of the game with larger
dimensions that have not been solved. That is, no optimal playing
strategy has been determined. One such version is the 5 X 5 X 5
Tic-Tac-Toe game [1]. We shall hereafter refer to the 5 X 5 X 5
game as Quintic.
In this paper, we will describe a strategy for Quintic that we hope
will win a competition in our Artificial Intelligence class. We will
start out by discussing the artificial intelligence algorithm we have
chosen (rule-based expert system). We will then give a brief
overview of our research into how to apply a rule-based expert
system to a Tick-Tac-Toe game. Finally, we will describe our
rule-based expert system in detail.

Categories and Subject Descriptors
I.2.1 [Artificial Intelligence]: Applications and Expert Systems –
games.

General Terms
Algorithms

Keywords
Tic-Tac-Toe, rule-based expert system

1. INTRODUCTION
The idea for rule-based expert systems can be traced back to Allen
Newell and Herbert Simon of Carnegie Mellon. In the early
1970s, they proposed the production system model. The idea of
this model is that humans solve problems by applying their
knowledge to a given problem represented by problem-specific
information [2]. A rule-based expert system applies this idea to
computers by supplying a program with problem-specific rules to
follow. The rules in the rule-based expert system represent the
human knowledge in the production system model. When a
condition of a rule is met, an action is taken. This is how a
problem is solved in a rule-based expert system.
The three main parts of a rule-based expert system are the
knowledge base, the data base, and the inference engine. The
knowledge base is the set of rules. It is made by an expert in the
domain of the problem. The database is the set of facts that are
input into the knowledge base. The facts are normally gathered by
the user. The inference engine links the knowledge base to the
database. It allows the expert system to reach a solution to the
problem [2].

Carlton Taylor
PSU CSE Dept.
cpt5023@psu.edu

As with all artificial intelligence algorithms, there are advantages
and disadvantages to using a rule-based expert system. One
advantage is that rules have a uniform IF-THEN structure that
makes them easy to write. Also, a rule-based expert system allows
for the separation of knowledge and processing. This allows the
system to be changed easily. One disadvantage is that a rule-based
expert system does not learn [2].

2. WHY A RULE-BASED SYSTEM?
We began this project by researching the simple 3 X 3 Tic-TacToe game. As stated earlier, the optimal strategy for this game has
been defined. A player can play the optimal game by following
these rules [3]:
1. Win: If the player has two in a row, play the third to get
three in a row.
2. Block: If the opponent has two in a row, play the third
to block them.
3. Fork: Create an opportunity where you can win in two
ways.
4. Block opponent's fork:
o Option 1: Create two in a row to force the
opponent into defending, as long as it doesn't
result in them creating a fork or winning. For
example, if "X" has a corner, "O" has the
center, and "X" has the opposite corner as
well, "O" must not play a corner in order to
win. (Playing a corner in this scenario creates
a fork for "X" to win.)
o Option 2: If there is a configuration where the
opponent can fork, block that fork.
5. Center: Play the center.
6. Opposite corner: If the opponent is in the corner, play
the opposite corner.
7. Empty corner: Play in a corner square.
8. Empty side: Play in a middle square on any of the 4
sides.
These rules could easily be used in a rule-based expert system to
develop an artificial intelligence program that would play the
optimal game. So, we decided that since a rule-based expert
system is the most natural algorithm to use for 3 X 3 Tic-Tac-Toe,
it would be the most natural algorithm to use for Quintic as well.
We would just need to take the rules of the 3 X 3 game and adapt
them for Quintic.
Another reason we chose the rule-based expert system is that as
novice artificial intelligence students, we did not want to pick an
algorithm that was overly complex. Rule-based expert systems are
fairly easy to define and understand. This is in contrast to other
algorithms such as neural networks, which we found difficult to
grasp (in part because we haven’t learned about them in class yet).
3. BACKGROUND RESEARCH
3.1 Gammill
Gammill [4] discusses nk Tic-Tac-Toe games at length (in
Quintic, n = 5 and k = 3). There were several important concepts
that we took from this paper. For example, one way to evaluate
the importance of a position is to figure out the number of
winning lines that go through that position. Equation (1) gives the
number of winning lines in an nk board.
(

)

(1)
So, in Quintic there are 109 winning lines. The position through
which the most winning lines go is the center position (13 lines go
through it). This makes the center the most valuable position.
Gammill goes on to specifically focus on Qubic, which is a 4 3
game. Qubic was unsolved at the time (although it was later
solved by Patashnik [1]), just as Quintic is unsolved now. So,
Gammill’s Qubic strategies warranted our attention. Gammill
described opening, middle and end game strategies. The idea of
strategies for different parts of the game was new to us, as the 32
game is too simple for this. We included rules for the different
stages of the game.
Gammill also discusses the importance of sequences which force
winning moves. We included these sequences in our rules as
“forks”, which we shall discuss in more detail later.

3.2 Patashnik
Perhaps the most important development in the study of Tic-TacToe in recent years was the solution of Qubic by Patashnik [1].
Patashnik proved that the first player is able to force a win. He
used over 1500 hours of computer time in his proof. Patashnik did
not use a pure rule-based expert system to solve Qubic. As shown
in Figure 1, his algorithm was part brute-force search and part
rule-based, but it was nonetheless helpful. For example, we
included rules similar to “second-player three-in-a-row?”, “firstplayer forced sequence?”, and “second-player forced sequence”.
Patashnik’s paper was also important in our realization that we
could not make a rule-based system that could play the optimal
Quintic game. He lists which Tic-Tac-Toe games have been
solved, and Quintic was not one of them. So the best we could
hope for is to come up with heuristic rules that are superior to our
opponents in class.

4. DESIGN DESCRIPTION
The following is as description of our knowledge base for the
rules that we plan to implement. Before every turn begins, our
rule-based expert system must check the board to see if our player
or the opponent can potentially win on their next turn. We do this
by looking for four marked spaces in a row by one contestant and
an open space that would result in a winning combination. If this
exists, take that space to win or prevent a win.
Next, we needed to determine the value of different positions. To
Permission to make digital or hard copies of all or part of this work for
personal or classroom use is granted without fee provided that copies are
not made or distributed for profit or commercial advantage and that
copies bear this notice and the full citation on the first page. To copy
otherwise, or republish, to post on servers or to redistribute to lists,
requires prior specific permission and/or a fee.
Conference’10, Month 1–2, 2010, City, State, Country.
Copyright 2010 ACM 1-58113-000-0/00/0010…$10.00.

Figure 1. Patashnik’s algorithm [1].
achieve this, we first converted the three dimensional board into a
three dimensional array. This allowed us to visualize the board
and make it easier to observe winning lines. We then calculated
all of the 109 different winning lines that were possible, because
overlooking any lines would be devastating to our artificial
intelligence’s success [6]. We then began evaluating the game
board to determine which spaces had more opportunities to make
a winning line. We determined that the absolute middle space is
the most valuable position, as it has the most opportunities to form
a winning line at 13. The second most advantageous position on
the cube is to have the absolute corners, as they intersect 7
winning lines. The centers that are not the absolute center
intersect 5 winning lines. The non-absolute corners have 4
winning combinations.
Our rule-based expert system is designed to have three game
states; the beginning, the middle and the end. Each state is
designated by a rule. At the beginning of the game, our strategy is
to take the most valuable position as defined by the number of
winning lines intersecting the position. We don’t have to consider
the opponent’s move since at this point in the game, since the
opponent will not have made enough moves to string together a
line.
After the initial game board is set up, middle phase of the game
begins. This period is when the most strategy is involved. Both
contestants will attempt to “fork” to create an opportunity to win
with two or more different ways. Forks are generally done by
taking spaces in two intersecting rows, while not taking the
intersecting space. Finally, once both rows have three spaces
taken, the interesting space is taken. This will cause two separate
rows with four taken spaces and is essentially check-mate
[5]. This concept is extended even farther in three dimensions
because you could implement a fork with 3 intersecting rows. It
is very important that our rule-based system can fork, because it is
the only winning strategy other than hoping the opponent makes a
very poor decision.

Table 1. Database
Object

Allowed Values

strategy

win
block

Defending against a fork is even more important than attacking
with a fork. The best defense against an opponent’s fork is
finding two intersecting rows with at least two taken spaces in
each. Then, take the intersecting space. This concept is simple,
however, can be very complicated in three dimensions. For
example, the absolute center has 13 winning combinations. This
could be very difficult to block all of the different forks possible.
Our rule-based expert system must block the forking attempts of
opponents and create forks of its own. This is where things get
complicated. Our system must read the current board for a forking
possibility and continue pursuing it in following turns when not
playing defense. It also has to realize when the fork has been
blocked by the opponent and know to try again.

take_best_open_space
fork
antifork

player_state

4_in_a_row
create_fork

We have written all of this into a knowledge base. The syntax for
a user to change the rules is:
If Object is Allowed Value
Then Object is Allowed Value

continue_fork
blocking_fork
blocked_fork

This allows the user to modify, update or create new rules for the
rule-based expert system.

5. KNOWLEDGE BASE & DATABASE
The following are the rules of our knowledge base. The database
representing the objects and their allowed values is shown in table
1.

best_power_position

corner

If player_state is 4_in_a_row
Then strategy is win

in_line

game_state

beginning
middle

Rule 3:
If game_state is beginning
Then strategy is take_best_open_space
Rule 4:
If game_state is middle
And player_state is idle
Then strategy is antifork and player_state is blocking_fork

absolute_center
absolute_corner

Rule 1:

Rule 2:
If opponent_state is 4_in_a_row
Then strategy is block

idle

end

opponent_state

idle
4_in_a_row

Rule 5:
If game_state is middle
And player_state is blocked_fork
Then strategy is fork and player_state is create_fork
Rule 6:
If game_state is middle
And player_state is create_fork
Then strategy is fork and player_state is create_fork

Rule 7:
If game_state is middle
And player_state is continue_fork
Then strategy is fork
find most powerful empty position
with most open intersecting rows
choose the most powerful non end
piece (X _ _ _ X)
set player_state to continue_fork

6. PSUEDOCODE
/*Sample Program*/
initialize player_state to idle
initialize opponent state to idle
Check_game_status(){
if moveNumber is…
BEGINNING_RANGE: set game_status to
beginning
MIDDLE_RANGE:
set game_status to
middle
END_RANGE: set game_status to end
if rows or diagonals contain 4 player pieces
set player_state to 4_in_a_row
if rows or diagonals contain 4 opponent
pieces
set opponent_state to 4_in_row
}
//fire function pointers
Win(){
if player_state is 4_in_a_row
place piece in empty position in that row
else
find player’s most dangerous row
find open position in row
place piece in winning position
}
Block(){
if opponent_state is 4_in_a_row
place piece in empty position in that row
else
find opponent’s most dangerous row
find open position in row
place piece in blocking position
set player_state to idle
}
Antifork(){
if opponent owns 3 pieces in any two
intersecting rows and intersection point is
empty
place piece in intersecting position of
those two rows
set player_state to blocked_fork
else
set player_state to create_fork
fire rules
}
Fork(){
if player_state is create_fork
if player owns pieces in any two
intersecting rows and intersecting point
is empty
choose the most powerful non end
piece (X _ _ _ X)
set player_state to continue_fork
else

else if player_state is continue_fork
if opponent has piece in intersecting
rows
set player_state to create_fork
fire rules
else
if middle positions are open
place piece in most powerful middle
position in intersecting rows
else
play piece in intersecting point of
rows
set player_state to idle
else
Take_best_open_space()
}
Take_best_open_space(){
if absolute center is open
place piece in absolute center
else if absolute corner is open
place piece in absolute corner
else if corner is open
place piece in corner
else
Block()
}
We do not necessarily expect the current state of our knowledge
base, database and pseudocode to be the same as our final
product. We do hope that our work in these three topics
demonstrates that we are on the right track.

7. REFERENCES
[1]

Patashnik, O. Qubic: 4x4x4 Tic-Tac-Toe Bell. Laboratories
Mathematics Magazine, Vol. 53, No. 4 (Sep., 1980), pp. 202216

[2]

Negnevitsky, M. Artificial Intelligence: A Guide to
Intelligent Systems

[3]

Crowley, K. and Siegler, R. S. Flexible Strategy Use in
Young Children's Tic-Tac-Toe. Cognitive Science (1993)

[4] Gammill, R. An Examination of TIC-TAC-TOE like
Games. Association for Computing Machinery (1974)
[5] Pilgrim, R. TIC-TAC-TOE: Introducing Expert Systems to
Middle School Students. Association for Computing
Machinery (1995)
[6]

Paul, J. Tic-Tac-Toe in n-Dimensions. Mathematical
Association of America (1978)

Contenu connexe

Tendances

Tic tac toe game with graphics presentation
Tic  tac  toe game with graphics presentationTic  tac  toe game with graphics presentation
Tic tac toe game with graphics presentationPrionto Abdullah
 
Tic tac toe on c++ project
Tic tac toe on c++ projectTic tac toe on c++ project
Tic tac toe on c++ projectUtkarsh Aggarwal
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial IntelligenceAltafur Rahman
 
Game theory
Game theoryGame theory
Game theorygtush24
 
Intro to game theory
Intro to game theory Intro to game theory
Intro to game theory Nadav Carmel
 
Minmax Algorithm In Artificial Intelligence slides
Minmax Algorithm In Artificial Intelligence slidesMinmax Algorithm In Artificial Intelligence slides
Minmax Algorithm In Artificial Intelligence slidesSamiaAziz4
 
Game Theory - An Introduction (2009)
Game Theory - An Introduction (2009)Game Theory - An Introduction (2009)
Game Theory - An Introduction (2009)mattbentley34
 
Fun Getting into Trouble
Fun Getting into TroubleFun Getting into Trouble
Fun Getting into TroubleLorisha Riley
 
Game theory project
Game theory projectGame theory project
Game theory projectAagam Shah
 
AI Strategies for Solving Poker Texas Hold'em
AI Strategies for Solving Poker Texas Hold'emAI Strategies for Solving Poker Texas Hold'em
AI Strategies for Solving Poker Texas Hold'emGiovanni Murru
 
Game theory & Fibonacci series
Game theory & Fibonacci seriesGame theory & Fibonacci series
Game theory & Fibonacci seriesarif sulu
 
Advanced Game Theory guest lecture
Advanced Game Theory guest lectureAdvanced Game Theory guest lecture
Advanced Game Theory guest lectureJonas Heide Smith
 
Game Theory - Quantitative Analysis for Decision Making
Game Theory - Quantitative Analysis for Decision MakingGame Theory - Quantitative Analysis for Decision Making
Game Theory - Quantitative Analysis for Decision MakingIshita Bose
 

Tendances (20)

AI Lesson 07
AI Lesson 07AI Lesson 07
AI Lesson 07
 
Tic tac toe game with graphics presentation
Tic  tac  toe game with graphics presentationTic  tac  toe game with graphics presentation
Tic tac toe game with graphics presentation
 
Tic tac toe on c++ project
Tic tac toe on c++ projectTic tac toe on c++ project
Tic tac toe on c++ project
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
 
Game
Game Game
Game
 
Game theory (1)
Game theory (1)Game theory (1)
Game theory (1)
 
Game theory
Game theoryGame theory
Game theory
 
Intro to game theory
Intro to game theory Intro to game theory
Intro to game theory
 
Minmax Algorithm In Artificial Intelligence slides
Minmax Algorithm In Artificial Intelligence slidesMinmax Algorithm In Artificial Intelligence slides
Minmax Algorithm In Artificial Intelligence slides
 
Game Theory - An Introduction (2009)
Game Theory - An Introduction (2009)Game Theory - An Introduction (2009)
Game Theory - An Introduction (2009)
 
Fun Getting into Trouble
Fun Getting into TroubleFun Getting into Trouble
Fun Getting into Trouble
 
AI Lesson 08
AI Lesson 08AI Lesson 08
AI Lesson 08
 
Stratego
StrategoStratego
Stratego
 
Game theory project
Game theory projectGame theory project
Game theory project
 
Game theory
Game theoryGame theory
Game theory
 
AI Strategies for Solving Poker Texas Hold'em
AI Strategies for Solving Poker Texas Hold'emAI Strategies for Solving Poker Texas Hold'em
AI Strategies for Solving Poker Texas Hold'em
 
Game theory ppt
Game theory pptGame theory ppt
Game theory ppt
 
Game theory & Fibonacci series
Game theory & Fibonacci seriesGame theory & Fibonacci series
Game theory & Fibonacci series
 
Advanced Game Theory guest lecture
Advanced Game Theory guest lectureAdvanced Game Theory guest lecture
Advanced Game Theory guest lecture
 
Game Theory - Quantitative Analysis for Decision Making
Game Theory - Quantitative Analysis for Decision MakingGame Theory - Quantitative Analysis for Decision Making
Game Theory - Quantitative Analysis for Decision Making
 

Similaire à Rule-Based AI for 5x5x5 Tic-Tac-Toe

Optimizing search-space-of-othello-using-hybrid-approach
Optimizing search-space-of-othello-using-hybrid-approachOptimizing search-space-of-othello-using-hybrid-approach
Optimizing search-space-of-othello-using-hybrid-approachEditor IJMTER
 
The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...
The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...
The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...IJCSIS Research Publications
 
Learning to Play Complex Games
Learning to Play Complex GamesLearning to Play Complex Games
Learning to Play Complex Gamesbutest
 
An analysis of minimax search and endgame databases in evolving awale game pl...
An analysis of minimax search and endgame databases in evolving awale game pl...An analysis of minimax search and endgame databases in evolving awale game pl...
An analysis of minimax search and endgame databases in evolving awale game pl...csandit
 
AN ANALYSIS OF MINIMAX SEARCH AND ENDGAME DATABASES IN EVOLVING AWALE GAME PL...
AN ANALYSIS OF MINIMAX SEARCH AND ENDGAME DATABASES IN EVOLVING AWALE GAME PL...AN ANALYSIS OF MINIMAX SEARCH AND ENDGAME DATABASES IN EVOLVING AWALE GAME PL...
AN ANALYSIS OF MINIMAX SEARCH AND ENDGAME DATABASES IN EVOLVING AWALE GAME PL...cscpconf
 
Android application - Tic Tac Toe
Android application - Tic Tac ToeAndroid application - Tic Tac Toe
Android application - Tic Tac ToeSarthak Srivastava
 
Ssrn a brief inrtoduction to the basic of game theory
Ssrn a brief inrtoduction to the basic of game theorySsrn a brief inrtoduction to the basic of game theory
Ssrn a brief inrtoduction to the basic of game theoryYing wei (Joe) Chou
 
0-miniproject sem 4 review 1(1)(2).pptx
0-miniproject sem 4 review 1(1)(2).pptx0-miniproject sem 4 review 1(1)(2).pptx
0-miniproject sem 4 review 1(1)(2).pptxAhishektttPhm
 
Topic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).pptTopic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).pptSabrinaShanta2
 
AI_Session 13 Adversarial Search .pptx
AI_Session 13 Adversarial Search .pptxAI_Session 13 Adversarial Search .pptx
AI_Session 13 Adversarial Search .pptxAsst.prof M.Gokilavani
 
Learning to Reason in Round-based Games: Multi-task Sequence Generation for P...
Learning to Reason in Round-based Games: Multi-task Sequence Generation for P...Learning to Reason in Round-based Games: Multi-task Sequence Generation for P...
Learning to Reason in Round-based Games: Multi-task Sequence Generation for P...Deren Lei
 
Designing balance (takeaway version)
Designing balance (takeaway version)Designing balance (takeaway version)
Designing balance (takeaway version)Kacper Szymczak
 
Artificial intelligence - python
Artificial intelligence - pythonArtificial intelligence - python
Artificial intelligence - pythonSunjid Hasan
 
3.3 Game TheoryGame theory is a branch of applied mathematics, w.docx
3.3 Game TheoryGame theory is a branch of applied mathematics, w.docx3.3 Game TheoryGame theory is a branch of applied mathematics, w.docx
3.3 Game TheoryGame theory is a branch of applied mathematics, w.docxgilbertkpeters11344
 
Agile Analysis with Use Cases: Balancing Utility with Simplicity
Agile Analysis with Use Cases: Balancing Utility with SimplicityAgile Analysis with Use Cases: Balancing Utility with Simplicity
Agile Analysis with Use Cases: Balancing Utility with SimplicityTed Husted
 
AI3391 Artificial Intelligence Session 14 Adversarial Search .pptx
AI3391 Artificial Intelligence Session 14 Adversarial Search .pptxAI3391 Artificial Intelligence Session 14 Adversarial Search .pptx
AI3391 Artificial Intelligence Session 14 Adversarial Search .pptxAsst.prof M.Gokilavani
 
study material for Artificial Intelligence
study material for Artificial Intelligencestudy material for Artificial Intelligence
study material for Artificial Intelligencekarmastrike9441
 
navingameppt-191018085333.pdf
navingameppt-191018085333.pdfnavingameppt-191018085333.pdf
navingameppt-191018085333.pdfDebadattaPanda4
 
Game Theory In Operations Research
Game Theory In Operations Research Game Theory In Operations Research
Game Theory In Operations Research Chirag Lakum
 

Similaire à Rule-Based AI for 5x5x5 Tic-Tac-Toe (20)

Optimizing search-space-of-othello-using-hybrid-approach
Optimizing search-space-of-othello-using-hybrid-approachOptimizing search-space-of-othello-using-hybrid-approach
Optimizing search-space-of-othello-using-hybrid-approach
 
The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...
The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...
The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...
 
Learning to Play Complex Games
Learning to Play Complex GamesLearning to Play Complex Games
Learning to Play Complex Games
 
An analysis of minimax search and endgame databases in evolving awale game pl...
An analysis of minimax search and endgame databases in evolving awale game pl...An analysis of minimax search and endgame databases in evolving awale game pl...
An analysis of minimax search and endgame databases in evolving awale game pl...
 
AN ANALYSIS OF MINIMAX SEARCH AND ENDGAME DATABASES IN EVOLVING AWALE GAME PL...
AN ANALYSIS OF MINIMAX SEARCH AND ENDGAME DATABASES IN EVOLVING AWALE GAME PL...AN ANALYSIS OF MINIMAX SEARCH AND ENDGAME DATABASES IN EVOLVING AWALE GAME PL...
AN ANALYSIS OF MINIMAX SEARCH AND ENDGAME DATABASES IN EVOLVING AWALE GAME PL...
 
Android application - Tic Tac Toe
Android application - Tic Tac ToeAndroid application - Tic Tac Toe
Android application - Tic Tac Toe
 
Ssrn a brief inrtoduction to the basic of game theory
Ssrn a brief inrtoduction to the basic of game theorySsrn a brief inrtoduction to the basic of game theory
Ssrn a brief inrtoduction to the basic of game theory
 
0-miniproject sem 4 review 1(1)(2).pptx
0-miniproject sem 4 review 1(1)(2).pptx0-miniproject sem 4 review 1(1)(2).pptx
0-miniproject sem 4 review 1(1)(2).pptx
 
Topic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).pptTopic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).ppt
 
AI_Session 13 Adversarial Search .pptx
AI_Session 13 Adversarial Search .pptxAI_Session 13 Adversarial Search .pptx
AI_Session 13 Adversarial Search .pptx
 
Week Five, Game Design
Week Five, Game DesignWeek Five, Game Design
Week Five, Game Design
 
Learning to Reason in Round-based Games: Multi-task Sequence Generation for P...
Learning to Reason in Round-based Games: Multi-task Sequence Generation for P...Learning to Reason in Round-based Games: Multi-task Sequence Generation for P...
Learning to Reason in Round-based Games: Multi-task Sequence Generation for P...
 
Designing balance (takeaway version)
Designing balance (takeaway version)Designing balance (takeaway version)
Designing balance (takeaway version)
 
Artificial intelligence - python
Artificial intelligence - pythonArtificial intelligence - python
Artificial intelligence - python
 
3.3 Game TheoryGame theory is a branch of applied mathematics, w.docx
3.3 Game TheoryGame theory is a branch of applied mathematics, w.docx3.3 Game TheoryGame theory is a branch of applied mathematics, w.docx
3.3 Game TheoryGame theory is a branch of applied mathematics, w.docx
 
Agile Analysis with Use Cases: Balancing Utility with Simplicity
Agile Analysis with Use Cases: Balancing Utility with SimplicityAgile Analysis with Use Cases: Balancing Utility with Simplicity
Agile Analysis with Use Cases: Balancing Utility with Simplicity
 
AI3391 Artificial Intelligence Session 14 Adversarial Search .pptx
AI3391 Artificial Intelligence Session 14 Adversarial Search .pptxAI3391 Artificial Intelligence Session 14 Adversarial Search .pptx
AI3391 Artificial Intelligence Session 14 Adversarial Search .pptx
 
study material for Artificial Intelligence
study material for Artificial Intelligencestudy material for Artificial Intelligence
study material for Artificial Intelligence
 
navingameppt-191018085333.pdf
navingameppt-191018085333.pdfnavingameppt-191018085333.pdf
navingameppt-191018085333.pdf
 
Game Theory In Operations Research
Game Theory In Operations Research Game Theory In Operations Research
Game Theory In Operations Research
 

Plus de Praveen Kumar (20)

Summer2014 internship
Summer2014 internshipSummer2014 internship
Summer2014 internship
 
Summer+training 2
Summer+training 2Summer+training 2
Summer+training 2
 
Summer+training
Summer+trainingSummer+training
Summer+training
 
Solutions1.1
Solutions1.1Solutions1.1
Solutions1.1
 
Slides15
Slides15Slides15
Slides15
 
Scribed lec8
Scribed lec8Scribed lec8
Scribed lec8
 
Scholarship sc st
Scholarship sc stScholarship sc st
Scholarship sc st
 
Networks 2
Networks 2Networks 2
Networks 2
 
Mithfh lecturenotes 9
Mithfh lecturenotes 9Mithfh lecturenotes 9
Mithfh lecturenotes 9
 
Mcs student
Mcs studentMcs student
Mcs student
 
Math350 hw2solutions
Math350 hw2solutionsMath350 hw2solutions
Math350 hw2solutions
 
Matching
MatchingMatching
Matching
 
Line circle draw
Line circle drawLine circle draw
Line circle draw
 
Lecture3
Lecture3Lecture3
Lecture3
 
Lec2 state space
Lec2 state spaceLec2 state space
Lec2 state space
 
Graphtheory
GraphtheoryGraphtheory
Graphtheory
 
Graphics display-devicesmod-1
Graphics display-devicesmod-1Graphics display-devicesmod-1
Graphics display-devicesmod-1
 
Games.4
Games.4Games.4
Games.4
 
Dda line-algorithm
Dda line-algorithmDda line-algorithm
Dda line-algorithm
 
Cs344 lect15-robotic-knowledge-inferencing-prolog-11feb08
Cs344 lect15-robotic-knowledge-inferencing-prolog-11feb08Cs344 lect15-robotic-knowledge-inferencing-prolog-11feb08
Cs344 lect15-robotic-knowledge-inferencing-prolog-11feb08
 

Dernier

VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130
VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130
VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur EscortsCall Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...noor ahmed
 
Top Rated Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...
Top Rated  Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...Top Rated  Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...
Top Rated Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...Call Girls in Nagpur High Profile
 
Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...
Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...
Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...noor ahmed
 
Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448ont65320
 
Call Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
Call Girl Nashik Amaira 7001305949 Independent Escort Service NashikCall Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
Call Girl Nashik Amaira 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Call Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
Call Girl Nashik Saloni 7001305949 Independent Escort Service NashikCall Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
Call Girl Nashik Saloni 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Almora call girls 📞 8617697112 At Low Cost Cash Payment Booking
Almora call girls 📞 8617697112 At Low Cost Cash Payment BookingAlmora call girls 📞 8617697112 At Low Cost Cash Payment Booking
Almora call girls 📞 8617697112 At Low Cost Cash Payment BookingNitya salvi
 
(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...
(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...
(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...ranjana rawat
 
Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...
Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...
Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...aamir
 
Call Girls in Barasat | 7001035870 At Low Cost Cash Payment Booking
Call Girls in Barasat | 7001035870 At Low Cost Cash Payment BookingCall Girls in Barasat | 7001035870 At Low Cost Cash Payment Booking
Call Girls in Barasat | 7001035870 At Low Cost Cash Payment Bookingnoor ahmed
 
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...noor ahmed
 
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...Apsara Of India
 
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...ritikasharma
 
↑Top Model (Kolkata) Call Girls Salt Lake ⟟ 8250192130 ⟟ High Class Call Girl...
↑Top Model (Kolkata) Call Girls Salt Lake ⟟ 8250192130 ⟟ High Class Call Girl...↑Top Model (Kolkata) Call Girls Salt Lake ⟟ 8250192130 ⟟ High Class Call Girl...
↑Top Model (Kolkata) Call Girls Salt Lake ⟟ 8250192130 ⟟ High Class Call Girl...noor ahmed
 
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...noor ahmed
 
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...noor ahmed
 

Dernier (20)

VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130
VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130
VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130
 
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur EscortsCall Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
 
↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...
 
Top Rated Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...
Top Rated  Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...Top Rated  Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...
Top Rated Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...
 
Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...
Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...
Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...
 
Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448
 
Call Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
Call Girl Nashik Amaira 7001305949 Independent Escort Service NashikCall Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
Call Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
 
Call Girls New Ashok Nagar Delhi WhatsApp Number 9711199171
Call Girls New Ashok Nagar Delhi WhatsApp Number 9711199171Call Girls New Ashok Nagar Delhi WhatsApp Number 9711199171
Call Girls New Ashok Nagar Delhi WhatsApp Number 9711199171
 
Call Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
Call Girl Nashik Saloni 7001305949 Independent Escort Service NashikCall Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
Call Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
 
Almora call girls 📞 8617697112 At Low Cost Cash Payment Booking
Almora call girls 📞 8617697112 At Low Cost Cash Payment BookingAlmora call girls 📞 8617697112 At Low Cost Cash Payment Booking
Almora call girls 📞 8617697112 At Low Cost Cash Payment Booking
 
(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...
(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...
(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...
 
Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...
Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...
Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...
 
Call Girls in Barasat | 7001035870 At Low Cost Cash Payment Booking
Call Girls in Barasat | 7001035870 At Low Cost Cash Payment BookingCall Girls in Barasat | 7001035870 At Low Cost Cash Payment Booking
Call Girls in Barasat | 7001035870 At Low Cost Cash Payment Booking
 
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
 
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
 
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
 
CHEAP Call Girls in Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in  Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in  Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
↑Top Model (Kolkata) Call Girls Salt Lake ⟟ 8250192130 ⟟ High Class Call Girl...
↑Top Model (Kolkata) Call Girls Salt Lake ⟟ 8250192130 ⟟ High Class Call Girl...↑Top Model (Kolkata) Call Girls Salt Lake ⟟ 8250192130 ⟟ High Class Call Girl...
↑Top Model (Kolkata) Call Girls Salt Lake ⟟ 8250192130 ⟟ High Class Call Girl...
 
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...
 
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
 

Rule-Based AI for 5x5x5 Tic-Tac-Toe

  • 1. 3-D Tic-Tac-Toe: A Rule-Based Approach Andrew Kennihan PSU CSE Dept. ask5127@psu.edu Phil Myers PSU CSE Dept. prm5031@psu.edu ABSTRACT Tic-Tac-Toe is a popular game played throughout the world. The most common version consists of a board with 3 X 3 dimensions. This game is not very interesting in regards to artificial intelligence, as it has already been solved. In a 3 X 3 game, the second player can force a draw by playing optimally. However, there are more interesting versions of the game with larger dimensions that have not been solved. That is, no optimal playing strategy has been determined. One such version is the 5 X 5 X 5 Tic-Tac-Toe game [1]. We shall hereafter refer to the 5 X 5 X 5 game as Quintic. In this paper, we will describe a strategy for Quintic that we hope will win a competition in our Artificial Intelligence class. We will start out by discussing the artificial intelligence algorithm we have chosen (rule-based expert system). We will then give a brief overview of our research into how to apply a rule-based expert system to a Tick-Tac-Toe game. Finally, we will describe our rule-based expert system in detail. Categories and Subject Descriptors I.2.1 [Artificial Intelligence]: Applications and Expert Systems – games. General Terms Algorithms Keywords Tic-Tac-Toe, rule-based expert system 1. INTRODUCTION The idea for rule-based expert systems can be traced back to Allen Newell and Herbert Simon of Carnegie Mellon. In the early 1970s, they proposed the production system model. The idea of this model is that humans solve problems by applying their knowledge to a given problem represented by problem-specific information [2]. A rule-based expert system applies this idea to computers by supplying a program with problem-specific rules to follow. The rules in the rule-based expert system represent the human knowledge in the production system model. When a condition of a rule is met, an action is taken. This is how a problem is solved in a rule-based expert system. The three main parts of a rule-based expert system are the knowledge base, the data base, and the inference engine. The knowledge base is the set of rules. It is made by an expert in the domain of the problem. The database is the set of facts that are input into the knowledge base. The facts are normally gathered by the user. The inference engine links the knowledge base to the database. It allows the expert system to reach a solution to the problem [2]. Carlton Taylor PSU CSE Dept. cpt5023@psu.edu As with all artificial intelligence algorithms, there are advantages and disadvantages to using a rule-based expert system. One advantage is that rules have a uniform IF-THEN structure that makes them easy to write. Also, a rule-based expert system allows for the separation of knowledge and processing. This allows the system to be changed easily. One disadvantage is that a rule-based expert system does not learn [2]. 2. WHY A RULE-BASED SYSTEM? We began this project by researching the simple 3 X 3 Tic-TacToe game. As stated earlier, the optimal strategy for this game has been defined. A player can play the optimal game by following these rules [3]: 1. Win: If the player has two in a row, play the third to get three in a row. 2. Block: If the opponent has two in a row, play the third to block them. 3. Fork: Create an opportunity where you can win in two ways. 4. Block opponent's fork: o Option 1: Create two in a row to force the opponent into defending, as long as it doesn't result in them creating a fork or winning. For example, if "X" has a corner, "O" has the center, and "X" has the opposite corner as well, "O" must not play a corner in order to win. (Playing a corner in this scenario creates a fork for "X" to win.) o Option 2: If there is a configuration where the opponent can fork, block that fork. 5. Center: Play the center. 6. Opposite corner: If the opponent is in the corner, play the opposite corner. 7. Empty corner: Play in a corner square. 8. Empty side: Play in a middle square on any of the 4 sides. These rules could easily be used in a rule-based expert system to develop an artificial intelligence program that would play the optimal game. So, we decided that since a rule-based expert system is the most natural algorithm to use for 3 X 3 Tic-Tac-Toe, it would be the most natural algorithm to use for Quintic as well. We would just need to take the rules of the 3 X 3 game and adapt them for Quintic. Another reason we chose the rule-based expert system is that as novice artificial intelligence students, we did not want to pick an algorithm that was overly complex. Rule-based expert systems are fairly easy to define and understand. This is in contrast to other algorithms such as neural networks, which we found difficult to grasp (in part because we haven’t learned about them in class yet).
  • 2. 3. BACKGROUND RESEARCH 3.1 Gammill Gammill [4] discusses nk Tic-Tac-Toe games at length (in Quintic, n = 5 and k = 3). There were several important concepts that we took from this paper. For example, one way to evaluate the importance of a position is to figure out the number of winning lines that go through that position. Equation (1) gives the number of winning lines in an nk board. ( ) (1) So, in Quintic there are 109 winning lines. The position through which the most winning lines go is the center position (13 lines go through it). This makes the center the most valuable position. Gammill goes on to specifically focus on Qubic, which is a 4 3 game. Qubic was unsolved at the time (although it was later solved by Patashnik [1]), just as Quintic is unsolved now. So, Gammill’s Qubic strategies warranted our attention. Gammill described opening, middle and end game strategies. The idea of strategies for different parts of the game was new to us, as the 32 game is too simple for this. We included rules for the different stages of the game. Gammill also discusses the importance of sequences which force winning moves. We included these sequences in our rules as “forks”, which we shall discuss in more detail later. 3.2 Patashnik Perhaps the most important development in the study of Tic-TacToe in recent years was the solution of Qubic by Patashnik [1]. Patashnik proved that the first player is able to force a win. He used over 1500 hours of computer time in his proof. Patashnik did not use a pure rule-based expert system to solve Qubic. As shown in Figure 1, his algorithm was part brute-force search and part rule-based, but it was nonetheless helpful. For example, we included rules similar to “second-player three-in-a-row?”, “firstplayer forced sequence?”, and “second-player forced sequence”. Patashnik’s paper was also important in our realization that we could not make a rule-based system that could play the optimal Quintic game. He lists which Tic-Tac-Toe games have been solved, and Quintic was not one of them. So the best we could hope for is to come up with heuristic rules that are superior to our opponents in class. 4. DESIGN DESCRIPTION The following is as description of our knowledge base for the rules that we plan to implement. Before every turn begins, our rule-based expert system must check the board to see if our player or the opponent can potentially win on their next turn. We do this by looking for four marked spaces in a row by one contestant and an open space that would result in a winning combination. If this exists, take that space to win or prevent a win. Next, we needed to determine the value of different positions. To Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Conference’10, Month 1–2, 2010, City, State, Country. Copyright 2010 ACM 1-58113-000-0/00/0010…$10.00. Figure 1. Patashnik’s algorithm [1]. achieve this, we first converted the three dimensional board into a three dimensional array. This allowed us to visualize the board and make it easier to observe winning lines. We then calculated all of the 109 different winning lines that were possible, because overlooking any lines would be devastating to our artificial intelligence’s success [6]. We then began evaluating the game board to determine which spaces had more opportunities to make a winning line. We determined that the absolute middle space is the most valuable position, as it has the most opportunities to form a winning line at 13. The second most advantageous position on the cube is to have the absolute corners, as they intersect 7 winning lines. The centers that are not the absolute center intersect 5 winning lines. The non-absolute corners have 4 winning combinations. Our rule-based expert system is designed to have three game states; the beginning, the middle and the end. Each state is designated by a rule. At the beginning of the game, our strategy is to take the most valuable position as defined by the number of winning lines intersecting the position. We don’t have to consider the opponent’s move since at this point in the game, since the opponent will not have made enough moves to string together a line. After the initial game board is set up, middle phase of the game begins. This period is when the most strategy is involved. Both contestants will attempt to “fork” to create an opportunity to win with two or more different ways. Forks are generally done by taking spaces in two intersecting rows, while not taking the intersecting space. Finally, once both rows have three spaces
  • 3. taken, the interesting space is taken. This will cause two separate rows with four taken spaces and is essentially check-mate [5]. This concept is extended even farther in three dimensions because you could implement a fork with 3 intersecting rows. It is very important that our rule-based system can fork, because it is the only winning strategy other than hoping the opponent makes a very poor decision. Table 1. Database Object Allowed Values strategy win block Defending against a fork is even more important than attacking with a fork. The best defense against an opponent’s fork is finding two intersecting rows with at least two taken spaces in each. Then, take the intersecting space. This concept is simple, however, can be very complicated in three dimensions. For example, the absolute center has 13 winning combinations. This could be very difficult to block all of the different forks possible. Our rule-based expert system must block the forking attempts of opponents and create forks of its own. This is where things get complicated. Our system must read the current board for a forking possibility and continue pursuing it in following turns when not playing defense. It also has to realize when the fork has been blocked by the opponent and know to try again. take_best_open_space fork antifork player_state 4_in_a_row create_fork We have written all of this into a knowledge base. The syntax for a user to change the rules is: If Object is Allowed Value Then Object is Allowed Value continue_fork blocking_fork blocked_fork This allows the user to modify, update or create new rules for the rule-based expert system. 5. KNOWLEDGE BASE & DATABASE The following are the rules of our knowledge base. The database representing the objects and their allowed values is shown in table 1. best_power_position corner If player_state is 4_in_a_row Then strategy is win in_line game_state beginning middle Rule 3: If game_state is beginning Then strategy is take_best_open_space Rule 4: If game_state is middle And player_state is idle Then strategy is antifork and player_state is blocking_fork absolute_center absolute_corner Rule 1: Rule 2: If opponent_state is 4_in_a_row Then strategy is block idle end opponent_state idle 4_in_a_row Rule 5: If game_state is middle And player_state is blocked_fork Then strategy is fork and player_state is create_fork Rule 6: If game_state is middle And player_state is create_fork Then strategy is fork and player_state is create_fork Rule 7: If game_state is middle And player_state is continue_fork Then strategy is fork
  • 4. find most powerful empty position with most open intersecting rows choose the most powerful non end piece (X _ _ _ X) set player_state to continue_fork 6. PSUEDOCODE /*Sample Program*/ initialize player_state to idle initialize opponent state to idle Check_game_status(){ if moveNumber is… BEGINNING_RANGE: set game_status to beginning MIDDLE_RANGE: set game_status to middle END_RANGE: set game_status to end if rows or diagonals contain 4 player pieces set player_state to 4_in_a_row if rows or diagonals contain 4 opponent pieces set opponent_state to 4_in_row } //fire function pointers Win(){ if player_state is 4_in_a_row place piece in empty position in that row else find player’s most dangerous row find open position in row place piece in winning position } Block(){ if opponent_state is 4_in_a_row place piece in empty position in that row else find opponent’s most dangerous row find open position in row place piece in blocking position set player_state to idle } Antifork(){ if opponent owns 3 pieces in any two intersecting rows and intersection point is empty place piece in intersecting position of those two rows set player_state to blocked_fork else set player_state to create_fork fire rules } Fork(){ if player_state is create_fork if player owns pieces in any two intersecting rows and intersecting point is empty choose the most powerful non end piece (X _ _ _ X) set player_state to continue_fork else else if player_state is continue_fork if opponent has piece in intersecting rows set player_state to create_fork fire rules else if middle positions are open place piece in most powerful middle position in intersecting rows else play piece in intersecting point of rows set player_state to idle else Take_best_open_space() } Take_best_open_space(){ if absolute center is open place piece in absolute center else if absolute corner is open place piece in absolute corner else if corner is open place piece in corner else Block() } We do not necessarily expect the current state of our knowledge base, database and pseudocode to be the same as our final product. We do hope that our work in these three topics demonstrates that we are on the right track. 7. REFERENCES [1] Patashnik, O. Qubic: 4x4x4 Tic-Tac-Toe Bell. Laboratories Mathematics Magazine, Vol. 53, No. 4 (Sep., 1980), pp. 202216 [2] Negnevitsky, M. Artificial Intelligence: A Guide to Intelligent Systems [3] Crowley, K. and Siegler, R. S. Flexible Strategy Use in Young Children's Tic-Tac-Toe. Cognitive Science (1993) [4] Gammill, R. An Examination of TIC-TAC-TOE like Games. Association for Computing Machinery (1974) [5] Pilgrim, R. TIC-TAC-TOE: Introducing Expert Systems to Middle School Students. Association for Computing Machinery (1995) [6] Paul, J. Tic-Tac-Toe in n-Dimensions. Mathematical Association of America (1978)