• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to make "efficient" AI

 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I made Pong (by myself). The only part I am stuck on is the AI. I am having trouble between making it unbeatable and too easy. So far it is doing the speed of the ball - 1. That is unbeatable. If you do the speed of the ball - 2, it is too easy. If you do the speed of the ball - 1.25, it is great on fast balls and fails on slow ones (obviously). How do I get this to balance out? Code will be provided on request.
Thanks,
cc11rocks
 
Mich Robinson
Ranch Hand
Posts: 260
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't know you needed much AI for pong but ...

rather than adjusting the speed of the game could you just adjust where the program wants to stick it's paddle. Assuming it decides where the paddle should be the moment you hit the ball then just adjust this position by a random amount depending on the level - on easy make it a large random amount and on hard don't vary it at all. You could increase the speed by a small fraction at the same time just to make it more "exciting" as well.

Mike
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic