Problem 1276. PONG 002: Rectangle, Interactive Download, Easier Play
Variation of the Original Classic PONG game brought to Cody. PONG 002 is a rectangular board (2000,1000) with slower initial velocities and more precise paddle movement. PONG 2 uses plot and fill versus patches to improve video play. The faster square version is PONG 001

Attempt to keep the ball alive against a Wall. The ball speeds up on every hit. When it is missed it restarts at a new location. 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.
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_002a.m file that creates a solver script and video has been posted at PONG_Interactive_002b.m. (Right click, 'save link as'). The routine creates a PONG_002_solver.m script from the interactive play. The script demonstrates Interactivity, figure/KeyPressFcn, listdlg, and VideoWriter.
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 ball=[500 500 30 20]; % x y vx vy Positon and Velocity, Treated as a Point
Output: Direction
1 for Up, -1 for Down, 0-No move Paddle moves 25*direction, quarter paddle. abs(direction)<=1 is allowed
Pass Criteria: 15 hits, a score of 425 or better
Scoring: 100 - 5 * Hits + 100 * Lives, (500 - 5 * hits for < 100 hits)
Game Theory: Position Paddle to minimize travel to next location. Vx=1.08*Vx and Vy=1.04*Vy after every return.
Near Future: Multi-Ball Three Wall, Paddle vs Paddle (Mirror), Angle variation based on Paddle/Ball Position
Solution Stats
Solution Comments
Show commentsGroup

Indexing III
- 23 Problems
- 44 Finishers
- expand intervals vol.3
- remove single elements
- return row and column indices given 2 values which define a range
- expand intervals vol.2
- compress sequence into intervals
- expand intervals
- Max Change in Consecutive Elements
- remove single elements
- Back to basics - mean of corner elements of a matrix
- Time Expansion
- Three...is a magic number.
- counting groups!
- Largest territory
- Replace pattern 0 1 0 and 1 0 1
- Find the index of n in magic(n)
- Sum of odd numbers in a matrix
- return row and column indices given 2 values which define a range
- Another colon problem
- How unique?
- Finding neighbors of [-1:1] in a matrix....
- Find the maximum two numbers of every column of a matrix
- Index one element in each vector of an array along a given dimension
- Tridiagonal
- Index of a Rational number
- Sort numbers by outside digits
Problem Recent Solvers4
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!