Problem 1279. PONG 003: 3-Ball Rectangle, Interactive Download

Variation of the Original Classic PONG game brought to Cody. PONG 003 is a rectangular board (2000,1000) with reasonable velocities and precision paddle movement. Three Times the Fun with 3-Balls.

Other Cody PONG Games: PONG 001 and PONG 002

Attempt to keep the balls alive against a Wall. The balls speeds up on every hit. When all have been missed the next round restarts the balls at new locations. The start locations and sequences are purely deterministic. Movement of the paddle are max up/down steps of -1 to 1 (effective delta 25) or no move. Partial paddle moves allowed. The Balls do not interact with each other.

Paddle center is provided and paddle covers +/- 50 units. The field is rectangular at 2000 by 1000 with 3 walls and the lower left corner being (0,0)

To aid in development of your routine, a PONG_Interactive_003c.m file that creates a solver script and video has been posted at PONG_Interactive_003c.m. (Right click, 'save link as'). The routine creates a PONG_003_solver.m script from the interactive play. The script demonstrates Interactivity, figure/KeyPressFcn, listdlg, and VideoWriter.

3-Ball PONG Demo Video MP4 (Rt Click, Open in New Tab)

Inputs: (paddle,ball)

     paddle = 500 ; %Paddle Center on the Y-axis, Paddle is +/- 50 from center
     balls=[500 500 32 20;500 550 30 18;500 450 28 22;450 550 33 20;450 450 29 21];
     % x y vx vy  Position and Velocity, 1 - Row per ball
     %Passed Balls are [-50 -50 -50 -50]

Output: Direction

   1 for Up, -1 for Down, 0-No move
   Paddle moves 25*direction, quarter paddle. abs(direction)<=1 is allowed

Pass Criteria: Score of 925 or better

Scoring: 600 - Hits + 100 * Lives; Hit=(ActiveBalls)^2

Game Theory: Position Paddle to minimize travel to next ball while taking into account multiple ball score bonus. Vx=1.08*Vx and Vy=1.04*Vy after every return.

Near Future: Paddle vs Paddle (Mirror), Angle variation based on Paddle/Ball Position, Multi-Ball with Ball-Ball Collision

Solution Stats

44.44% Correct | 55.56% Incorrect
Last Solution submitted on Apr 03, 2021

Solution Comments

Show comments

Problem Recent Solvers3

Suggested Problems

More from this Author294

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!