Intelligent Pool Decision System Using Zero-Order ... - Semantic Scholar

2 downloads 0 Views 596KB Size Report
Key words: intelligent decision system, pool game, zero-order Sugeno fuzzy system. 1. ...... the International Symposium on Wearable Computers, Cambridge, ...
Journal of Intelligent and Robotic Systems (2005) 44: 161–186 DOI: 10.1007/s10846-005-9009-1

#

Springer 2006

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

162

S. C. CHUA ET AL.

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. Mathematics 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.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM

163

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.

164

S. C. CHUA ET AL.

Figure 2. Geometry configurations for two object balls.

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 3. Tolerance angle.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM

165

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;near ðxnear Þ  xnear 2 X    dco;ave ¼ xave ; dco;ave ðxave Þ  xave 2 X    dco;far ¼ xfar ; d ðxfar Þ  xfar 2 X

ð2aÞ

co;far

2) dop = {near, average, far}, with    dop;near ¼ ynear ; dop;near ðynear Þ  ynear 2 Y    dop;ave ¼ yave ; dop;ave ðyave Þ  yave 2 Y    dop;far ¼ yfar ; d ðyfar Þ  yfar 2 Y

ð2bÞ

op;far

3)  = {easy, medium, hard}, with     easy ¼ zeasy ; easy zeasy  zeasy 2 Z medium ¼ fðzmedium ; medium ðzmedium ÞÞj zmedium 2 Z g     hard ¼ zhard ;  zeasy  zhard 2 Z

ð2cÞ

hard

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  ¼ fsimple; intermediate; toughg with simple ¼

    ssimple ; simple ssimple ssimple 2 S

intermediate ¼ fðsintermediate ; intermediate ðsintermediate ÞÞjsintermediate 2 S g     tough ¼ stough ;  stough stough 2 S

ð3Þ

tough

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 2

1 xc Gaussianðx; c; Þ ¼ e 2 ð  Þ

where c represents the MF’s center and  determines the MF’s width.

ð4Þ

166

S. C. CHUA ET AL.

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Þ

ð5aÞ

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

near 1

average

far

0.9

Degree of Membership

0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0

XTable/2

XTable

(a) hard 1

medium

easy

Degree of Membership

0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 90

135

180

Angle (deg)

(b) 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).

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM

  dop;near ¼ Gaussian ynear ; 0; ynear   dop;ave ¼ Gaussian yave ; XTable =2; yave   dop;far ¼ Gaussian yfar ; XTable ; yfar

167

ð5bÞ

   easy ¼ Gaussian zeasy ; 180 ; zeasy    medium ¼ Gaussian zmedium ; 135 ; zmedium    hard ¼ Gaussian zhard ; 90 ; zhard

ð5cÞ

XTable where x ¼ y ¼ (in Section 4, XTable = 586, thus x = y = 124.4) and 4:71 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;diff ð0:0Þ ¼ 1:0 ð6Þ

diff ð0:5Þ ¼ 1:0 very;diff ð1:0Þ ¼ 1:0:

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

Simple 1

Intermediate

Tough

Degree of Membership

0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0

0.1

0.2 0.3

0.4

0.5

0.6

0.7

0.8

0.9

Difficulty

Figure 5. Output membership function for difficulty.

1

168

S. C. CHUA ET AL.

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 ðcoiÞ AND dop is LVd ðopiÞ AND  is LVðiÞ ;

ð7Þ

THEN  is LVðiÞ :::Rule i

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

Inputs

Output

dco

dop



D

Near Near Near Near Near Near Near Near Near Average Average Average Average Average Average Average Average Average Far Far Far Far Far Far

Near Average Far Near Average Far Near Average Far Near Average Far Near Average Far Near Average Far Near Average Near Average Near Average

Easy Easy Easy Medium Medium Medium Hard Hard Hard Easy Easy Easy Medium Medium Medium Hard Hard Hard Easy Easy Medium Medium Hard Hard

Simple Intermediate Tough Simple Intermediate Tough Intermediate Tough Tough Simple Intermediate Tough Simple Intermediate Tough Intermediate Tough Tough Simple Intermediate Intermediate Tough Tough Tough

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM

