After implementing Pacman and Snake I\'m implementing the next very very classic game: Pong.
The implementation is really simple, but I just have one little problem rema
Quoting from the very enjoyable book "Racing the Beam" (Google Books: http://books.google.co.uk/books?id=DqePfdz_x6gC&lpg=PP1&dq=racing%20the%20beam&pg=PA40#v=onepage&q&f=false) the original technique was:
To help simulate the human error inherent in precise paddle positioning, The AI paddle skips its adjustment every eight frames. The resulting behaviour is visibly unnoticeable, but it allows the computer player's aim to drift enough that it occasionally misses the ball. It is also technically trivial to implement, requiring only a single mask and the binary AND operation, for which there exists a corresponding 6502 instruction. The programmer can test if the result is zero with another single opcode, branching if needed to skip the instructions that move the paddle.
Even this behaviour must be modified slightly for the game to work at all. If the AI player simply stopped tracking the ball every eight frames, it would be hopelessly out of sync within a few seconds. To prevent this, the AI follows a secondary ball-tracking scheme near the top and bottom of the playfield. If the ball collides with one of these walls while the paddle is also aligned with it, the paddle readjusts, recovering from any drift that had accumulated since the ball last struck the wall. The result is a stochastic misalignment and realignment of computer paddle and ball.