For some months now , i have been searching for how to make an AI pong game, but i don't get a useful or helpful answer, but now i think i have it now, if you think u have a better idea , about how to make a better AI for a pong game. let me know on the comment.
i will share how i made my, i created a variable that keep track of the ball position, so i will know where the ball is then i assign the y axis position of the tracker to the AI , making it this way make the AI move along with the ball but impossible to get a point from the AI . so i created another variable call speed, then i made the speed variable control how fast the AI will be, then i set the speed lower than the ball speed. this create an idea like, the AI knows where the ball is so it will try to get there so sometimes it looses the ball and we will get a point. but even when the AI play's and the ball is moving towers the Player, it will still try's to move to the y axis of the ball position and i didn't like it, so i created a variable that keeps track of the direction of the ball, if is moving tower the player it stop's moving but when the ball is moving towers it' self , we start tracking the position again.
So it will be simple for you to create how difficult the game will be by adjusting the speed variable, the higher the speed is the more intelligent it will becomes and the lower the speed is the easier to win a point.
THIS IS HOW I MADE MY AI PONG GAME (AI VS PLAYER)
if you have a better idea let me know at the comment