26
Intelligent Pool Decision System Using Zero-Order Sugeno Fuzzy System SHING CHYI CHUA, ENG KIONG WONG and VOON CHET KOO Faculty of Engineering & Technology, Multimedia University, Bukit Beruang, 75450 Melaka, Malaysia; . e-mail: [email protected] (Received: 8 October 2004; in final form: 16 June 2005) Abstract. This paper describes the approach of using the zero-order Sugeno fuzzy system to design an intelligent decision system for a game of pool. The decision system consists of three types of playing strategies for a normal game of pool: direct, combination and bank shots. For each of the playing scenario on the pool table, the decision system comes out with one output shot (or best shot): presenting which ball should be chosen and which path should it follow. The system has been tested step-by-step on a real pool game and results are tabulated in the paper. The decision is designed as the brain for a robotic pool system. Key words: intelligent decision system, pool game, zero-order Sugeno fuzzy system. 1. Introduction Pool is a well known game to all of us. Many online games feature it as a pastime entertainment for the web-surfers and game-savvies. It is a game that requires very precise geometry for aiming the shot and good strategy for final victory. The physics of the balls and cue as well as the pool table together with the human interactions have made it an interesting model to implement an intelligent pool system. Target (or object) ball and path determination in a game of pool are of extreme important to a human player. Once the right target ball is chosen by carefully analyzing the distribution of the balls on the table, a player can thus execute a shot easily with the least difficulty by traversing the chosen path. If the Fwrong_ ball is chosen (not the best one), the chance of sinking the object ball would probably be low. Although an expert pool player might proof well in any circumstances regardless of the object ball’s position, minimizing the chance of choosing the wrong ball is still, by far, a safer way, and also much reliable if one is playing against an opponent of equal strength or better. Very little works in this area of games are found in literatures. Related works in pool sports can be found in [1Y6]. Most of these articles focused on the design of the hardware system [1, 3, 5, 6], thus, did not present a full detail on the intelligence at how a shot is being selected for execution. For example, a robotic pool player consisting of a simple 2 degree-of-freedom manipulator and sensors Journal of Intelligent and Robotic Systems (2005) 44: 161–186 # Springer 2006 DOI: 10.1007/s10846-005-9009-1

Intelligent Pool Decision System Using Zero-Order Sugeno Fuzzy System

  • Upload
    mmu-my

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Intelligent Pool Decision System Using Zero-Order

Sugeno Fuzzy System

SHING CHYI CHUA, ENG KIONG WONG and VOON CHET KOOFaculty of Engineering & Technology, Multimedia University, Bukit Beruang,

75450 Melaka, Malaysia;. e-mail: [email protected]

(Received: 8 October 2004; in final form: 16 June 2005)

Abstract. This paper describes the approach of using the zero-order Sugeno fuzzy system to

design an intelligent decision system for a game of pool. The decision system consists of three

types of playing strategies for a normal game of pool: direct, combination and bank shots. For each

of the playing scenario on the pool table, the decision system comes out with one output shot (or

best shot): presenting which ball should be chosen and which path should it follow. The system has

been tested step-by-step on a real pool game and results are tabulated in the paper. The decision is

designed as the brain for a robotic pool system.

Key words: intelligent decision system, pool game, zero-order Sugeno fuzzy system.

1. Introduction

Pool is a well known game to all of us. Many online games feature it as a pastime

entertainment for the web-surfers and game-savvies. It is a game that requires

very precise geometry for aiming the shot and good strategy for final victory. The

physics of the balls and cue as well as the pool table together with the human

interactions have made it an interesting model to implement an intelligent pool

system. Target (or object) ball and path determination in a game of pool are of

extreme important to a human player. Once the right target ball is chosen by

carefully analyzing the distribution of the balls on the table, a player can thus

execute a shot easily with the least difficulty by traversing the chosen path. If the

Fwrong_ ball is chosen (not the best one), the chance of sinking the object ball

would probably be low. Although an expert pool player might proof well in any

circumstances regardless of the object ball’s position, minimizing the chance of

choosing the wrong ball is still, by far, a safer way, and also much reliable if one

is playing against an opponent of equal strength or better.

Very little works in this area of games are found in literatures. Related works in

pool sports can be found in [1Y6]. Most of these articles focused on the design of

the hardware system [1, 3, 5, 6], thus, did not present a full detail on the

intelligence at how a shot is being selected for execution. For example, a robotic

pool player consisting of a simple 2 degree-of-freedom manipulator and sensors

Journal of Intelligent and Robotic Systems (2005) 44: 161–186 # Springer 2006DOI: 10.1007/s10846-005-9009-1

was developed [1]. The sensors provided the feedback to the pool robot and

worked with the manipulator when executing a shot. A camera was mounted

above the table and vision system was used to determine the position of the ball

on the table. Nevertheless, no intelligence was reported on how a shot was

chosen. On the other hand, Richmond and Green [5] focused mainly on the

hardware system and image processing capability for identifying the bumpers,

balls and pockets of a pool table, but the strategy of the shot was not determined,

rather, it was user-selected based on the image processing results. Fei Long et al.

[6] reported on the experiment of a gantry robotic system in automatic potting.

The authors believed that higher level planning and strategy were greatly

influenced by the lower level sensing and actuation systems. A measurement

technique was developed to accurately position the end-effector before a shot was

made. No strategy was developed in choosing a shot as the cue ball was placed

manually on the table at different positions in order to determine the accuracy to

each pocket. Larsen et al. [3] reported a different approach to the formers, in

which a multi-modal system utilizing spoken interaction combined with a

graphical output and a computer controlled laser pointer for user communication

for pool training. The system issued instructions on how to place the balls on the

table, showed the optimal shot, recorded and evaluated the performance of the

player. It was a training system especially useful for beginners in pool game, thus

the shot chosen was predefined in each of the training exercises.

As much as a reliable and robust robotic platform would guarantee the success

of potting a ball, the intelligent support of the system is as equally important. The

intelligent system would provide a suitable strategy or the best way in potting a

shot among many possible solutions which are difficult to decide even for a

human player. The decision for choosing a shot based on the ball distributions on

the pool table was mainly presented using mathematical formulations. Mathe-

matics based on the geometry of the shot has been used in [2] (angle), and [4]

(angle and distances) to decide on the shot. In this paper, fuzzy logic (a high

level intelligence) is used to solve the problem of choosing a shot in a pool game.

No work is reported by using the fuzzy logic approach in solving the ball/path

selection: a shot that is chosen would consist of one or more balls and the path

that it travels. By using fuzzy logic, the fuzziness of each possible shot on the

pool table, is being evaluated. In the fuzzy system, each shot being evaluated is

bounded in the range [0,1], making it easier for selection criteria.

Contributions of this paper include:

1. Using the zero-order Sugeno fuzzy inference system in the selection of a shot

in a pool game using three parameters: one as angle, and two as distances.

2. Detail steps in the design of the system that consists of three main playing

styles: direct, combination, and bank shots.

3. Detailed results of different game configuration cases and advices for a real

game.

162 S. C. CHUA ET AL.

2. Geometry Analysis

2.1. GEOMETRY OF A SHOT

In order to estimate the difficulty of a shot on the pool table, there are three main

parameters to be considered:

(1) the distance traveled by the cue ball before the collision with the object ball,

denoted as dco,

(2) the distance from the object ball to the pocket, denoted as dop, and

(3) the angle between the line joining both the distances (in 1 and 2), denoted as

�, as illustrated in Figure 1.

If � e 90-, the shot is infeasible and should be rejected. This is due to the fact

that at such a condition, an attempt to sink the object ball into the pocket is never

possible. If � $ 90-, it corresponds to a shot in which the cue ball just grazes the

object ball, and such shots are hard to play accurately. If the cue ball, object ball,

and pocket lie in a straight line, � = 180-, the shooting path lies now on the two

path lengths, producing a straight line. Thus, this is the most direct and easiest

way to sink the object ball.

Figure 2 shows the geometry configurations of two object balls on the pool

table.

If,

�1 ¼ �2 ð1aÞ

dco1 ¼ dop2 ð1bÞ

dco2 ¼ dop1 ð1cÞ

Then the path with the smallest value of dop would be taken as the priori

choice for sinking the object ball. The reason is as depicted in Figure 3.

With dop2 < dop1, object ball 2 is nearer to pocket 2 than object ball 1 to

pocket 1. The tolerance angle, denoted as �, is the angle by which the object ball

Figure 1. The geometry for a shot.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM 163

can still possibly be potted into the pocket. In the case for object ball 2, � is

larger than that for object ball 1: �2 > �1. Thus, if both cue balls hit their

respective object balls, the chance of successfully potting object ball 2 is higher

than for object ball 1. This is the situation when both the distances and angles

satisfy equation (1). However, when the distances, angles depicted approximate

each other or one of the parameters varies, there will be a problem in the

evaluation of the difficulty.

Fuzzy logic method is applied in this paper for determining the difficulty of

each shot on the pool table. Rules are defined for choosing each shot on the table.

Every small changes (fuzziness) in the input parameters are taken into

consideration in the evaluation of the final difficulty of the shot. Therefore, for

a shot (ball and path), which might be considered equally hard or easy to a

human player, would get a different difficult rating in the output of the fuzzy

system.

2.2. ESTIMATING DIFFICULTY USING FUZZY LOGIC

In the fuzzy logic approach for estimating the difficulty of a shot on the pool

table, the parameters dco, dop and � as mentioned in Section 2.1 are used as

inputs.

Figure 2. Geometry configurations for two object balls.

Figure 3. Tolerance angle.

164 S. C. CHUA ET AL.

For each of the above inputs, three fuzzy sets are created as shown in the term

sets below:

1) dco = {near, average, far}, with

dco;near ¼ xnear; �dco;nearxnearð Þ

� � �� xnear 2 X� �

dco;ave ¼ xave; �dco;avexaveð Þ

� � �� xave 2 X� �

dco;far ¼ xfar; �dco;farxfarð Þ

� � �� xfar 2 X� �

ð2aÞ

2) dop = {near, average, far}, with

dop;near ¼ ynear; �dop;nearynearð Þ

� ��� ynear 2 Y� �

