Puzzle 3 – Bowling Alley
You may have played the game of bowling. This time’s logic builder is to build a very simple bowling game to find out how many pins you knocked down.
Rules
- 10 pins. Numbered 1 to 10. As shown in the image
- Ball will hit a front pin only, hitting a pin is ensured to knock it down
- Every pin knocked, will knock down two adjuscent pins in the next line if they are up. So hitting 5 will knock down 5, 1 and 2. Hitting 10 will knock down all pins.
- No need to worry about the angle or speed at which the ball will hit the pin.
Input
- The number of the pin the ball hit. 0 if no pins hit.
Output
- The count of pins knocked down.
- If you can show which pins were knocked, that is a bonus!
Go figure!
And if you wanted to play some online Bowling, you can do that on Yahoo! Games
Yogesh in my office made a cool solution to this. He actually used penguins for the pins and when you submit to roll the ball, the penguins that were hit, will fall down! The smart fellow even used AJAX and some JS effects to make it more dramatic! Cool!
Hi! Okay, so I’m the defending number one bowler in my state, and I just wanted to tell you some things you had wrong.
1.
“10 pins. Numbered 1 to 10. As shown in the image”
You have them numbered backward.
It is:
1
2 3
4 5 6
7 8 9 10
2.
“Ball will hit a front pin only…”
Your ball can hit the 10 or 7 pin alone without hitting any others. Just because you don’t want to hit a back pin alone on a strike ball, doesn’t mean it doesn’t happen.
3.
“No need to worry about the angle or speed at which the ball will hit the pin.”
That is all wrong. Bowling isn’t all about logic. Most of it is math and skill. The speed and the angle at which you throw the ball are two of the most important factors of bowling correctly.
plsssssssssss get a project of bowling alley written in c language using computer graphics
Hi Guys,
This is a simple programming puzzle. I am not a Bowling expert, so excuse my getting the pin numbers wrong.
The Logic Builder is a computer programming assignment to improve your programming skills. This example is not meant to be correct about the game of Bowling at all.
I agree that speed and angle are very important for bowling. But we don’t consider them for this puzzle.
:Nirav