Well actually I only need motion on XY-Plane(no rolling motion…cuz flat pieces as shown in the fig. below)
As in fig. During AI’s turn it needs to pit a piece (aka balls in pool) in hole, it only tries to pit its white/black pieces only.
Now the Final AI Function should return 3 values
1. Striker’s position on the Strip.
2. Striker’s Aim’s position (where to put cross-hair….where to hit !) and
3. Initial velocity (How hard to hit !)
Now lets assume for-now 100% hit rate….later random garbage value can then be added to these 100% Hit value to get lower difficulties of AI(missed hits !).
Now the Striker can hit a piece in a hole
1. Directly (Striker hits piece, piece falls in hole).
2. Indirectly (Striker hits a piece,……. that piece hits our intended piece then it falls in hole).
3. Rebound Shot (Striker hits a board wall and then rebounds to hit our intend piece which then falls in hole)
Now I was thinking like
Loop through all holes
{
For current hole -> Loop through all available piece to hit
{
Now if( a line passing through curr hole’s pos and curr piece’s pos also intersect Striker placing
strip and does not hit any other piece on the way)
{
Well, we got an answer for 1st case Striker Hit
Add this Shot to Available shots array along with its “Shot Weightage”.
Now How to get those other case also ?
}
}
}
Then finally shot with highest/lowest Shot weightage will be chosen as current shot.
This will be required because we will be looping for every piece on board and every piece will probably be shot to hole using 2nd case of Striker Hit(multi-level collisions)….and we don’t want our AI to pull “Super Human” or “Vulcan” or “Rajnikanth” precision shots.
So how to put weight to these selected shots ?
Now this is what I came up with. Anyone with any other brilliant idea…….And people please talk !
Some Points To Note :
1] Now there is a StackOverflow post with exact same heading...(So the NEW in the Heading)
http://stackoverflow...ool-billiard-ai
But the guys there have discussed "What needs to be done"......we want "How" so a functional code can be put together.
2] NO we cant go for "RandomShots>>genetic algo>>assessed using neural network" because we are in very limited CPU time and memory budget..Mobile platform.
3] We need to find those shots directly(without any kind of simulation) using maths,trigonometry,distance formula, etc
4] For velocity...we know final max velocity allowed to pit a piece so we just go on adding the amount of velocity reduce
due to friction and between collisions....to get initial velocity to fire the shot, which will be also in limited so if required initial
velocity is greater than "max allowed initial velocity" than assign Highest/lowest "Shot weightage" to current shot.
Thanks in advance for the patience.