dop;ave ¼ yave; �dop;aveyaveð Þ

� ��� yave 2 Y� �

dop;far ¼ yfar; �dop;faryfarð Þ

� ��� yfar 2 Y� �

ð2bÞ

3) � = {easy, medium, hard}, with

�easy ¼ zeasy; ��easyzeasy

� �� ��� zeasy 2 Z� �

�medium ¼ zmedium; ��mediumzmediumð Þð Þj zmedium 2 Zf g

�hard ¼ zhard; ��hardzeasy

� �� ��� zhard 2 Z� �

ð2cÞ

where 0 e X, Y e XTable lies in one universe of discourse with upper bound, XTable

equals to the diagonal length of the playing field in pixels and 90- e Z e 180- lies

in another universe of discourse, which is the possible angle for making a shot.

The output of the fuzzy logic system is defined as D, which is the difficulty of

the shot and the term set is

� ¼ simple; intermediate; toughf gwith

�simple ¼ ssimple; ��simplessimple

� �� ���ssimple 2 S� �

�intermediate ¼ sintermediate; ��intermediatesintermediateð Þð Þjsintermediate 2 Sf g

�tough ¼ stough; ��toughstough

� �� ���stough 2 S� �

ð3Þ

where 0 e S e 1 lies in one universe of discourse.

The inference engine for the fuzzy system is the Zero-order Sugeno fuzzy

model. The Sugeno fuzzy model (also known as TSK model) was proposed by

Takagi, Sugeno and Kang [7, 8].

All the input membership functions (MFs) are Gaussian Membership

Functions given by

Gaussian x; c; �ð Þ ¼ e�12

x�c�ð Þ

2

ð4Þwhere c represents the MF’s center and � determines the MF’s width.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM 165

Let all the membership functions be equally spaced in their respective

universe of discourses, and sufficient crossover at 0.5 of membership value, thus

�dco;near¼ Gaussian xnear; 0; �xnear

ð Þ�dco;ave

¼ Gaussian xave; XTable=2; �xaveð Þ

�dco;far¼ Gaussianðxfar; XTable; �xfar

Þð5aÞ

near1

0.9

0.8

0.7

0.6

0.5

Deg

ree

of M

embe

rshi

pD

egre

e of

Mem

bers

hip

0.4

0.3

0.2

0.1

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1hard

90 135 180Angle (deg)

(a)

(b)

medium easy

0

0 XTable/2 XTable

average far

Figure 4. Input membership functions for (a) dco (or cue-object distance in pixels) & dop

(object-pocket distance in pixels), and (b) � (angle joining dco and dop in degrees).

166 S. C. CHUA ET AL.

�dop;near¼ Gaussian ynear; 0; �ynear

� �

�dop;ave¼ Gaussian yave; XTable=2; �yave

� �

�dop;far¼ Gaussian yfar; XTable; �yfar

� �ð5bÞ

��easy¼ Gaussian zeasy; 180

�; �zeasy

� �

��medium¼ Gaussian zmedium; 135

�; �zmedium

� �

��hard¼ Gaussian zhard; 90

�; �zhard

� �ð5cÞ

where �x ¼ �y ¼XTable

4:71(in Section 4, XTable = 586, thus �x = �y = 124.4) and

�z = 19.11-.The input membership functions are as shown in Figure 4. The output

membership function is constant singleton spikes (Figure 5), with only one

support point. Thus,

��not;diff0:0ð Þ ¼ 1:0

��diff0:5ð Þ ¼ 1:0

��very;diff1:0ð Þ ¼ 1:0:

ð6Þ

Mapping is done for dco, dop, and � for all its fuzzy set to a set of rules (or

rulebase). The rules should follow the common behavior (or style) of the player.

Therefore, these rules can be altered/tuned to suit different player’s level of

expertise (beginner, inter-mediate, or advanced), by changing the level of

Simple1

00 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

Deg

ree

of M

embe

rshi

p

Difficulty

Intermediate Tough

Figure 5. Output membership function for difficulty.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM 167

difficulty {Simple, Intermediate, Tough} based on the combination of fuzzy sets

in the rulebase.

Table I shows all the rules that are implemented in this work, as presented in

[9,10]. Note that these rules could be changed by a pool expert.

The linguistic variables above follow the membership functions as in Figure 4

and Figure 5 for inputs and output respectively.

In the fuzzy decision system, the decision policy can be described using the

linguistic ifYthen rules as

IF dco is LVd ið Þco AND dop is LVd ið Þ

op AND � is LV� ið Þ;

THEN � is LV� ið Þ:::Rule ið7Þ

where i is the rule number (i = 1, 2, 3, . . .), LVdco is a linguistic value of the

variable distance, dco with the term set dco = {near, average, far}, LVdop is a

linguistic value of the variable distance, dop with the term set dop = {near,

average, far}, and LV� is a linguistic value of the variable angle, � with the term

set � = {easy, medium, hard}. LVD is a linguistic value of the variable difficulty,

Table I. Rulebase for fuzzy pool system.

Rules Inputs Output

dco dop � D

1 Near Near Easy Simple

2 Near Average Easy Intermediate

3 Near Far Easy Tough

4 Near Near Medium Simple

5 Near Average Medium Intermediate

6 Near Far Medium Tough

7 Near Near Hard Intermediate

8 Near Average Hard Tough

9 Near Far Hard Tough

10 Average Near Easy Simple

11 Average Average Easy Intermediate

12 Average Far Easy Tough

13 Average Near Medium Simple

14 Average Average Medium Intermediate

15 Average Far Medium Tough

16 Average Near Hard Intermediate

17 Average Average Hard Tough

18 Average Far Hard Tough

19 Far Near Easy Simple

20 Far Average Easy Intermediate

21 Far Near Medium Intermediate

22 Far Average Medium Tough

23 Far Near Hard Tough

24 Far Average Hard Tough

168 S. C. CHUA ET AL.

with the term set D = {simple, intermediate, tough}. The inputs are thus inferred

to as the antecedents (IF), and the output called the consequence (THEN). The

rule antecedent describes the conditions under which the rule is applicable and

forms the composition of the inputs. The consequent describes the response

under these conditions.

Each fuzzy set is characterized by MFs, e.g., �dcod*coð Þ, �dop

d*op

� �, and �� �*ð Þ,

where dco* , dop* , and �* are the numerical values of the input variables that are

converted into fuzzy sets through the MF assignments. Thus, �dcod*coð Þ, �dop

d*op

� �,

and �� �*ð Þ are compared with fuzzy sets for dco, dop, and � (antecedent part) to

determine the value of output difficulty of fuzzy set for D (consequent part). The

outputs of the overall activated rules are aggregated, producing the final output

difficulty, which is then defuzzified into a crisp number, D*.

Zero-order Sugeno fuzzy inference system with max-product is used. The

firing strength of ith activated rule is

FS ið Þ ¼ prod �ið Þ

dcod*coð Þ; � ið Þ

dopd*op

� �; � ið Þ

� �*ð Þh i

ð8Þ

which is simply the multiplication of all the values of the membership functions

of the inputs. Each ith firing strength, FS, leads to a qualified consequence of the

cue-object = 237

123456789

101112131415161718192021222324

0 586 0 90 180-0.1 1.1

586

object-pocket = 54 angle = 160 difficulty = 0.0785

Figure 6. Rules viewer with input examples.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM 169

ith rule, which is FS� ��, where �� is the MF of the term set difficulty, D and

� is the multiplication operator. Since the MF of each fuzzy set in the Zero-order

Sugeno fuzzy system is a singleton, thus the qualified consequence is reduced to

equal to FS �� ¼ 1:0ð Þ.The outputs of all the activated rules, will form the overall difficulty output,

which is then defuzzified into a crisp number, D*. The defuzzification involves

the computation of weighted average of all the aggregated singletons.

�* ¼P

���*� �ð ÞP�*� �ð Þ

ð9Þ

where �*� �ð Þ is the aggregated qualified consequences using the max operator.

Figure 6 illustrates the rules viewer given an example inputs: dco = 237 pixels,

dop = 54 pixels and � = 160 degrees, and the corresponding output is the

difficulty, D = 0.0785, which is considered a simple shot (or easy shot). The

rules’ inferencing system is clearly shown in the viewer as well. The second bar

from the left at the overall output portion shows the overall difficulty, that is the

weighted average, D*, for the inputs shown.

3. Playing Style

3.1. DECISION FOR BEST SHOT

The best shot is the easiest shot to sink the object ball into the pocket, and it is

chosen from the defuzzification outputs (each possible object ball/path is

evaluated).

For each shot, a determination of whether a clear path to target ball from cue

ball exists for a shot must be done. If the ball must travel from A to A0 and that

there is a ball at C as shown in Figure 7 (left), then ball C will not obstruct the

path between A and A0 if h (h is the length from center of ball C to a point on

the line joining A and A0, making a right angle) is more than the ball diameter. In

the actual situation, the clear path depends on the point at which the cue ball

collides with the object ball as in Figure 7 (right).

Figure 7. Obstacle in a path (geometry) (left), obstacle in a path (with collision) (right).

170 S. C. CHUA ET AL.

Throughout this work, the cue is assumed to exert enough force on the cue

ball such that it will travel in a straight line, hit the object ball and transfer

enough energy to the object ball so that it travels in a straight line into the pocket

(direct shot). Since the final cue ball and ball distributions are not considered in

this work (after executing a shot), no dynamic model is implemented.

3.2. DIRECT, COMBINATION AND BANK SHOT

Fuzzy logic approach of estimating the difficulty of a shot that has been

discussed in Section 2 is for a direct shot (a cue ball collides with an object ball

directly, and into the pocket). In certain pool table balls distribution, shooting the

object ball directly might not be the best or wisest decision. Some players might

prefer to use combination shot, or even bank shot.

Combination shot is carried out when a player shoots the cue ball towards an

object ball, and the object ball upon collision would travel and hit another object

ball (of the same type), potting it into the designated pocket. On the other hand, a

bank shot is executed either by shooting the cue ball to the edge of the table,

which then bounces (or reflects) and collides with the object ball, or shooting the

cue ball to an object ball so that the object ball hits the edge and bounces; then