169

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., dco ðd*co Þ, d op d*op , and  ð*Þ, * , dop * , and * are the numerical values of the input variables that where dco  are  converted into fuzzy sets through the MF assignments. Thus, dco ðd*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 h i  ðiÞ ðiÞ  FSðiÞ ¼ prod dco ðd*co Þ; dop d*op ; ð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

object-pocket = 54

0

0

angle = 160

difficulty = 0.0785

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 586

586

90

180 -0.1

Figure 6. Rules viewer with input examples.

1.1

170

S. C. CHUA ET AL.

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 * ðÞ ð9Þ * ¼ P * ðÞ 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).

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM

171

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 2 3 4

Direct shot Combination shot Type 1 bank shot Type 2 bank shot

172

S. C. CHUA ET AL.

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

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 9. Combination shot.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM

173

Figure 10. Bank shot (type 1).

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 information, 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 do1,o2 do2,p c,o1,o2 o1,o2,p

the distance traveled by the cue ball to the position before colliding with object ball 1 the distance measured from the initial object ball 1 position to the position before colliding with object ball 2 the distance measured from the initial object ball 2 position to the designated pocket the angle between the line joining dc,o1 and do1,o2 the angle between the line joining do1,o2 and do2,p.

Figure 11. Bank shot (type 2).

174

S. C. CHUA ET AL.

Figure 12. Membership function for reflective angle.

Graphical relations of the above variables are illustrated in Figure 9. For a combination shot, the difficulty is combined and assigned as, X  c;o1;o2 þ o1;o2;p combination ¼

ð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   ð10bÞ Bestðcombination Þ ¼ min com;1 ; com;2 ; :::; com;n where n is the number of possible combination shots that the current table has.

Figure 13. Simulated pool board.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM

175

Table III. Red player computation for direct shot. Ball

Pocket

dco

dop



D

Rank

1 3 4 6

6 5 4 3

237.0821 125.4211 277.4627 194.4662

54.2753 107.2688 82.2118 97.4371

160.7416 94.1515 134.7102 112.4551

0.0763 0.6176 0.1272 0.3746

1 4 2 3

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 de,o do,p c,e,o e,o,p

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 reflected 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 ball the distance measured from the initial object ball position to the designated pocket the angle between the line joining dc,e and de,o the angle between the line joining de,o and do,p.

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

Figure 14. Simulated direct shot trajectories for red player.

Ball 2

1 2 2 1 2 6

Ball 1

3 3 3 5 5 5

6 3 6 6 6 3

Pocket

119.4659 120.9013 123.8043 87.2772 85.2548 88.3664

dc,o1 141.2968 157.7882 150.6193 144.8736 125.4095 104.2791

do1,o2

Table IV. Red player computation for combination shot.

54.2753 221.2048 70.9181 54.2753 70.9181 97.4371

do2,p 117.2246 111.2763 100.0816 143.9727 162.9052 136.9795

c,o1,o2 172.6379 91.5534 119.1513 148.2366 158.4838 130.5157

o1,o2,p 0.3977 0.5598 0.6882 0.2538 0.2016 0.1678

Dc,o1,o2

0.0744 0.8890 0.2107 0.0760 0.0971 0.1672

Do1,o2,p

0.4721 1.4488 0.8988 0.3297 0.2986 0.3350

Dcom

4 6 5 2 1 3

Rank

176 S. C. CHUA ET AL.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM

For bank shot type 1, the difficulty is combined and assigned as, X  bankð1Þ ¼ c;e;o þ e;o;p

177

ð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     ð11bÞ Best bankð1Þ ¼ min bankð1Þ;1 ; bankð1Þ;2 ; : : : ; bankð1Þ;n 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 do,e de,p c,o,e o,e,p

the distance measured from the initial cue ball position to position before colliding with the object ball the distance measured from the initial object ball position to position at the table edge of interest the distance measured from the table edge of interest to the designated pocket the angle between the line joining dc,o and do,e 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.

Ball

