title: How to extrapolate position in pong?
body: <p>Ok I have another pong related question. Now I'm trying to improve "AI". I read on the internet that I should predict ball's x and y and move there paddle.</p>
  
  <p>Heres my equations.
   <img src="https://i.stack.imgur.com/mA13d.png" alt="enter image description here"></p>
  
  <pre><code>y=ax+b
  a1=(y1-y2)/(x1-x2) - a of the circles line, x1, y1 are taken before movent and x2 y2 after.
  b1=y1-ax1
  </code></pre>
  
  <p>then I calculated coord for the line of paddle movement using constants like pos 0 0 and screen height, width.</p>
  
  <p>To calculate point of intersetcion I made equation: <code>a1x4+b1=a2x4+b2</code>. <code>a1 b1 b2 a2</code> are things I calculated before. And it doesnt work :P What's wrong ?</p>