This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-03-09 19:32:39

coolhogs
Scratcher
Registered: 2011-07-26
Posts: 1000+

Beatable Pong AI

I need a beatable pong AI for my game, Pong- Ultimate Line... I need it to be beatable, not a AI that follows the ball... That's impossible, not beatable.


Get ready for domination of:  tongue

Offline

 

#2 2012-03-09 19:50:10

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: Beatable Pong AI

Actually, one that follows the ball is beatable. Your version can be hard.

Offline

 

#3 2012-03-09 20:09:06

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Beatable Pong AI

Just have it follow the ball...but slowly.  Don't just set the position to the ball position, instead use a velocity variable that changes sign (and maybe magnitude) depending on which side the ball is with respect to the paddle.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#4 2012-03-09 20:21:21

coolhogs
Scratcher
Registered: 2011-07-26
Posts: 1000+

Re: Beatable Pong AI

Paddle2See wrote:

Just have it follow the ball...but slowly.  Don't just set the position to the ball position, instead use a velocity variable that changes sign (and maybe magnitude) depending on which side the ball is with respect to the paddle.

I'm confused...


Get ready for domination of:  tongue

Offline

 

#5 2012-03-09 20:29:58

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

Re: Beatable Pong AI

coolhogs wrote:

Paddle2See wrote:

Just have it follow the ball...but slowly.  Don't just set the position to the ball position, instead use a velocity variable that changes sign (and maybe magnitude) depending on which side the ball is with respect to the paddle.

I'm confused...

Have the AI's paddle follow the ball, but slowly, speeding up as it gains velocity.


http://trinary.tk/images/signature_.php

Offline

 

#6 2012-03-09 20:34:02

coolhogs
Scratcher
Registered: 2011-07-26
Posts: 1000+

Re: Beatable Pong AI

Ok, so how do I make it move so that it follows the ball...


Get ready for domination of:  tongue

Offline

 

#7 2012-03-09 20:45:55

PullJosh
Scratcher
Registered: 2011-08-01
Posts: 500+

Re: Beatable Pong AI

I have one right here. You can download it and use it if you want. Just make sure to give credit in the project notes!  wink


http://www.blocks.scratchr.org/API.php?action=text&string=I'm_on_vacation!&xpos=155&ypos=90&font_size=30&bgimage=http://imageshack.us/a/img339/7215/sspeechsigapiforwords.png

Offline

 

#8 2012-03-09 21:08:33

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Beatable Pong AI

when gf clicked
set [y-vel] to (0)
forever
if<(y position) > ([y position] of [ball v]) >
change [y-vel] by (-.3)
else
change [y-vel] by (.3)
end
change y by (y-vel)
end

Last edited by MoreGamesNow (2012-03-09 21:08:45)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#9 2012-03-09 21:12:09

coolhogs
Scratcher
Registered: 2011-07-26
Posts: 1000+

Re: Beatable Pong AI

MoreGamesNow wrote:

when gf clicked
set [y-vel] to (0)
forever
if<(y position) > ([y position] of [ball v]) >
change [y-vel] by (-.3)
else
change [y-vel] by (.3)
end
change y by (y-vel)
end

Thanks!  smile  Should I give credit to you?

Last edited by coolhogs (2012-03-09 21:24:53)


Get ready for domination of:  tongue

Offline

 

#10 2012-03-09 22:11:59

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Beatable Pong AI

That would be nice, but not necessary  smile

Last edited by MoreGamesNow (2012-03-09 22:16:45)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#11 2012-03-09 22:40:39

coolhogs
Scratcher
Registered: 2011-07-26
Posts: 1000+

Re: Beatable Pong AI

Mods close every topic including Pong and Coolhogs.


Get ready for domination of:  tongue

Offline

 

#12 2012-03-09 22:46:47

cheddargirl
Scratch Team
Registered: 2008-09-15
Posts: 1000+

Re: Beatable Pong AI

Closed by request.


http://i.imgur.com/8QRYx.png
Everything is better when you add a little cheddar, because when you have cheese your life is at ease  smile

Offline

 

Board footer