1 2 3 5 1 3 4 6 3 5 5

Edge

1 1 1 1 2 2 2 2 3 4 4

6 6 5 5 6 3 1 3 3 2 5

Pocket

85.9835 92.1717 74.9396 85.7490 235.4179 162.7114 269.3438 188.4173 294.5083 229.0514 227.5533

dc,e

262.1503 229.2908 188.2831 114.3897 15.3526 29.8687 60.8932 179.5395 330.3100 122.4150 122.2959

de,o

Table V. Red player computation for bank shot type 1.

54.2753 70.9181 107.2688 197.7938 54.2753 291.1745 207.0628 97.4371 291.1745 187.2133 197.7938

do,p 31.8969 37.6272 13.0640 31.6443 47.1843 10.4745 53.5560 31.8775 12.0677 7.6740 3.9964

c,e,o/2 141.7521 175.4841 109.4072 104.9159 117.3291 147.0942 134.8709 172.7993 121.3126 129.2194 137.4362

e,o,p 0.5708 0.4803 0.7690 0.2608 0.0421 0.4562 0.0886 0.4405 0.8858 0.6318 0.6528

Dc,e,o

0.0791 0.0969 0.4520 0.7761 0.2258 0.4981 0.4079 0.1420 0.5973 0.3946 0.3833

De,o,p

0.6499 0.5772 1.2210 1.0369 0.2679 0.9543 0.4965 0.5825 1.4831 1.0263 1.0362

Dbank(1)

5 3 10 8 1 9 2 4 11 6 7

Rank

178 S. C. CHUA ET AL.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM

Therefore, the best decision from all the evaluated difficulties, are     Best bankð2Þ ¼ min bankð2Þ;1 ; bankð2Þ;2 ; : : : ; bankð2Þ;n

179

ð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 0to 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 membership 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 pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ffi 531 pixels by 249 pixels, respectively. Thus, XTable ¼ 5312 þ 2492 ¼ 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.

Edge

4 4 4

Ball

2 5 5

2 4 5

Pocket

232.6918 84.9227 84.6732

dc,o

43.1736 151.6658 156.3746

do,e

Table VI. Red player computation for type 2 bank shot.

318.6718 533.4829 272.3056

de,p 109.6793 168.6247 177.2639

c,o,e 35.9421 11.3771 18.6545

0,e,p/2

0.3471 0.2639 0.2752

Dc,o,e

0.5620 0.9794 0.7805

Do,e,p

(2)

0.9091 1.2433 1.0556

Dbank

1 3 2

Rank

180 S. C. CHUA ET AL.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM

181

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.

182

S. C. CHUA ET AL.

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.

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM

183

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).

184

S. C. CHUA ET AL.

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

b

J

Y

Y

Y

c

X

J

Y

Y

d

X

J

Y

Y

d

J

Y

Y

Y

e

J

Y

Y

Y

f

X

X

X

J

There are three possible direct shots for red-ball player The fuzzy algorithm advices on one best shot to top right pocket 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 The player executes his shot (combination) and the ball fails to enter the pocket; the red-ball player loses his turn The yellow-ball player_s turn of execution; there are two possible choices for direct shot The fuzzy algorithm advices on one best shot to bottom middle pocket 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...

INTELLIGENT POOL DECISION SYSTEM USING ZERO-ORDER SUGENO FUZZY SYSTEM

185

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. 2.

3.

4. 5. 6.

7. 8.

Huang, Wesley H.: A Simple Robot Pool Player. Bachelor’s Thesis, Massachusetts Institute of Technology (MIT), 1991. 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. 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. Grogono, P.: Mathematics for Snooker Simulation. (Personal Communication), 1996. Richmond, J. and Green, J.: Robotic Image Processing Pool Player, [Online]. Available: http://ocho.uwaterloo.ca/~workshop/RIPPP [September 2001]. 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. Sugeno, M. and Kang, G. T.: Structure identification of fuzzy model, Fuzzy Sets and Systems 28 (1988), 15Y33. 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.

186 9.

10.

11.

S. C. CHUA ET AL.

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. 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. 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.

Suggest Documents