into the designated pocket. All the paths that are evaluated in this paper, are in

straight line.

The decision at which of the playing styles to employ is based on the

individual player. This could vary from player to player, or from the level of

expertise. The benchmark is thus difficult to evaluate. In this application,

without doing benchmarking, priority is assigned to direct shot. If the shot

does not exist on the board at all, then combination shot is preferred, and

lastly, the bank shot. Bank shot is harder to execute as it requires the player to

hit the cue ball to the edge of the table. It is hard to estimate the point at

which the cue ball is to bounce back. It is easier to execute a shot that

involves another object ball as in combination shot, as it provides a better

estimation. Hence, all the bank shots are given the last priority. The priority is

as tabulated in Table II.

The complexity of each type of shot increases due to the geometry problems.

Figure 8 shows the geometry for direct shot, combination shot, and bank shots. In

Table II. Priority of shot.

Priority Shot type

1 Direct shot

2 Combination shot

3 Type 1 bank shot

4 Type 2 bank shot

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM 171

a real pool situation, playing styles are not restricted to the three being discussed.

There are others such as Fsnook_-ing the opponent, predicting the opponent’s

move, making an Fenglish_, etc., which are not being taken into consideration in

this paper.

3.3. FUZZY COMBINATION FOR DIFFERENT PLAYING STYLE

The fuzzy-based best shot decision algorithm was presented earlier. The model is

discussed for a direct shot problem, as well as the rules table (the 24 rules) and

inference system (zero-order Sugeno system). The model serves as the base

model for the computation of combination and bank shots as well. As been

pointed out, direct shot model involves a cue ball, an object ball and a pocket by

which all the three parameters of the fuzzy inputs are found by calculating the

distances and angle.

The output difficulty of the direct shot fuzzy system is given by Ddir =

D(dco,dop,�) for a direct shot model, where dco is the distance traveled by the cue

ball before the collision with the object ball, dop is the distance from the object

ball to the pocket and � is the angle between the line joining both dco and dop.

Figure 8. (a) Direct shot; (b) Combination shot; (c) Bank shots.

Figure 9. Combination shot.

172 S. C. CHUA ET AL.

3.3.1. Best Combination Shot Decision

In order to evaluate the difficulty of a combination shot that involves two object

balls, the problem is divided into two parts; involving (each again is a three

inputs fuzzy system using the direct shot model): 1) cue ball, object ball 1 and

object ball 2, and 2) object ball 1, object ball 2 and pocket. From these infor-

mation, the parameters are defined as 1) dc,o1, do1,o2, �c,o1,o2, and 2) do1,o2, do2,p,

�o1,o2,p, where:

dc,o1 the distance traveled by the cue ball to the position before colliding with

object ball 1do1,o2 the distance measured from the initial object ball 1 position to the

position before colliding with object ball 2do2,p the distance measured from the initial object ball 2 position to the

designated pocket�c,o1,o2 the angle between the line joining dc,o1 and do1,o2

�o1,o2,p the angle between the line joining do1,o2 and do2,p.

Figure 10. Bank shot (type 1).

Figure 11. Bank shot (type 2).

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM 173

Graphical relations of the above variables are illustrated in Figure 9.

For a combination shot, the difficulty is combined and assigned as,

�combination ¼X

�c;o1;o2 þ�o1;o2;p

� �ð10aÞ

where Dc,o1,o2 = D(dc,o1, do1,o2, �c,o1,o2) and Do1,o2,p = D(do1,o2, do2,p, �o1,o2,p).

Thus, each difficulty being evaluated is a direct shot case.

Therefore, the best decision from all the evaluated difficulties, is found by

Best �combinationð Þ ¼ min �com;1;�com;2; :::;�com;n

� �ð10bÞ

where n is the number of possible combination shots that the current table has.

Figure 12. Membership function for reflective angle.

Figure 13. Simulated pool board.

174 S. C. CHUA ET AL.

3.3.2. Best Bank Shot Decision

Here, bank shot is divided into two types. Type 1 is by directly hitting the cue

ball towards the edge, while type 2 is hitting the cue ball to collide with an object

ball, so that the object ball hits the edge.

Type 1. In order to evaluate the difficulty in bank shot type 1, the problem is

divided into two parts (similar to combination shot); involving: 1) cue ball, table

edge and object ball, and 2) table edge, object ball and pocket. From these

information, the parameters are defined as 1) dc,e, de,o, �c,e,o, and 2) de,o, do,p,

�e,o,p, where:

dc,e the distance traveled by the cue ball to the position at which the cue ball

touches the table edge of the table before it gets reflectedde,o the distance measured from position just before the cue ball reflects from

the table edge to the position at the instant of collision with object balldo,p the distance measured from the initial object ball position to the designated

pocket�c,e,o the angle between the line joining dc,e and de,o

�e,o,p the angle between the line joining de,o and do,p.

Graphical relations of the above variables are illustrated in Figure 10.

Table III. Red player computation for direct shot.

Ball Pocket dco dop � D Rank

1 6 237.0821 54.2753 160.7416 0.0763 1

3 5 125.4211 107.2688 94.1515 0.6176 4

4 4 277.4627 82.2118 134.7102 0.1272 2

