Simulate Golf Game Strategy
Posted
by Mitchel Sellers
on Stack Overflow
See other posts from Stack Overflow
or by Mitchel Sellers
Published on 2010-03-24T14:27:00Z
Indexed on
2010/03/24
16:43 UTC
Read the original article
Hit count: 156
I am working on what at best could be considered a "primitive" golf game, where after a certain bit of randomness is introduced I need to play out a hole of golf. The hole is static and I am not concerned about the UI aspect as I just have to draw a line on a graphic of the hole after the ball has been hit showing where it traveled.
I'm looking for input on thoughts of how to manage the "logic" side of the puzzle, below are some of my thoughts on the matter, input, suggestions, or references are greatly appreciated.
- Map out the hole into an array with a specific amount of precision, noting the type of surface: out of bounds, fairway, rough, green, sand, water, and most important the hole.
- Map out "regions" and if the ball is contained inside one of these regions setup parameters for "maximum" angle of departure. (For example the first part of the hole the shot must be between certain angles
- Using the current placement of the ball, and the region contained in #2, define a routine to randomly select the shooting angle, and power then move the ball, adjust the trajectory and move again.
I know this isn't the "most elegant" solution, but in reality, we are looking for a quick and dirty solution, as I just have to do this a few times, set it and forget it afterward.
From a languages perspective I'll be using ASP.NET and C# to get this done.
© Stack Overflow or respective owner