Skip to main content
5 of 8
added 11 characters in body
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

#MATL, 35 34 characters

Z"42Gi:qi!+lGqE!/tYo-KM!*|QYoZ}X]( 

Try it online!

###Explanation

This takes care of the reflections using the formula px = abs(t/nx-round(t/nx))*nx, where t is a time variable that increases in steps of 1, nx is the maximum size along the x direction and px is the x position. An analogous formula is used for the y coordinate.

A 2D char array of spaces is initially created, and then it is filled with character * at the computed x and y positions.

Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382