Golf game simulation ggs
Download
1 / 9

Golf Game Simulation - PowerPoint PPT Presentation


  • 272 Views
  • Updated On :

Golf Game Simulation (GGS) COP 4331: OO Processes for Software Development © Dr. David A. Workman School of EE and CS University of Central Florida October 25, 2006 Sand Trap Sand Trap Green Sand Trap Lake (Hazzard) Tee Golf Game (Description) World View (PROBLEM DESCRIPTION)

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Golf Game Simulation' - oshin


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Golf game simulation ggs l.jpg

Golf Game Simulation (GGS)

COP 4331: OO Processes for Software Development

© Dr. David A. Workman

School of EE and CS

University of Central Florida

October 25, 2006


Golf game description l.jpg

Sand

Trap

Sand

Trap

Green

Sand

Trap

Lake

(Hazzard)

Tee

Golf Game (Description)

World View (PROBLEM DESCRIPTION)

For those who know golf, this game is straightforward – in concept. Of course, in reality it is one of the most difficult games to play. We have a golf course (this is the virtual world) composed of one or more holes numbered sequentially and arranged in some geometric pattern so that it is relatively easy for golfers to transition from one hole to the next. In real life there are 18 holes on a standard course. However to avoid simulations that require a large amount of input data, we relax the requirement for exactly 18 holes and allow the number of holes to be an input parameter. A typical hole is depicted below.

1

Cup

Flag

Golf Game Sim (c) Dr. Workman


Golf game description3 l.jpg

Sand

Trap

Sand

Trap

1

Green

Sand

Trap

Lake

(Hazzard)

Tee

Cup

Flag

Golf Game (Description)

World View (PROBLEM DESCRIPTION)

There are several features and parameters that characterize a hole. Every hole has a tee area (rectangular) and a green (oval or eliptical). Every green has a cup (the target area for golf strokes ), and every cup has a removable flag that tells golfers which direction the wind is blowing. The line-of-sight distance from the center of the tee to the center of the green is the official distance of the hole (measured in yards – multiples of 50yards, no less than 100 and no more than 600) and determines the value of par – the nominal number of strokes required for golfers to get their golf ball from tee to green and into the cup. If a golfer takes fewer strokes than par performance is “excellent” ( one less than par is called a “birdie”, two less than par an “eagle”, and a hole in one stroke is called an “Ace”). Of course, most golfers take more strokes than par (one over par is called a “bogie”, two over a “double bogie”, etc.); ten strokes over par is the max score on any hole.

To add to the challenge a hole has zero or more hazzards. A hazzard can be a circular sand trap or an elipticle lake placed between tee and green and around the green. In our game, if your ball lands in a sand trap a one stroke penalty is added to your score but you can take the next stroke from where it lands. If your ball lands in a lake, there is a two stroke penalty and you have to replay your stroke from the original position with a new ball.

Golf Game Sim (c) Dr. Workman


Golf game description4 l.jpg
Golf Game (Description)

World View (PROBLEM DESCRIPTION)

Now we consider the golfer and how s/he approaches the game. Every golfer has a golf bag with up to 15 different clubs – including a driver and a putter. The driver is used on the first stroke for exceptionally long holes (par 5). A good drive is between 200 and 300 yards. All strokes on the green require the putter. On 3-par and 4-par holes, an iron may be used off the tee or in the fairway (area between tee and green and outside a hazzard). The distance chart below gives the typical range of distances (low-mean-high) that can be achieved with each of the standard clubs.

Distance to the hole is just one of thevariables in playing a stroke – that is, choosing the correct club. Anothervariable is angle, or angular deviation from a straight line from the ball to thecup. A third variable is wind velocity(a vector quantity defined by the flagon the green). Wind adds to, or subtractsfrom, the distance and angle of a stroke.

Each golfer shall have judgement and execution error mechanisms that create the variance in a stroke – judgementerrors effect distance and wind velocity,execution errors effect angular displacement.

Club Men Women

Driver 200-230-260 150-175-200

3-wood 180-215-235 125-150-180

5-wood 170-195-210 105-135-170

2-iron 170-195-210 105-135-170

3-iron 160-180-200 100-125-160

4-iron 150-170-185 90-120-150

5-iron 140-160-170 80-110-140

6-iron 130-150-160 70-100-130

7-iron 120-140-150 65-90-120

8-iron 110-130-140 60-80-110

9-iron 95-115-130 55-70-95

PW 80-105-120 50-60-80

SW 60-80-100 40-50-60PW = “Pitching Wedge”SW = “Sand Wedge”

Golf Game Sim (c) Dr. Workman


Golf game description5 l.jpg
Golf Game (Description)

The last feature of the game is the golfer’s performance. This will be measured by the total number of strokes and lost balls (lost to lake hazzards or out-of-bounds). A stroke that lands outside the rectangle defining the boundary of a hole shall accrue a three-stroke penalty and a lost ball. The stroke must be replayed from the original spot with a new ball. The score and lost ball count should be output for each golfer as part of the "after simulation report".

Golf Game Sim (c) Dr. Workman


Hints and suggestions l.jpg
Hints and Suggestions

  • Use the 2D Vector class I shall provide as reusable code. The position of each hole (origin) can be specified as a 2D vector. Likewise, the center of each tee, green and hazzard can be specified as vectors relative to the origin of a given hole. The position of the cup can be specified as a vector relative to the center of the corresponding green.

  • Using simple sum and difference of vectors, one can compute the position of the golf ball after a stroke relative to the center of each hazzard and green. The length of this vector will tell you whether or not the ball landed in the fairway, out of bounds, in a hazzard, or on the green.

  • The orientation of the green and lake hazzards can be specified by an angle of rotation of the major axis relative to the X-axis of your golf course coordinate system.

  • (More hints later).

Golf Game Sim (c) Dr. Workman


More data l.jpg
More Data

Loft Angles for Clubs

4-Iron = 25o

5-Iron = 28o

6-Iron = 31o

7-Iron = 34o

8-Iron = 37o

9-Iron = 41o

Pitching Wedge = 45o

Gap Wedge = 50o

Sand Wedge = 55o

Lob Wedge = 60o

Shaft

Loft Angle

Hosel

Blade

Golf Game Sim (c) Dr. Workman


Geometry of hazzards l.jpg
Geometry of Hazzards

R

+Y

C

R = ( r,  )polar

= ( a*cos(), b*sin() )cart

R

b = semi-minor axis

+X

a = semi-major axis

Golf Game Sim (c) Dr. Workman


Geometry of hazzards9 l.jpg
Geometry of Hazzards

+Y

'

C

-

V = B - C

V-

Ball (B)

+X

Ball is in the Trap if and only if |V-| < r'.

Golf Game Sim (c) Dr. Workman


ad