6 3 194.4662 97.4371 112.4551 0.3746 3

Figure 14. Simulated direct shot trajectories for red player.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM 175

Ta

ble

IV.

Red

pla

yer

com

pu

tati

on

for

com

bin

atio

nsh

ot.

Bal

l1

Bal

l2

Po

cket

dc,o

1d

o1

,o2

do

2,p

�c,o

1,o

2�

o1

,o2

,pD

c,o

1,o

2D

o1

,o2

,pD

co

mR

ank

31

61

19

.46

59

14

1.2

96

85

4.2

75

31

17

.22

46

17

2.6

37

90

.39

77

0.0

74

40

.47

21

4

32

31

20

.90

13

15

7.7

88

22

21

.20

48

11

1.2

76

39

1.5

53

40

.55

98

0.8

89

01

.44

88

6

32

61

23

.80

43

15

0.6

19

37

0.9

18

11

00

.08

16

11

9.1

51

30

.68

82

0.2

10

70

.89

88

5

51

68

7.2

77

21

44

.87

36

54

.27

53

14

3.9

72

71

48

.23

66

0.2

53

80

.07

60

0.3

29

72

52

68

5.2

54

81

25

.40

95

70

.91

81

16

2.9

05

21

58

.48

38

0.2

01

60

.09

71

0.2

98

61

56

38

8.3

66

41

04

.27

91

97

.43

71

13

6.9

79

51

30

.51

57

0.1

67

80

.16

72

0.3

35

03

176 S. C. CHUA ET AL.

For bank shot type 1, the difficulty is combined and assigned as,

�bank 1ð Þ ¼X

�c;e;o þ�e;o;p

� �ð11aÞ

where Dc,e,o = D(dc,e, de,o, �c,e,o) and De,o,p = D(de,o, do,p, �e,o,p). Each difficulty

being evaluated is a direct shot problem.

Therefore, the best decision from all the evaluated difficulties, is found by

Best �bank 1ð Þ� �

¼ min �bank 1ð Þ;1;�bank 1ð Þ;2; : : : ;�bank 1ð Þ;n� �

ð11bÞ

where n is the number of possible type 1 bank shots that the current table has.

Type 2. In order to evaluate the difficulty in bank shot type 2, the problem is

divided into two parts (as in type 1); involving: 1) cue ball, object ball and table

edge, and 2) object ball, table edge and pocket. From these information, the

parameters are defined as 1) dc,o, do,e, �c,o,e, and 2) do,e, de,p, �o,e,p, where:

dc,o the distance measured from the initial cue ball position to position before

colliding with the object balldo,e the distance measured from the initial object ball position to position at the

table edge of interestde,p the distance measured from the table edge of interest to the designated

pocket�c,o,e the angle between the line joining dc,o and do,e

�o,e,p the angle between the line joining do,e and de,p.

Graphical relations of the above variables are illustrated in Figure 11.

For bank shot type 2, the difficulty is combined and assigned as,

�bank 2ð Þ ¼X

�c;o;e þ�o;e;p

� �ð12aÞ

where Dc,o,e = D(dc,o, do,e, �c,o,e) and Do,e,p = D(do,e, de,p, �o,e,p). Each difficulty

being evaluated is again a direct shot problem.

Figure 15. Simulated combination shot trajectories for red player.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM 177

Ta

ble

V.

Red

pla

yer

com

pu

tati

on

for

ban

ksh

ot

typ

e1

.

Ed

ge

Bal

lP

ock

etd

c,e

de,o

do

,p�

c,e

,o/2

�e,o

,pD

c,e

,oD

e,o

,pD

ban

k(1

)R

ank

11

68

5.9

83

52

62

.15

03

54

.27

53

31

.89

69

14

1.7

52

10

.57

08

0.0

79

10

.64

99

5

12

69

2.1

71

72

29

.29

08

70

.91

81

37

.62

72

17

5.4

84

10

.48

03

0.0

96

90

.57

72

3

13

57

4.9

39

61

88

.28

31

10

7.2

68

81

3.0

64

01

09

.40

72

0.7

69

00

.45

20

1.2

21

01

0

15

58

5.7

49

01

14

.38

97

19

7.7

93

83

1.6

44

31

04

.91

59

0.2

60

80

.77

61

1.0

36

98

21

62

35

.41

79

15

.35

26

54

.27

53

47

.18

43

11

7.3

29

10

.04

21

0.2

25

80

.26

79

1

23

31

62

.71

14

29

.86

87

29

1.1

74

51

0.4

74

51

47

.09

42

0.4

56

20

.49

81

0.9

54

39

24

12

69

.34

38

60

.89

32

20

7.0

62

85

3.5

56

01

34

.87

09

0.0

88

60

.40

79

0.4

96

52

26

31

88

.41

73

17

9.5

39

59

7.4

37

13

1.8

77

51

72

.79

93

0.4

40

50

.14

20

0.5

82

54

33

32

94

.50

83

33

0.3

10

02

91

.17

45

12

.06

77

12

1.3

12

60

.88

58

0.5

97

31

.48

31

11

45

22

29

.05

14

12

2.4

15

01

87

.21

33

7.6

74

