• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to make "efficient" AI

 
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 287
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic