An Artificial Intelligence Approach to the Game of Backgammon
Total Page:16
File Type:pdf, Size:1020Kb
Rochester Institute of Technology RIT Scholar Works Theses 1-1-1983 An Artificial Intelligence Approach to the Game of Backgammon Chang-Chung Yang Follow this and additional works at: https://scholarworks.rit.edu/theses Recommended Citation Yang, Chang-Chung, "An Artificial Intelligence Approach to the Game of Backgammon" (1983). Thesis. Rochester Institute of Technology. Accessed from This Thesis is brought to you for free and open access by RIT Scholar Works. It has been accepted for inclusion in Theses by an authorized administrator of RIT Scholar Works. For more information, please contact [email protected]. Rochester Institute of 7echnology Colle~e of Applied Science and Technology AN ARTIFICIAL I~TEIIIGENCE APPiOACH TO THE GAME OF EACKGAM~ON A thesis sut~itted in partial fulfillment of the Mister of Science in Co~puter Science Degree Program ty CEANG-CBUNG YANG A~Frcved ty: January, 1983 1 ACKNO~LEDGEMENTS I would like to thank my thesis advisor, Mr. Al Eiles, for the directing nd leading me on this project. I woild also like to thank Dr. Peter Lutz or the time he has spent as a ~ember of my committee. I would like to th- nH Mr. ~arren Carithers for the suggestion and encouragement. linal11, I ould like tc thamk my wife, Joy, for her help and support durinr the evolu ion of this kroject. Chang-Chung Yang I prefer to be contacted each time a request for reproduction is made. I can bE reached a t the following addre ss. _26_c2. __ ~~i? _-b_:'::::'"- __ 1.r_. __ R. ~~ye Y(Yf'P J:: TABLE OF CONTENTS 1. INTRODUCTION AND OVERVIEW 1.1. OVERVIEW 4 1.2. INTRODUCTION 5 1.3. DESCRIPTION 01 THE GAME OF BACKGAMMON 8 2. THE HISTORY CF COMPUTER GAME DEVELOPMENT 2.1. GENERAL DESCRIPTION 12 2.2. 1950 - 1959 12 2.3. I960 - 1969 16 2.4. 197e - PRESENT 18 3. GAME MANAGEMENT PROGRAM 3.1. GENERAL DESCRIPTION 21 3.2. DATA STRUCTURES 22 3.3. BASIC ALGORITHM 25 3.4. USER INTERFACE 26 3.5. SYSTEM FILES 28 3.6. MOVES VERIFICATION ROUTINES 29 3.7 MOVES GENERATORS ROUTINES 30 4. DECISION MAKING 4.1. GENERAL DESCRIPTION 32 4.2. EVALUATION FUNCTION 34 4.3. STRATEGIES AND THEIR CONSTITUENT TERMS 36 5. LEARNING AND IMPROVING 5.1. GENERAL DESCRIPTION 43 5.2. FAST LEARNING 44 TABLE OF CONTENTS 5.3. LEARNING ALGORITHM 45 5.4. APPROXIMATE LEARNING TIMES 49 6. PROGRAM PERFORMANCE 6.1. GENERAL DESCRIPTION 50 6.2. FIRST EXAMPLE 52 6.3. SECOND EXAMPLE 56 7. CONCLUSION AND FUTURE EXTENSIONS 7.1. CONCLUSIONS 65 7.2. WHEN TO OFFER OR ACCEPT DOUBLE 66 7.3. MORE STRATEGIES AND MCRE TERMS 67 7.4. COMBINE LOOK AHEAD METHOD INTO THIS PROGRAM 68 7.5. GENERATING STRATEGIES AND TERMS BY PROGRAM 69 CHAPTER 1 INTRODUCTION AND OVERVIEW 1.1. OVERVIEW We have designed a "backgammon program to play intelligent games. It can make good decisions of the moves of its checkers. It also can learn from its past experience. This thesis descrites how this program works . This thesis is divided into seven chapters. Chapter one gives some "background in Artificial Intelligence and the tackgammcn game. Chapter two summarizes the history of the last 30 years of computer game playing hy some well-known researchers in A.I. field. Chapter three "briefly descrites the overview of this backgammon pro gram, including the basic playing, input, move verifica tion, output, game starting and terminating, and move generation routines. Chapter four describes implementa tion & performance of the multiple linear polynomials decision-making algorithm that was used in this project. This chapter also discusses different strategies and the scoring terms that were used in the strategy polynomi als. Chapter five describes the fast learning algorithm that was used, and how it improved the performance of INTRODUCTION AND OVERVIEW INTRODUCTION AND OVERVIEW the program. Chapter six gives sample games that the program played with a few human competitors and also analyzes the program's performance. Chapter seven discusses some future developments, extensions of the program, and the conclusions that we have from the result the project. ! INTRODUCTION One question that has arisen since the advent of computers is, "does a computer do exactly what it is ?" told to do and no more [SIMO 60] . In an attempt to address this question, Herbert Simon has stated: "This statement is intuitively obvious, indutitably true, and supports none of the implications that are commonly drawn from it. A human teing can think, learn, and create because the program his biological endowment gives him, together with the changes in that program produced by interaction with his environment after birth, enables him to think, learn, and create. If a computer thinks, learns, and creates, it will be by vir tue cf a program that endows it with these capacities. Clearly this will not te a program - any more than the human's is - that calls for highly stereotyped aDd repetitive behavior independent of the stimuli coming from the environment and the task to te completed. It "will be a program that makes the system's behavior THESIS page 5 JANUARY 1963 INTRODUCTION AND OVERVIEW highly conditional on the task environment - on the task goals and on the clues extracted from the environment that indicate whether progress is being made toward these goals. It will be a program that analyzes, by some means, its own performance, diagnoses its failure, and makes changes that enable its future eff [SIMO 60]. It is also wrong to conclude that the "intelli of a computer program cannot exceed that of its human programmer. The potential cf Artificial Intelli gence in computer field is the reason that this young field has advanced so rapidly in the last 30 years. The dream of A.I. people is that in the near future, machine intelligence will be able to solve problems which are currently impossible for human intelligence [FELL 63] . A favorite area of research in Artificial Intelli gence is computer programs that play games. Why should one te interested in game playing? Here are some rea sons : Real life problems usually are perceived in such a vague manner that they are hard to express in a way acceptable to a computer. Because many of the factors involved are nonnumeric in nature, they cannot be stated precisely by those techniques of mathematics which TBESIS page 6 JANUARY 19S3 INTRODUCTION AND OVERVIEW depend on actual numbers for their exposition. Also, the definitions of terms used in describing real prob lems are not always understood precisely enough. Early A.I. researchers (Newell, Shaw & Simon, 1958) recognized that games were precise and well formulated and had some of the important characteristics of real problems. They were mostly nonnumeric in nature, and their behavior was sufficiently unpredictable to be net immediately amenable to known mathematical or data pro cessing techniques. Therefore, it was hoped that as pro grams were built could learn how to solve games, the knowledge gained could te transferred tc real problems. It was also hoped that in the process one would gain insight into the problem solving process [BANE 80] . Besides the first two purposes for studying games, another reason is that it provides a direct contest between man's wit and machine's wit. In short, game environments are very useful task environments for studying the nature and structure of complex protlem- solving processes. The purpose of this thesis is tc investigate and implement several theories of Artificial Intelligence using a backgammon game program. This program is able to learn from past experience, make reasonable moves, THESIS page 7 JANUARY 19S3 INTRODUCTION AND OVERVIEW detect all illegal moves made by either players, etc. Its performance can be put on the expert level among backgammon players. 1.3. DESCRIPTION QF THE GAME OF BACKGAMMON Backgammon's history dates back to ancient Sumer, making it one of the oldest games in existence. It was played in one form or another in ancient Egypt, Greece, Rome, Persia, India, China, Japan, Mexico and North America. More recently, it has been played throughout the Eastern and Western worlds, making it one of man's favorite intellectual diversions. It is an ancient and fascinating game, a gambling game which requires both luck and skill. With a single roll of the dice, a win ning position can crumble or a seemingly hopeless posi tion can be salvaged. Luck keeps the game interesting, but skillful play always will be rewarded. Backgammon is actually a game of great strategic richness and subtlety which must be studied to be fully appreciated. Eackgammon is a dice-and-board game for two players. Each player begins the game with fifteen check- *" ers of a different color from his opponent's, a pair of dice, a dice cup, and a doubling cube. Players move their checkers around the board according to the roll of the dice. The first player to get all of his checkers THESIS page S JANUARY 1983 INTRODUCTION AND OVERVIEW around and finally off the board is the winner. In this thesis, the program will be referred to as X, and the human competitor will te referred to as 0 (opponent). The starting hoard position is as follows: X's BAR point X's midpoint O's inner board O's outer board 0123456 789 10 11 12 25 24 23 22 21 20 19 18 17 16 15 14 13 X's inner board X's outer board O's BAR point O's midpoint FIG 1.1 CHECKERS' THE INITIAL EOARD DISTRIBUTION The board consists of 24 triangles called points and is divided into four quadrants, inner and outer TBISIS page 9 JANUARY 1983 INTRODUCTION AND OVERVIEW board for each player (figure 1.1).