01

29

.21

94

0.6

31

80

.39

46

1.0

26

36

45

52

27

.55

33

12

2.2

95

91

97

.79

38

3.9

96

41

37

.43

62

0.6

52

80

.38

33

1.0

36

27

178 S. C. CHUA ET AL.

Therefore, the best decision from all the evaluated difficulties, are

Best �bankð2Þ� �

¼ min �bank 2ð Þ;1;�bank 2ð Þ;2; : : : ;�bank 2ð Þ;n� �

ð12bÞ

where n is the number of possible type 2 bank shots that the current board has.

In both bank shots, the angle of reflection (angle at which the ball leaves

the table edge measured from the normal of the table edge) ranges from 0-to 90- intermediate (which means that the membership function, �, cannot be

employed). Thus, for bank shots, a new membership function for angle of

reflection is created. It is actually a modified of � of the direct shot (which is by

shifting all the MFs to the left by 90-) as depicted in Figure 12.

The angle of reflection ranges from 0 to 90- for a symmetrical reflection at

the normal of the table (incident angle = reflective angle). Observe that as the

reflective angle approaches 90-, it represents a straight line, hence, the mem-

bership function is assigned hard, medium, and easy as the angle increases from

0 to 90-.Although a new MF is assigned for bank shots (only for the case which

involve �c,e,o, and �o,e,p), the rulebase remains unchanged (substitutes the

modified � with �). Bank shot uses four different MFs for evaluating the

difficulty by which �c,e,o /2 (type 1) and �o,e,p /2 (type 2) are the angles of

reflection that uses the modified MF.

4. Results: Game Configuration Cases

Figure 13 shows the simulated pool table from an actual pool table. Analysis is

carried out to decide the shot for each playing styles. The game analysis is

carried out for red-ball player only.

The image of the actual pool table that is taken, is of dimensions 640

pixels by 480 pixels. The length and width of the pool playing field that are

calibrated before the image processing steps (not discussed in this paper) are

531 pixels by 249 pixels, respectively. Thus, XTable ¼ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi5312 þ 2492p

¼ 586.

Computation of cue-object-pocket geometry is confined within the pool playing

Figure 16. Simulated shot trajectories for red player for type 1 bank shot.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM 179

Ta

ble

VI.

Red

pla

yer

com

pu

tati

on

for

typ

e2

ban

ksh

ot.

Bal

lE

dg

eP

ock

etd

c,o

do

,ed

e,p

�c,o

,e�

0,e

,p/2

Dc,o

,eD

o,e

,pD

ban

k(2

)R

ank

24

22

32

.69

18

43

.17

36

31

8.6

71

81

09

.67

93

35

.94

21

0.3

47

10

.56

20

0.9

09

11

54

48

4.9

22

71

51

.66

58

53

3.4

82

91

68

.62

47

11

.37

71

0.2

63

90

.97

94

1.2

43

33

54

58

4.6

73

21

56

.37

46

27

2.3

05

61

77

.26

39

18

.65

45

0.2

75

20

.78

05

1.0

55

62

180 S. C. CHUA ET AL.

board. Thus, all the pockets in calculation for the geometry are set within the

rectangular field.

Direct shot, combination shot and bank shots are computed based on the

geometry data. Each feasible shot is listed with all the necessary parameters, and

also the fuzzy-based difficulty. The best (or easiest) shot shown (in bold italic) is

ranked 1 (with the smallest D), second best option ranked 2, and so on.

4.1. DIRECT SHOT

Table III shows the results decision for different ball and path possible for direct

shot. Figure 14 shows all the possible shot trajectories.

4.2. COMBINATION SHOT

Assuming that direct shot is not possible, Table IV shows the results decision for

different ball and path possible for combination shots. Figure 15 shows all the

possible trajectories for combination shot.

4.3. BANK SHOT

Again, assumption is that direct and combination shots do not exist. Table edges

are numbered as 1 for bottom, 2 for top, 3 for left and 4 for right.

4.3.1. Type 1

Table V shows the results decision for different balls and possible paths for type

1 bank shots. Figure 16 shows all the possible trajectories plotted.

4.3.2. Type 2

Table VI shows the results decision for different balls and possible paths for type

2 bank shots. Figure 17 shows all the possible trajectories plotted.

Figure 17. Simulated shot trajectories for red player for type 2 bank shot.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM 181

Note that all the simulated results from Figures 14Y17 are plotted from center

of cue ball to the center of next object of interest for display simplicity. The

actual path/trajectory that is traced by the cue ball or object ball has been taken

Figure 18. Pool board game configuration cases.

182 S. C. CHUA ET AL.

into account as depicted in Figures 8Y11. Rank 1 choice is the best choice that

will be taken as a shot. The point plotted at the table edge for bank shots is a

distance of the ball radius, Rb (8 pixels) away. Observe that black-ball trajectory

Figure 18. (Continued).

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM 183

is not computed. It is only feasible to compute black-ball trajectory at the end of

the shot, that is when only black-ball is left as the final shot.

5. The Intelligent System

Figure 18 shows the decision of the pool table when different ball distributions

arise during the course of a real pool game for different players. Assuming that

