I created the following applet. It is similar to what you want.
You can change initial positions with different initialization code and add rules for your game.
You can drag from the center of the blue particle to change it's velocity when it is in paused state.
The blue particle will start to move when you release the mouse.
You can change the friction coefficient mu and elastic coefficient k.
k=1 means elastic collision without energy. k<1 then energy is loss due to collision.
Because the particle move in the same direction when there is no collision.
The friction force , from
The energy loss is where d is the distance traveled.
d can be calculated between each time step.
And kinetic energy will be loss due to friction.
So I re-calculate velocity after each time step.
And if the right hand side become smaller than zero, it means that the particle should have been stopped.
(So velocity has to be set to zero).
I think I should only help you from the physics point of view.
The rest work should be your job, waiting for you to finish it.
I will be glad to help you if you have questions related to physics!