Small test in SmallTalk
Author Message
Small test in SmallTalk

Hi !

This is the final exam of the intro course in Smalltalk (CS course) at
sherbrooke
university in canada.  You have one hour to read it and code it.

Billard game

A player trains himself at billard.  There are only 2 balls: his , red
and the black one that he must send in one of the six pockets of the
table.  A pocket is twice the diameter of a ball.   The lenght of the
table is n * m. eg. in pixels or other..
The player can do rebounds by the sides.  For a shot, he chooses the
red ball's hitting force and its direction towards the center of the black

simplify it, we suppose that he doesn't put any effect in his shot meaning
that he hits the red ball in dead center.  Also, we suppose the red ball
keeps its speed before impact on the black ball.  After impact, the balls
slow down according to friction .  For example, a possible formula would
be V = V0 - F * t where F is the friction force and t is time but this is
not important in the solution's structure.  We will consider that the
balls will come  to a stop when their speed is little.  We could restrain
or not the problem by supposing that, after impact, there will not be
another impact with themselves.  This description doesn't specify all the
details, it's for you to judge and choose the other factors that aren't
specify.  For the display, do a simulation of a table.  For the
controller, either we could read the speed and the direction from a file
either read in a interactive window or use two click from the mouse to
give the direction and the strength of the shot.

Good luck, and remember one hour including the time you spent reading and
understanding ;-) .

Regards,
Charles

Wed, 18 Jun 1902 08:00:00 GMT

 Page 1 of 1 [ 1 post ]

Relevant Pages