the game has started and it is the turn of a red-ball player to decide on a move

starting Figure 18a.

Table VII as tabulated shows the game decisions for Figure 18 game

configurations. The procedures involve the game analysis for the current player

at a time, showing all the possible choices, and advice for one best shot. Remarks

are given for each shot.

6. Conclusion and Future Work

A search and decision making algorithm (based on fuzzy logic) is created to

select the best shot on the pool board, given the ball distributions (pool table

Table VII. Game analysis and decision.

Figure 18 Direct Combination Bank

type 1

Bank

type 2

Remark

a J Y Y Y There are three possible direct shots

for red-ball player

b J Y Y Y The fuzzy algorithm advices on one

best shot to top right pocket

c X J Y Y The player executes his shot and the

ball enters the pocket; the player

continues his turn; this time, there

is no direct shot on the board; there

is one combination shot

d X J Y Y The player executes his shot

(combination) and the ball fails to

enter the pocket; the red-ball player

loses his turn

d J Y Y Y The yellow-ball player_s turn of

execution; there are two possible

choices for direct shot

e J Y Y Y The fuzzy algorithm advices on one

best shot to bottom middle pocket

f X X X J The player executes his shot and the

ball enters the pocket the player

continues his turn; in this situation,

only bank shot type 2 is possible

Game continues...

184 S. C. CHUA ET AL.

image as input). The fuzzy logic system can be used for direct, combination, and

bank shots. The output of the fuzzy system indicates how difficult the current

ball/path trajectory is. The best shot is chosen over the lowest difficulty values of

all the possible shots. Priority is given to direct shot, then combination shot, and

lastly bank shot type 1 then type 2.

Simulations taken from the real pool table have shown the final trajectories

for the chosen shot (or acceptable decision for the chosen shot). With simulation,

all the possible shots can be computed accurately, which a human player could

not. Computer calculation possesses the ability to accurately calculate the lengths

and angles, and also the ability to find all the possible shots on the table. Not all

humans can deduce all the direct shots on the board, which the computer could.

The method considered for deciding on the shot in this paper, is based on

geometry calculations of the lengths and angles, and fuzzy logic approach only.

The analysis and decision for a pool game is also presented in the step-by-step

game scenario as an intelligent system. The graphical user interface (GUI) for the

implementation of the intelligent system has been presented [11].

Future works may involve the integration of direct, combination, and bank

shots as a whole (the current system find only direct shot first, and make the

evaluation; if there is no direct shot, it searches for combination shot, and so on)

and pick one best shot. This may involve the benchmarking of all the shots, as

one combination shot for example, may be easier to make than a direct shot in

the priority table now. The input of a human domain expert is required to define

the difficulty. Other artificial intelligence (AI) techniques that might be of use

include Neural Networks, Reinforcement Learnings, etc.

References

1. Huang, Wesley H.: A Simple Robot Pool Player. Bachelor’s Thesis, Massachusetts Institute

of Technology (MIT), 1991.

2. Jebara, T., Eyster, C., Weaver, J., Starner, T., and Pentland, A.: Stochasticks Y augmenting

the billiards experience with probabilistic vision and wearable computers, in: Proceedings of

the International Symposium on Wearable Computers, Cambridge, Massachusetts 1997,

pp. 138Y145.

3. Larsen, L. B., Jensen, P. M., Kammersgaard, K., and Kromann, L.: The automated pool

trainer Y a multi modal system for learning the game of pool, in: Proceeding of the

International Conference on Intelligent Multimedia and Distance Education, 2001.

4. Grogono, P.: Mathematics for Snooker Simulation. (Personal Communication), 1996.

5. Richmond, J. and Green, J.: Robotic Image Processing Pool Player, [Online]. Available:

http://ocho.uwaterloo.ca/~workshop/RIPPP [September 2001].

6. Fei Long, Herland, J., Tessier, M.-C., Naulls, D., Roth, A., and Greenspan, M.: Robotic pool:

An experiment in automatic potting, International Conference on Intelligent Robotics &

Systems, FP2-F4, 2004.

7. Sugeno, M. and Kang, G. T.: Structure identification of fuzzy model, Fuzzy Sets and Systems

28 (1988), 15Y33.

8. Takagi, T. and Sugeno, M.: Fuzzy identification of systems and its applications to modeling

and control, IEEE transactions on Systems, Man, and Cybernetics 15 (1985), 116Y132.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM 185

9. Chua, S. C., Tan, W. C., Wong, E. K., and Koo, V. C.: Decision algorithm for pool using

fuzzy system, Proceedings of the Inter’l Conference on Artificial Intelligence in Engineering

& Technology 2002, pp. 370Y375.

10. Chua, S. C., Tan, W. C., Wong, E. K., and Koo, V. C.: Decision algorithm for pool using

fuzzy system (Part 2). Proceedings of the Second Inter’l Conference on Artificial Intelligence

in Engineering & Technology 2004, pp. 691Y697.

11. Chua, S. C., Wong, E. K., and Koo, V. C.: GUI for pool tutor. Proceedings of the MMU

International Symposium on Information and Communications Technologies 2004, TS4A-2:

pp. 5Y8.

186 S. C. CHUA ET AL.