Pascal's Bagatelle Beginner Coder Challenge

This is a discussion on Pascal's Bagatelle Beginner Coder Challenge within the Contests Board forums, part of the Community Boards category; Hi all,
Well i quite liked this one, i saw a maths demo on TV the other day, and thought ...

Pascal's Bagatelle Beginner Coder Challenge

Well i quite liked this one, i saw a maths demo on TV the other day, and thought it would be neat to write, then saw it actually makes for a good little programming problem for beginners methinks.

As I say, I am aiming it at beginners to have a go at. it is probably trivial for more advanced coders, but might provide some interest, I dont really consider myself advanced, but i know this has thrown up some wider project ideas for me at least.

Am keeping open for two weeks, winner is first correct working code sent to me by PM. That satisfies the requirements.
Output validation will be based on the expected distribution for the given parameters.

Sorry i can only accept win console.
Limit of 100 lines actual code, which should be plenty.
C or C++

It is worked around Pascal's triangle but as if it were set in a Bagatelle board where you ping a ball up like pinball and then it drops down into a field of pins and you win money depending where it lands.

This problem requires you to model the outcome of such a game in terms of the landing position of the ball.
As each new ball is dropped into the field then it will bounce off the pins and enventually end up in one of the columns at the bottom, see image:

In the image shown there are 4 columns for this size 'pin field', the arrow shows where a ball is dropped in, then it hits the first pin, and so on, until it finally lands in one of the four possible columns.

Your challenge is to write a program that can simulate this game and show the expected distribution of balls across the columns.

Your program must accept input for the base triangle size, (in the example this would be 3, ie three pins) and successfully show the outcome for the resulting number of columns required for the given base size.

That is to say your program must be able to scale its operation to any size field..

I am not asking for input validation as such, but it should be obvious that the minimum input has to be two.

set number of balls as twenty times your base input, this is just to keep the distribution values up.

Your output must be stored in an array, vector, or other container,number of elements equal to the columns required. - no bigger.

I have received a candidate winner but I think it may be beaten on a technicality.. so am keeping open for now to allow amendments or more entries to challenge.
Based on the feedback received and some of my thinking since re-reading my post i will clarify a couple of points:

one input for the base number of pins (ie triangle size) in the equilateral triangle that forms the obstacles field - everything else is determined programatically, the layout of the pins follows the pattern shown in the image.
Line limit i feel is generous and should encourage beginners to use concise code and suitable constructs - bear in mind it is actual code lines limit, not text layout length
Just in case anyone is digging out the physics engine library, It is simple probability for the paths, no physical effects per se need to be modelled. you just have to imagine a ball dropped in hitting the first pin, then it falls down to the next level hitting one of the two pins on the second level, depending on which direction it fell from the first pin, and so on down until it exits and falls into one of the containers

Congratualtions to jdragyn! The winner of this challenge!
jdragyn submitted the most complete response to the question that i received, a nice bit of code with a neat method to calculate the ball position as it moves through the pin field, well within the line limit boundary and with the output distribution correct.

A mention should go to whiteflags who was first through with a very good answer, that was acheived in a very compact program of around fifty actual lines, great work, I only failed it as it requested input for the number of balls in the game, which i had stated should be done programatically, a minor technicality i know..but a very worthy second place to whiteflags.

A mention should go to whiteflags who was first through with a very good answer, that was acheived in a very compact program of around fifty actual lines, great work, I only failed it as it requested input for the number of balls in the game, which i had stated should be done programatically, a minor technicality i know..but a very worthy second place to whiteflags.

Yeah well I don't want to be a noodle incident. For those curious, this was my code.