KöMaL - Középiskolai Matematikai és Fizikai Lapok
 English
Információ
A lap
Pontverseny
Cikkek
Hírek
Fórum

Rendelje meg a KöMaL-t!

KöMaL Füzetek 1: Tálalási javaslatok matematika felvételire

VersenyVizsga portál

Kísérletek.hu

Matematika oktatási portál

I. 223. Prepare a simulation to display the motion of coloured bubbles in the plane. Each bubble is represented by a disk of one-colour, bouncing on an 800×600 image and transforming into one another. Position and velocity of a bubble are given by real coordinate pairs, its radius is a real number, while its colour is a triplet of byte-sized integers in RGB encoding. Each bubble has also a certain mass, equal to the square of its radius, that is, proportional to its area. Bubbles move on the screen in every simulation step according to their velocity. If they leave the simulation area, they reappear on the opposite side with the same velocity, thus moving toward the interior part of the image. When two bubbles hit each other, they merge into one new bubble with

i) mass equal to the sum of the original masses, that is r12+r22;

ii) centre equal to the weighted mean of the centres of the original bubbles:


\left(\frac{r_1^2 \cdot x_1 +r_2^2 \cdot x_2}{r_1^2 +r_2^2};\frac{r_1^2 \cdot y_1 +r_2^2
\cdot y_2}{r_1^2 +r_2^2}\right);

iii) coordinates of velocity given by the law of conservation of momentum


\left(\frac{r_1^2 \cdot vx_1 +r_2^2 \cdot vx_2}{r_1^2 +r_2^2};\frac{r_1^2 \cdot vy_1 +r_2^2
\cdot vy_2}{r_1^2 +r_2^2}\right);

iv) R, G and B components of its colour again equal to the weighted mean of the original components (the weights being the masses).

If this newly created bubble touches a third one, yet another fusion takes place, governed by the same rules.

The first command line argument to your program is the name of a text file to be read. Each line of this file contains initial data for every bubble, separated by a space in the following format: position_x position_y velocity_x velocity_y radius red green blue.

In the example, ``be01.txt'' is the sample input, ``Részlet a szimulációs térből kezdetben'' is ``part of the simulation area in the beginning'', while ``és 10 szimulációs lépés után'' is ``after 10 simulation steps''.

The source code and project files of your solution -- without the i223.exe or any other auxiliary files generated by the compiler -- should be submitted in a compressed folder i223.zip.

(10 points)

Deadline expired on 10 December 2009.


Google Translation (Sorry, the solution is published in Hungarian only.)

A programokat az alábbi tesztállományokkal vizsgáltuk: teszt.zip.

Mintamegoldásként Szabó Attila pécsi, 9. osztályos tanuló Free Pascalban készült (i223.pas) és Balla Attila budapesti, 12. osztályos diák Delphiben készült (i223.zip) munkáját adjuk közre.


Statistics on problem I. 223.
8 students sent a solution.
10 points:Balla Attila, Barta 111 János, Nagy 111 Miklós, Szabó 928 Attila.
8 points:1 student.
7 points:2 students.
5 points:1 student.


  • Problems in Information Technology of KöMaL, November 2009

  • Támogatóink:   Ericsson   Cognex   Emberi Erőforrás Támogatáskezelő   Emberi Erőforrások Minisztériuma   Nemzeti Tehetség Program    
    MTA Energiatudományi Kutatóközpont   MTA Wigner Fizikai Kutatóközpont     Nemzeti
Kulturális Alap   ELTE   Morgan Stanley