S.C.Chua 1
W.C.Tan2
E.K.Wong 3
V.C.Koo4
Abstract
1 Introduction
Game playing has a long and distinguished history in
mankind and if not by far the most suitable leisure activity.
Over times, humans have made it possible to simulate games
in virtual environments and even automate system of games.
The integration of real and virtual environments of games
made it possible to organize, plan and even improve the game
accuracy since the virtual world provide the freedom for
constraints and precision of the digital world. Researches
have been carried out to promote intelligent robotics research
in area of mobile robot, i.e. robot soccer [1] [2]. As of recent
years, virtual reality has made it even possible to generate a
totally synthetic environment for game [3]. Another potential
area of development in game playing is in billiards. Wearable
1 =2
(2a)
d co1 =d op2
(2b)
d co2 =d op1
(2c)
then for both cases would be the same. This shows the
deficiency of this mathematical formula for such a situation.
In practice, the difficulty is small if d co is large and d op is
small, but not if d co is small and d op is large. Thus by relying
on the use of mathematical formula to evaluate the difficulty
of a shot is not really the best way. In the next section, fuzzy
logic principle is applied to this problem.
cue
object 1
d co
d co1
cue
d co2
d op1
pocket 1
d op
object
pocket 2
d co d op b
cos
2
90 o < 180 o
object 2
d op 2
(1)
cue
d co
object
d op
pocket
altered to suit to different players behavior (beginner, intermediate, or advance), by changing the level of difficulty (D
Difficult, ND Not Difficult, VD Very Difficult, NA Not
Relevant: such combination does not exist) based on the
combination of fuzzy sets (or combination of shot). This is
shown in Table 1. In the previous section, it is shown that the
evaluation of failed for a situation in Figure 2 with
conditions given in Equation 2. In the approach using fuzzy
logic principle, each combination of shot is given a level of
difficulty (as defined above). Therefore, the situation
encountered earlier will certainly give a different (in
existing approach, is the difficulty function. In fuzzy logic
approach, it is the output of the rule evaluation).
(b)
near
average
far
near
ND
ND
ND
d op
average
D
D
D
far
VD
VD
NA
(a)
is medium
d co
near
average
far
d op
near
ND
ND
D
average
D
D
VD
far
VD
VD
NA
(b)
is hard
d co
near
average
far
d op
near
D
D
VD
average
VD
VD
VD
far
VD
VD
NA
(c)
Figure 4 shows the plot of each of the membership functions
for the inputs. The reason behind the use of Gaussian
Membership Function is the narrow peak which give a
relatively high degree of membership within an acceptable
limit, and also gradual fall after the limit.
(c)
Figure 4 - Input membership functions for (a) cue ball to
object ball length (cm), (b) object ball to pocket length (cm),
and (c) the angle (degree) joining both lengths
Fuzzy inference that is employed is the Sugeno-type with
constant output membership functions. This is sufficient to
the needs in this research. Furthermore, in terms of coding, it
is definitely easier to be done. Sugeno-type inference also
enhances the efficiency of the defuzzification process as one
only need to compute the weighted average.
2.3 Decision Algorithm
The decision algorithm employs the concept of fuzzy logic at
its final stage to get the difficulty of each shot. The best shot
is the easiest shot to sink the object ball into the pocket, and it
is chosen from the fuzzy outputs. In general, the decision
algorithm is shown in Figure 5.
2.4 Computing Relevant Paths
For each shot, a determination of whether a clear path to
target ball from cue ball (center to center) exist for a direct
shot. If the ball must travel from A to B and that there is a ball
at C, (refer to Figure 6)
From the cosine rule, it can be shown that
(a)
u = b cos A =
b2 + c2 a2
2c
(3a)
v = a cos B =
a2 + c2 b2
2c
(3b)
then,
h = b2 u 2 = a2 v2
(4)
START
Table 2 Computer Simulated Data (a) Ball locations on the
boards (b) Fixed Pockets Location
Generate locations
for balls
Ball
Cue
1
2
3
4
5
6
7
Compute possible
shot and relevant
paths
For each possible
shot and path,
compute difficulty
(Fuzzy System)
Location (x,y)
(59,44)
(114,48)
(15,32)
(71,25)
(26,47)
(111,50)
(77,39)
(21,32)
Ball
8
9
10
11
12
13
14
15
Location (x,y)
(114,61)
(44,19)
(137,17)
(128,62)
(38,18)
(10,7)
(102,14)
(134,13)
(a)
Pocket
1
2
3
4
5
6
Location (x,y)
(0,0)
(80,0)
(160,0)
(0,70)
(80,70)
(160,70)
(b)
C
b
c
A
Solid
{Ball, Pocket}
d co
d op
Difficulty
Rank
{3,2}
{4,4}
{6,2}
{7,1}
{8,3}
22.4722
33.1361
18.6815
39.8497
57.5674
26.5707
34.7131
39.1152
38.2753
76.4003
167.5232
143.6980
109.9228
140.8005
109.8440
0.1419
0.2148
0.5322
0.2503
0.7659
1
2
4
3
5
(a)
Stripe
{Ball, Pocket}
d co
d op
Difficulty
Rank
{13,1}
{14,3}
{14,6}
61.400.
52.4309
52.4309
12.2066
59.6657
80.6226
177.9355
158.6679
101.1026
0.0641
0.4076
0.8812
1
2
3
(b)
Figure 8 shows the set of possible shot for solid and stripe
player.
4 Discussion
This paper has shown that, the decision making of sinking a
ball from a set of pool balls on the board can be simulated
using the concept of fuzzy logic. The fuzzy system is able to
choose from a set of relevant paths, the easiest shot to sink a
ball. Also, the fuzzy rules can be changed to suit the players
preference and ability. This flexibility provides a practical,
inexpensive solution. All that is really needed is a practical
understanding of the overall game behavior.
Further research is currently investigating combination shots
and indirect shots (via a cushion) by the cue ball. Again,
fuzzy logic is proposed to be used.
6 Acknowledgements
Thanks to Prof. Peter Grogono from Department of Computer
Science, Concordia University, for sharing his work on
snooker (The Snooker Simulator and Mathematics for
Snooker Simulation), to make this research on pool possible.
References
[1]
[2]
[3]
[4]
5 Conclusions
A decision algorithm for pool playing has been tested
possible in choosing appropriate shot given a set of players
priorities in sinking the balls (rules). The algorithm has been
demonstrated on computer generated pool environments and
results have shown acceptable trajectories based on a players
choice. Results presented in this paper also demonstrate that
virtual environment of simulation is capable of scaling to the
real world situation.
[5]
Figure 7 - Layout of the Board (Playing Area: Lower left (0,0), Upper right (160,70))
(a)
(b)
Figure 8- A set of possible shot for (a) solid player (b) stripe player, of which the best shot is chosen