8
2
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!
Can you add a full work through example? If the ball goes in the water is the distance where it was when it was hit or where it should be if it wasn't in the water? – TheLethalCoder – 2017-06-02T11:33:37.070
@TheLethalCoder if it goes to water the distance doesn't change, repeat the last hit – Java Gonzar – 2017-06-02T11:44:38.000
@NeilSlater the problem is that you don't know how many hits there will be so how many inputs? – Java Gonzar – 2017-06-02T11:46:08.603
Hey! Welcome to PPCG! In my opinion, this is a good first challenge! Good luck for future! :) – Arjun – 2017-06-02T11:46:36.983
When the ball is under 10m, is there still a 5% chance the ball goes in the water? – musicman523 – 2017-06-02T12:02:34.603
Should the distance always be an integer? – musicman523 – 2017-06-02T12:10:02.643
@musicman523 Edited now to fill those questions :) – Java Gonzar – 2017-06-02T12:13:21.077
If distances are always integers, should resulting distance be rounded away from the hole (so there is only the 1% chance of actually hitting the hole? Or could a 90% shot at 2m distance also hit the hole? (I'm guessing the
10%(and finishing)
should be100%
. – lrn – 2017-06-02T12:13:31.820@Irn 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. – Java Gonzar – 2017-06-02T12:16:36.323
The "random" 250-350 hit, should this be uniformly random? – lrn – 2017-06-02T12:16:48.173
@Irn, yes, if the random number generated from 0-100 is 55, the hit will be 305 – Java Gonzar – 2017-06-02T12:18:30.177
As submissions have gone ahead as-is, I have removed my comments. There is no absolute need to alter your challenge IMO. I think there is a pre-challenge review process you can use to discuss design issues in future before inviting competitors. – Neil Slater – 2017-06-02T12:25:53.793
@NeilSlater Thank you Neil :) – Java Gonzar – 2017-06-02T12:27:49.043
@NeilSlater That's the Sandbox.
– wizzwizz4 – 2017-06-02T12:29:57.570I tried, but there are far too many percentage-based conditionals and RNG for this to really work in Braingolf. – Skidsdev – 2017-06-02T16:02:14.923
Do we need to print the 'm' in the distances? Should we print 700m at the beginning? – musicman523 – 2017-06-02T18:42:19.887
Yes, m should be printed although it is not necessary to print the first distance (700m) – Java Gonzar – 2017-06-02T20:10:28.940