Lets play golf while we golf.
Problem:
- Distance to the hole initially is 700m
- Each hit to the ball will make it advance to the hole 250-350m, this should be random.
- Each hit has a 5% probabilities of going into water, this will make the quantity of hits increase by 1 as a penalty.
- When ball is under 250m it will advance 70% to 90% (random again) of missing distance with a probability of 80%, Advance 90% to 99% with 14% Probability, 1% of doing 10%(and finishing) and 5% of going to water and increasing the number of hits by 1 as a penalty.
- When ball is under 10m it has 95% of going into hole (finishing) and 5% of advancing 75% of the missing path. No probability of going water.
Clarifications:
-Imagine ball is 270m from hole, if we hit for 300m, the distance to the hole is now 30, this means, distance will be absolute value.
-Numbers will always be integer due to deal the probability of hitting for example 300m when ball is 300m away from the hole.
-Round down number of m of the hit, imagine you are at 1m , if you fall on 5% of not going into the hole, it will advance 0.
Input:
Nothing
Output:
Distance to the hole in each hit /n
Total number of hits
Example output (don't print comments)
433m //Hit for 267m (700-267=433)
130m //Hit for 303m (433-303=130)
130m //Ball on water +1 penalty hit
35m //Hit for 95m (130-95=35)
7m //Hit for 28m (35-28=7
0m //Ball on hole
Total hits 7 //6 hits +1 penalty
This is codegolf!