Mathematical and Physical Journal
for High Schools
Issued by the MATFUND Foundation
 Already signed up? New to KöMaL?

# Problem I. 307. (December 2012)

I. 307. We investigated the paths of billiard balls in problem I. 298: we were given a square billiard table of size N×N with point-like balls initially having integer coordinates within the table. Balls are reflected in a perfectly elastic manner when colliding with each other or with the boundary.

Your program i307 should first read the parameter values, then save the path of a ball with two collisions into a file using SVG vector graphics format. The ball is started from a point with coordinates (k,l) and hits another ball located at (x,y).

The ball should have 2 collisions with the walls and it should not touch any third ball. (The reason we do not consider collisions with other balls in our model is that -- due to the perfectly elastic central collisions -- the ball hit by the original one would begin travelling in the same direction.) If the moving ball hits the corner of the table, then the outgoing trajectory will be the same as the incoming one and we count this as two wall collisions. The output of your program is an image of the billiard table, the balls and the path with 2 wall collisions depicted as arrows in an SVG file.

Generating an SVG figure was the topic of our problem I. 243, but you can find more information on the image structure at, e.g., http://svg.elte.hu/''.

You can set properties of graphical elements (e.g., color, line thickness) arbitrarily.

The command line input to your program is the name of the data file describing the initial conditions. The first line of the file contains the size of the board N (2N50) and the number of balls M (1<M20). The next M lines describe the coordinates of the balls, then coordinates of the source ball (k,l) (1k,lN) and the target ball (x,y) follow. The lower left corner of the table has coordinates (1,1) and the first coordinate increases to the right, while the second one upwards.

In the example Példa a bemenetre'' is a sample input, while Kimenet SVG ábrája'' is the SVG image of the corresponding output.

The source code of your program (i307.pas, i307.cpp, ...) together with a short documentation (i307.txt, i307.pdf, ...) should be submitted in a compressed file i307.zip, also containing a brief description of your solution and specifying the name of the developer environment to use for compiling the source code.

(10 pont)

Deadline expired on January 10, 2013.

Sorry, the solution is available only in Hungarian. Google translation

Mintamegoldás:

Fényes Balázs 10. évfolyamos tanuló (Budapest, Szerb Antal Gimnázium) i307.cs és leírása. Néhány ábra a versenyzők munkájából a következő tesztadatokra:

Fényes Balázs ábrája

Gema Barnabás 12. évfolyamos tanuló (Veszprém, Lovassy László Gimnázium) ábrája:

Jákli Aida Karolina 10. évfolyamos tanuló (Zalaegerszeg, Zrínyi Miklós Gimnázium) ábrája:

Qian Lívia 10. évfolyamos tanuló (Szeged, SZTE Ságvári E. Gyakorló Gimnázium) ábrája:

Varga Erik 12. évfolyamos tanuló (Budapest, Berzsenyi Dániel Gimnázium) ábrája:

Hornák Bence 9. évfolyamos tanuló (Budapest, Berzsenyi Dániel Gimnázium) ábrája:

### Statistics:

 7 students sent a solution. 10 points: Fényes Balázs, Gema Barnabás, Hornák Bence, Jákli Aida Karolina, Qian Lívia, Varga 256 Erik. 5 points: 1 student.

Problems in Information Technology of KöMaL, December 2012