text:
Draw an hourglass
Again inspired by a task for Programming 101 here's another challenge.
Input:

A positive integer n >= 3. (has to be odd)

Output:

n lines of asterisks, where the first line has n asterisks and every new line has two asterisks less than the line before. Until hitting 1 asterisk. From there every new line has two asterisks more than the line before until getting back to n asterisks. Spaces or something like spaces have to used to align the asterisks so that it really will look like an hourglass.

General rules:

Trailing newlines are allowed but do not have to be used.
indentation is a must.
This is code-golf, so shortest answer in bytes wins.
Since the course is taught in C++, I'm eager to see solutions in C++.

Test case (n=5):
*****
 ***
  *
 ***
*****

I don't see how this is the duplicate of "Draw an asterisk triangle". This has indentation and a down-up sequence where the triangle is only upwards.

@KarlNapf: Before the last edit you had the option of printing it without indentation meaning it was just a triangle from the other question printed as in that question and once in reverse.

@Emigna Yes i know, already answered like that. But now it isnt anymore, so it should be open again.

Possible duplicate of Draw an asterisk triangle

@Oliver Considering OP wrote "Draw an asterisk triangle", I'm not entirely sure that calling this challenge a duplicate is fair. It is definitely related, though.

Can we assume the input is always >=3 and always odd?

Since not everyone here knows the full context, OP originally posted the "Draw an asterisk triangle" and edited this challenge in as an additional challenge. We told them to remove that part and make it a different challenge (which they did). This challenge is not a duplicate. OP is doing what many high rep users, and even a few mods have recommended.

@closevoters could you remove your dupe votes? This question is no longer a duplicate of that question

Is it necessary to have enough trailing spaces to make the output square, or is "*****\n **\n  \n \n" acceptable output? (With two spaces before the single asterisk, which SO edits to a single space!)

@JDL: As outlined in the rules, it has to be "square" (i.e. has to use indentation).

@ʰᵈˑ: yes, you don't have to check the input as this would lengthen the code unnecessarily.

@Sickboy I get that the stars have to align, but do we need any spaces to the right of the stars?

@JDL: No, why would you? Ah, now I understand what you meant by square... :-D

Charcoal, 6 bytes
Ｇ↘←↗Ｎ*

Dead simple. Draw a polyGon of *, with side length taken from an input Number, where the sides go down-and-right, horizontally left, and up-and-right:
*   *
 * *
  *
 * *
*****

Then autocomplete the outline and fill it.
*****
 ***
  *
 ***
*****

Try it online!

Hah, that's pretty bonkers!

This language is very interesting! I'll be watching this very closely from now on :p.

Haven't seen this language before... Looks interesting! I wonder what you'd get if you combined it with Jelly somehow...

Python 2, 57 bytes
N=n=input()
exec"print('*'*max(n,2-n)).center(N);n-=2;"*n

A full program. Goes line by line, printing the right number of asterisks centered.
A recursive function was longer (67 bytes):
f=lambda n,p='':p+n*'*'+'\n'+(1%n*' 'and f(n-2,p+' ')+p+n*'*'+'\n')

or
f=lambda n,p='':1/n*(p+'*\n')or f(n-2,p+' ').join([p+n*'*'+'\n']*2)

I wanted to suggest trying to replace the max with an abs,  but all I got is abs(n-1)+1, which is worse because the addition requires parenthesis

@njzk2 You can cut the parens by doing '*'*-~abs(n-1), but then it's the same length as '*'*max(n,2-n).

There's def f(n,s=''):r=s+'*'*n+'\n';return 1/n*r or r+f(n-2,s+' ')+r for 61 bytes, but it's still longer. Even with a leading newline, def f(n,s='\n'):r=s+'*'*n;return 1/n*r or r+f(n-2,s+' ')+r is still 58 bytes...

+1 for teaching me about center. Never knew that existed till now.

C++ Metatemplates, 186 bytes
With the explicit formula from my C answer the Metatemplates are competing!
template<int N,int X=N*N+N-1>struct H{enum{I=X/(N+1)-N/2,J=X%(N+1)-N/2-1};S s{(J==-N/2-1?'\n':((I>=J&I>=-J)|(I<=J&I<=-J)?'*':' '))+H<N,X-1>().s};};template<int N>struct H<N,-1>{S s="";};

Ungolfed:
using S=std::string;

template <int N, int X=N*N+N-1>
struct H{
 enum{I=X/(N+1)-N/2,J=X%(N+1)-N/2-1};
 S s{(J==-N/2-1 ? '\n' : ( (I>=J&I>=-J)|(I<=J&I<=-J) ?'*':' '))+H<N,X-1>().s};
};

template <int N> struct H<N,-1> {S s="";};

usage:
std::cout << H<5>().s;

non-competing
Just for the sake of fun:
//T: Tuple of chars
template <char C, char...Tail> struct T { S r=S(1,C)+T<Tail...>().r; };

//specialization for single char
template <char C> struct T<C> { S r=S(1,C); };

//M: Repeated char
template <int N, char C> struct M { S r=S(N,C); };

//U: concatenates T and M
template <class Head, class...Tail> struct U { S r=Head().r+U<Tail...>().r; };

//specialization for Tail=M
template <int N, char C> struct U<M<N,C>> { S r{M<N,C>().r}; };

//specialization for Tail=T
template <char...C> struct U<T<C...>> { S r=T<C...>().r; };

//finally the Hourglass
template <int N, int I=0> struct H {
 S s=U<
       M<I,' '>,
       M<N,'*'>,
       T<'\n'>
      >().r;
 S r{s + H<N-2,I+1>().r + s};
};

//specialization for recursion end
template <int I> struct H<1,I> {
 S r=U<
       M<I,' '>,
       T<'*','\n'>
      >().r;
};

Usage:
std::cout << H<5>().r;

+1 for beating PHP with the most long-winded part of C++

V, 12 bytes
Àé*hòl3Äjxx>

Try it online!
I like challenges like this because I get to show off the advantages of V's 2D nature. Explanation. First, we need to create a string of n asterisks. So, we do this:
À           " Arg1 times:
 é          " Insert the following single character:
  *         " '*'

As a side note, this is directly equivalent to @ai*<esc> in vim, and register @a is pre-initialized to "arg1". This makes numeric input much more convenient.
Then, we move on character to the right with h. Here is the fun part:
ò           " Until an error is thrown:
 l          "   Move one character to the right. This will throw an error on anyline with only one asterisk in it
  3Ä        "   Make 3 copies of this line
    j       "   Move down one line
     xx     "   Delete two characters
       >    "   Indent this line once.

Now technically, this last part is
òl3Äjxx>>ò

Because the indent command is actually >>. V conveniently assumes incomplete commands apply to the current line, and also implicitly fills in the second ò character for looping.

Python, 78 bytes
So only with indentation:
f=lambda n,i=0:n>1and' '*i+'*'*n+'\n'+f(n-2,i+1)+' '*i+'*'*n+'\n'or' '*i+'*\n'

Usage:
print f(5)

PowerShell v2+, 54 bytes
param($n)$n..1+2..$n|?{$_%2}|%{" "*(($n-$_)/2)+"*"*$_}

Takes input $n (guaranteed to be an odd integer), constructs two ranges with $n..1 and 2..$n and concatenates them together, then uses Where-Object to select only the odd ones with |?{$_%2}. Those are fed into a loop. Each iteration, we construct the appropriate number of spaces, string-concatenated with the appropriate number of asterisks. Those strings are left on the pipeline, and output via implicit Write-Output inserts newlines between them at program completion.
Examples
PS C:\Tools\Scripts\golfing> 3,5,7|%{.\draw-an-hourglass.ps1 $_;""}
***
 *
***

*****
 ***
  *
 ***
*****

*******
 *****
  ***
   *
  ***
 *****
*******

C, 114 109 bytes
i,j;k(n){for(i=-n/2;i<=n/2;++i)for(j=-n/2;j<=n/2+1;++j)putchar(j==n/2+1?10:(i>=j&i>=-j)|(i<=j&i<=-j)?42:32);}

ungolfed:
i,j;
k(n){
 for(i=-n/2;i<=n/2;++i)
  for(j=-n/2;j<=n/2+1;++j)
   putchar(j==n/2+1?10:(i>=j&i>=-j)|(i<=j&i<=-j)?42:32);
}

Previous recursive solution:
p(a,c){while(a--)putchar(c);}
f(n,i){p(i,32);p(n,42);p(1,10);}
g(n,i){if(n>1)f(n,i),g(n-2,i+1);f(n,i);}
h(n){g(n,0);}

JavaScript (ES6), 66 bytes
f=(n,s="*".repeat(n))=>n>1?s+`
`+f(n-2).replace(/^/gm," ")+`
`+s:s

The idea here is to generate each hourglass from the previous: add a space at the beginning of every line, and both prepend and append n asterisks.

05AB1E, 21 20 19 17 bytes
Saved 2 bytes thanks to carusocomputing
;ƒ'*¹N·-×Nð×ì})û»

Try it online!
Explanation
;ƒ                   # for N in [0 ... floor(input/2)+1]
  '*                 # push an asterisk
    ¹N·-×            # repeat the asterisk input-N*2 times
         Nð×ì        # prepend N spaces
             }       # end loop
              )      # wrap stack in a list
               û     # palendromize
                »    # join with newlines

Ir"*"×.pRû - Got this far, face palmed when I realized how far off I was, saw you had answered, going to go try to learn iteration in this language now using this example. Thanks!

I can actually help for once: ;ƒ'*¹N·-×Nð×ì})û» use the new palindromize command. -2 bytes.

@carusocomputing: Thanks! I didn't know about the palendromize command (I hadn't refreshed the docs). Very useful. Have needed it several times before :)

9 bytes, even in the legacy. Although I'm pretty sure the builtins ÅÉ and .c probably weren't available yet at the time you posted this. :)

MATL, 12 bytes
Q2/Zv&<~42*c

Try it online!
Explanation
This makes use of the recently added symmetric range function.
Q     % Input n implicitly. Add 1
      % STACK: 6
2/    % Divide by 2
      % STACK: 3
Zv    % Symmetric range
      % STACK: [1 2 3 2 1]
&<~   % Matrix of all pairwise "greater than or or equal to" comparisons
      % STACK: [1 1 1 1 1
                0 1 1 1 0
                0 0 1 0 0
                0 1 1 1 0
                1 1 1 1 1]
42*   % Multiply by 42 (ASCII code of '*')
      % STACK: [42 42 42 42 42
                 0 42 42 42  0
                 0  0 42  0  0
                 0 42 42 42  0
                42 42 42 42 42]
c     % Convert to char. Implicitly display, with char 0 shown as space
      % STACK: ['*****'
                ' *** '
                '  *  '
                ' *** '
                '*****']

Nice! That's a cool feature. This is the only answer that came close to my V answer, so now I'm going to obsess on taking off one or two bytes. :D

@DJMcMayhem Heh, I don't think I will be able to reduce the byte count on this one

Yeah, I don't think I can either. There'll probably be a 4-byte Jelly answer in a couple minutes anyway, hahaha...

PHP, 95 bytes
for($c=str_pad,$m=$n=$argv[1];$n<=$m;$n+=$d=$d>0||$n<2?2:-2)echo$c($c('',$n,'*'),$m,' ',2)."
";

Instead of storing the rows in an array and then outputting everything, the for loop goes down until 1, and then goes back up to the original number.

C++11,  93 bytes
#include<string>
using S=std::string;S f(int n,int i=0){S s=S(i,32)+S(n,42)+'\n';return n>1?s+f(n-2,i+1)+s:s;}

Slightly ungolfed:
std::string f(int n,int i=0){
 auto s=std::string(i,' ') + std::string(n,'*') + '\n';
 return n>1 ? s+f(n-2,i+1)+s : s;
}

Usage:
std::cout << f(5);

Nice! one byte can be saved by assuming ASCII and replacing '\n' with 10 :)

MATL, 20 bytes
XyY>t1X!*t2X!+ZS42*c

Try it online!

You can save a few bytes with the recently introduced symmetric range function: Q2/Zv&<~42*c

@LuisMendo That's cool! Since it's a completely different approach, I'll let you have it.

Ok, I'll post it!

C, 79 bytes
h(m,n,k){for(n=m++,k=n*m;--k;putchar(k%m?abs(k%m-m/2)>abs(k/m-n/2)?32:42:10));}

It splits the countdown variable k into row and column indices.
If the column index is 0 (last char in a row), it outputs a newline character (10). Then it adjusts the row and column indices to be around the center asterisk. Then, abs(x) < abs(y) is a short condition for outputting a space.

Java 7, 170 165 164 bytes
Thanks to @Hypino for saving 5 bytes.
Thanks to Kevin for saving 1 byte.
String c(int n,int x){String s,c,t=c=s=" ";int i=0;for(;i++<n;s+="*");for(i=x;i-->=0;c+=" ");for(i=x;i-->0;t+=" ");return(n=n-2)>=0?s+"\n"+c+c(n,++x)+"\n"+t+s:"*";}

You can save 2 bytes by removing s= from s=s+"\n"and 2 more bytes by changing return(n=--n-1) to return(n=n-2) for a total of 4 bytes.

Hi. You can golf two parts: String s="",c="",t=""; to String s,c,t=s=c=""; (-2 bytes), and return(n=n-2)>=0?s+"\n"+c+c(n,++x)+ to return n-1>0?s+"\n"+c+c(n-2,++x)+ (-2 bytes again)

But @KevinCruijssen pattern not as expected after changing n=n-2->n-1>0 because n should be used in other argument of a function.

@Numberknot I know, but I also changed n to n-2 at that part. return(n=n-2)>=0 ... n being changed to return n-1>0 ... n-2 is still shorter. PS: You've thanked me for saving bytes, but haven't changed your code in your edit. ;)

@Numberknot Umm.. you still forgot my second tip. Anyway, here is a shorter variant: String c(int n,int x){String s,c=s="";int i=0;for(;i++<n;s+="*");for(i=x;i-->0;c+=" ");return n>1?s+"\n "+c+c(n-2,x+1)+"\n"+c+s:"*";} without the t (ideone test - 133 bytes)

R, 77 bytes
M=matrix(" ",n<-scan(),n);for(i in 1:n)M[i:(n-i+1),i]="*";cat(M,sep="",fill=n)

Creates a character matrix, which it then prints out via cat, with fill=n making sure the lines align properly. Note that elements are stored in a matrix column-first (i.e the first two elements are M[1,1] and M[2,1], not M[1,2].)

PHP - 95 bytes
$c=2;for($i=$a=$argv[1];$i<=$a;$i-=$c*=$i<2?-1:1)echo str_pad(str_repeat("*",$i),$a," ",2)."
";

Saved a byte by using an actual new line instead of an "\r"

APL, 19 bytes
' *'[1+∘.≤⍨(⊢⌊⌽)⍳⎕]

Test:
      ' *'[1+∘.≤⍨(⊢⌊⌽)⍳⎕]
⎕:
      5
*****
 ***
  *
 ***
*****

Explanation:
                 ⎕   ⍝ read number
                ⍳    ⍝ 1..N
           ( ⌊ )     ⍝ at each position, minimum of
            ⊢        ⍝ 1..N
              ⌽      ⍝ and N..1 (this gives 1..N/2..1)
       ∘.≤⍨          ⍝ outer product with ≤
     1+              ⍝ add 1 to each value
' *'[             ]  ⍝ 1→space, 2→asterisk

Just remove 1+ and use an APL that has ⎕IO←0.

Canvas, 7 bytes
⇵｛*×］⤢┼

Try it here!
Explanation:
⇵｛*×］⤢┼
⇵         ceiling divide by 2
 ｛  ］    map over [1..pop]
   *         push *
    ×        repeat by the counter
       ⤢  transpose
        ┼  quad-palindromize with 1 overlap

+1 byte with support for even numbers

An alternate (similar) 7-byter

PowerShell, 54 50 bytes
filter f{if($_-1){'*'*$_;($_-2)|f|%{" $_"}}'*'*$_}

Try it online!

J, 30 28 26 25 bytes
-2 bytes thanks to FrownyFrog!
-3 bytes thanks to Jonah!
' *'#~](],.(-+:))i.@-<.i.

Try it online!
Previous version:
' *'{~[:(>.|.)@(*|."1)]\@#&1

Try it online!

]\@#&1 is 2 shorter

@FrownyFrog Yes, of course! Thank you!

26 bytes: Try it online!

@Jonah Thank you! I have almost forgotten I solved this one :)

Got one more byte off, 25: Try it online!

@Jonah Great! You don't give up :)

PHP, 104 88 bytes
for(;$i++<$argn;$a.='**',$i++>1?$o=$s.$o:1)$o.=$s=str_pad("*$a",$argn,' ',2)."
";echo$o;

Try it online!
This doesn't beat the lowest scores for PHP on this challenge, but it's just too crazy for me to throw away.
Okay, so I've golfed now it to be the (not for long) lowest score for PHP on this challenge, but it doesn't change the fact that it's still crazy.
$ echo 7|php -nF hour.php
*******
 *****
  ***
   *
  ***
 *****
*******

83? also huh, php has barewords too, although it's not useful here

@ASCII-only rats! Looks like I've got some more work to do! lol

82? alternative 82

with proper flags :P sadly, this is longer

@ASCII-only yep, nicely done! That's for sure the right approach!

ouch, that didn't work :/

Add++, 90 bytes
+?
Fx,`i,j:i,-1,*" ",o,`j,x-,+1,+j,-1,*"a",O
x-1
Fx,`i,+1,j:i,x-,+1,*" ",o,`j,*2,-1,*"a",O

Try it online!
Just two for loops.
My first Add++ answer!

Nice, congrats :-)

Vyxal C, 14 13 11 bytes
-2 thanks to @Lyxal
½ʀƛd⁰ε×*;øm

Port of Emigna's 05AB1E solution.
Try it Online!
½ʀƛd⁰ε×*;øm    # Full program
  ƛ     ;      # Map each n
½ʀ             # in range(0, input / 2 + 1):
       *        # Repeat...
      ×         # the character `*`...
   d⁰ε          # abs(2 * n - input) times
          øm   # Palindromize
               # Implicit output (`C' flag): join the array on newlines and center each line

Try it Online! for 11 bytes

Uiua SBCS, 16 bytes
≡&p⊏:" *"⊞≤.↥⇌.⇡

Try it!
Assumes the output must be a string or printed. If a character matrix is acceptable, remove the ≡&p for -3 bytes.

↥⇌.⇡ Range, duplicate, reverse, max. If the input is 5, this would create [4 3 2 3 4] from it.
⊞≤. Table with itself by less than or equal to. This creates the binary hourglass matrix.
The rest is just converting to characters and printing.

Vyxal 3 j, 11 bytes
zU•×ᵂ½ṚᶻḊVṅ

Try it Online!

Pip -l, 16 bytes
QP("* "_>BMCHUa)

Try It Online!
Explanation
QP("* "_>BMCHUa)
              a  ; Command-line argument
            HU   ; Halve and round up
          MC     ; Map this function to a square coordinate grid of that size:
       _>B       ;   1 if x coord is greater than y coord, 0 otherwise
                 ; This results in a matrix which is 1 below the main diagonal and
                 ; 0 on or above it
  ("* "        ) ; Use that as an index into this string: 0 -> "*", 1 -> " "
QP               ; Quad-palindromize
                 ; Print each element of the top-level list on a separate line (-l flag)

Alternate 16-byte solution
QP" *"@\$|*EYHUa
             HUa ; Halve argument and round up
           EY    ; Identity matrix of that size
       \$        ; Scan
          *      ; each row
         |       ; on logical OR
                 ; This results in a matrix which is 0 below the main diagonal and
                 ; 1 on or above it
QP" *"@          ; Index into a string and quad-palindromize, as before

Pyth, 22 bytes
j+J.e+*dk*b\*_:1hQ2_PJ

A program that takes input of an integer on STDIN and prints the result.
Try it online
How it works
j+J.e+*dk*b\*_:1hQ2_PJ  Program. Input: Q
              :1hQ2     Range from 1 to Q+1 in steps of 2. Yields [1, 3, 5, ..., Q]
             _          Reverse
   .e                   Enumnerated map with b as elements and k as indices:
      *dk                 k spaces
         *b\*             b asterisks
     +                    Concatenate the spaces and asterisks
  J                     Store in J
                    PJ  All of J except the last element
                   _    Reverse
 +                      Concatenate J and its modified reverse
j                       Join on newlines
                        Implicitly print

C, 195 191 Bytes
Should golf down a bit smaller
x,y,i;f(n){for(i=0;i<n;i+=2,puts("")){for(y=n-i;y<n;y+=2,putchar(32));for(x=i;x++<n;putchar(42));}for(i=n-2;~i;i-=2,puts("")){for(y=n-i+2;y<n;y+=2,putchar(32));for(x=i-1;x++<n;putchar(42));}}

We can test it here on ideone

Ruby, 55 54 bytes
f=->n,s=0{puts a=' '*s+?**n;(f[n-2,s+1];puts a)if n>1}

?**n works; you don't need the space there.

Java 7, 156 bytes
Fairly simple. Keeps track of lines with n, stars with j, spaces with s, and direction with d. I really just wanted a non-recursive Java answer on the board, but it doesn't hurt that it's also a bit shorter :)
String f(int n){String o="";int j=n,s=0,i,d=0;for(;n-->0;o+="\n"){for(i=0;i++<s;)o+=" ";for(i=0;i++<j;)o+="*";d+=j<2?1:0;j+=d<1?-2:2;s+=d<1?1:-1;}return o;}

With line breaks:
String f(int n){
    String o="";
    int j=n,s=0,i,d=0;
    for(;n-->0;o+="\n"){
        for(i=0;i++<s;)
            o+=" ";
        for(i=0;i++<j;)
            o+="*";
        d+=j<2?1:0;
        j+=d<1?-2:2;
        s+=d<1?1:-1;
    }
    return o;
}

146 bytes

Haskell, 84 bytes
f n|l<-div n 2,k<-[-l..l]=putStr$unlines[[" *"!!(fromEnum$abs x<=abs y)|x<-k]|y<-k]

Nice solution! But I'm pretty sure you don't need the putStr and you can get rid of the fromEnum like this.

C (gcc), 80 74 bytes
Thank ceilingcat for 6 bytes
-Du(x,k)=for(x=~n;x+=2,x<n;putchar(k))

i;j;f(n){u(i,10)u(j,i*i<j*j?32:42);}

Try it online!

Jelly, 15 bytes
HŻżḂƇṚ$⁾ *xⱮŒḄY

Try it online!
I'm surprised there wasn't a Jelly answer yet. Jelly is not good at strings.
Explanation
HŻżḂƇṚ$⁾ *xⱮŒḄY   Main monadic link
H                 Halve: n/2
 Ż                Range from 0 to floor(n/2)
  ż               Zip with
      $           (
                    Range from 1 to n
    Ƈ               Filter by
   Ḃ                  parity [to get the odd numbers]
     Ṛ              Reverse
      $           )
           Ɱ      For each pair of numbers
          x         repeat
       ⁾ *            the characters ' ' and '*' that many times
            ŒḄ    Bounce (palindromize)
              Y   Join with newlines

Vyxal CRM, 5 bytes
y×ẋṘ∞

Try it Online!
Newer Vyxal 2 version with a ton of flags but hey 5 bytes

4.375 with vyncode

PHP, 191 bytes
$b=[];for($i=$a=$argv[1]+1;$i>0;$i--){$i--;if($i<=1){$c=str_pad("*",$a," ",2)."\n";break;}$b[]=str_pad(str_repeat("*",$i),$a," ",2)."\n";}echo implode("",$b).$c.implode("",array_reverse($b));

Run like php -f golf_hourglass.php 15
# php -f golf_hourglass.php 15
***************
 *************
  ***********
   *********
    *******
     *****
      ***
       *
      ***
     *****
    *******
   *********
  ***********
 *************
***************

The idea behind it is to create the top half (the part before the single *), then just echo the top part twice, but the second time in reverse order.

I think this is a better start for this task for(;$i<$a=$argv[1];$i+=2){$t=str_pad(str_pad("",$i+1,"*"),$a," ",2)."\n";$i?$s.=$t:$r=$t;}echo strrev($s)."\n".$r.$s;

for(;$i<$a=$argv[1];$i++){$t=str_pad(str_pad("",$i+1+$i%2,"*"),$a," ",2)."\n";$i%2?$s.=$t:$s=$t.$s;}echo$s; this is better

Replace implode() with join() to save 6 bytes.

Replace \n with an actual new line to save a byte.

Groovy, 66 Bytes
{n->((n..1)+(2..n)).each{if(it%2>0){println(("*"*it).center(n))}}}

Try it: https://groovyconsole.appspot.com/script/5145735624392704
Explained:
((n..1)+(2..n)) - Reverse palindromize to n [n,..,1,..,n]
.each{if(it%2>0){...} - Iterate through odd elements.
println(("*"*it).center(n)) - Center n stars and print each on newline.

.each's code block could be {it%2&&println(("*"*it).center(n))}.

Pyke, 22 19 bytes
F-ed*ih\**+)2%'X_OX

Try it here!
F          )        -    for i in range(input)
 -                  -        Q-i
  e                 -       floor(^/2)
   d*               -      ^*" "
          +         -     ^+V
     ih             -       i+1
       \**          -      ^*"*"
            2%      -   ^[::2]
              'X_   - splat(^),
                       reversed(^)
                 OX - splat(^[:-1])

C, 117 bytes
void p(c,n){while(n--)putchar(c);}void h(n){for(int i=n;i>=-n;i-=i==1?4:2){p(32,(n-abs(i))/2);p(42,abs(i));p(10,1);}}

Ungolfed
void printNum(c, n) {
  while (n--)
    putchar(c);
}

void hourGlass(n) {
  for (int i = n; i >= -n; i-=i==1?4:2) {
    printNum(32, (n - abs(i)) / 2);
    printNum(42, abs(i));
    printNum(10, 1);
  }
}

PHP, 158 bytes
(-2 if I can omit the start tag)
<?$v=$argv[1]/2;while($c++<$v){$a="";$b=$v+.5;while(--$b)$a.=$b<$c?" ":"*";$z[]=strrev($a)."*$a";}$c=array_pop($z);$a=join($z,"
");echo"$a
$c
".strrev($a);

A similar approach to the one @hd took but uses manual concatenation instead of built-in string functions with overly long names. I wish I could call $z->pop()

Pyth, 22 bytes
VQ+*d-J/Q2aJN*\*hatQyN

Try online.
Lame attempt at explaining:
VQ+*d-J/Q2aJN*\*hatQyN   The whole thing.
VQ                       For N in [0,1,2, ... ,Q-1]; Q takes the input.
      J/Q2               Integer division Q/2, store in J
          aJN            Absolute difference between N and J
     -                   Subtract the above numbers...
   *d                    ...and repeat whitespace that many times
  +                      Concatenate that with output from the next block
                 atQyN   Absolute difference between Q-1 and 2*N
             *\*h        Repeat an asterisk the above number of times + 1

Interestingly I matched TheBikingViking's score on the same language using a different approach... O:

Racket 177 bytes
(let p((n N)(d #t))(for((i(/(- N n)2)))(display" "))(for((i n))(display #\*))(displayln"")
(cond[(and(not d)(= n N))][(= n 1)(set! d #f)(p(+ 2 n)d)][d(p(- n 2)d)][(p(+ 2 n)d)]))

Ungolfed:
(define (f N)
  (let loop ((n N)
             (d #t))                      ; descending
    (for ((i (/(- N n)2)))
          (display " "))
    (for ((i n))
      (display #\*))
    (displayln "")
    (cond
      [(and (not d) (= n N))]             ; end
      [(= n 1) (set! d #f)
               (loop (+ 2 n) d)]
      [d (loop (- n 2) d)]
      [(loop (+ 2 n) d)]))
  )

Testing:
(f 9)

Output:
*********
 *******
  *****
   ***
    *
   ***
  *****
 *******
*********
#t

Batch, 191 154 bytes
@echo off
set s=*
set l=for /l %%i in (2,1,%1)do call:
%l%s
%l%s
%l%u
%l%l
:l
echo %s%
:s
set s=%s:~1%**
exit/b
:u
echo %s%
set s= %s:~0,-2%

The u subroutine generates the top half of the hourglass by prepending a space and removing two trailing stars each time. The l subroutine generates the bottom half of the hourglass by removing a space and appending two trailing stars each time. The code falls through into the l subroutine at the end to save bytes. The second half of the l subroutine is also used to build up the initial string, although it has to be called twice as many times as the string doesn't have its spaces yet.
Edit: Saved 37 bytes by using an idea by @ConorO'Brien.

Swift 3, 139 130
let c={String(repeating:$0,count:$1)};func d(_ n:Int,_ i:Int=0)->String{let b=c(" ",i)+c("*",n)+"\n";return n>1 ?b+d(n-2,i+1)+b:b}

On-line test
let c={(s,i)in(0..<i).reduce(""){(b,_)in b+s}};func d(_ n:Int,_ i:Int=0)->String{let b=c(" ",i)+c("*",n)+"\n";return n>1 ?b+d(n-2,i+1)+b:b}

CJam, 26 bytes
ri:A,_W%.e<{_S*A@2*-'**N}/

Try it online!
ri:A     e# read integer, save as A
,_W%     e# make range and mirror (e.g.[0,1,2,3,4],[4,3,2,1,0])
.e<      e# take minimums (e.g.[0,1,2,1,0])
{        e# for each minimum "m"
  _S*    e#   push m spaces
  A@2*-  e#   calculate A-2m (rotates to spare m)
  '**    e#   push A-2m asterisks
  N      e#   push a newline
}/       e# end, prints stack

T-SQL, 93 bytes
This will also provide an answer when an even number is used - the bottom row will be missing.
Golfed:
DECLARE @ INT=5

,@i INT=0z:PRINT SPACE(@/2-abs(@/2-@i))+REPLICATE('*',abs(@/2-@i)*2+1)SET
@i+=1IF @i<@ GOTO z

Ungolfed:
DECLARE @ INT=5

,@i INT=0
z:
PRINT SPACE(@/2-abs(@/2-@i))+REPLICATE('*',abs(@/2-@i)*2+1)
SET @i+=1
IF @i<@ GOTO z

A bit longer alternative solution without looping
USE master
DECLARE @ INT=5
SELECT top(@)SPACE(@/2-abs(@/2-number))+REPLICATE('*',abs(@/2-number)*2+1)
FROM spt_values
WHERE'P'=type

Fiddle

Actually, 34 bytes
;╗R`1&`░`'**╜kd#"{:^%d}"%f`M;pXR+i

Try it online!
Explanation:
;╗R`1&`░`'**╜kd#"{:^%d}"%f`M;pXR+i
;╗                                  store a copy of n in register 0
  R                                 range(1, n+1) ([1, n])
   `1&`░                            filter: keep only odd values
        `'**╜kd#"{:^%d}"%f`M        for each value:
         '**                          push a string containing that many asterisks
            ╜                         push n
             kd#                      list from stack, dequeue, listify (make both stack elements singleton lists)
                "{:^%d}"%             format string to center string in n-wide field
                         f            do the formatting
                            ;pXR+   duplicate list, discard the extra "*" element, reverse, and append original list (vertical mirroring)
                                 i  flatten and implicitly print

Common Lisp, 101 bytes
(dotimes(i(1+(set'x(read))))(format t"~v:@<~v{*~}~>~&"x(set'b(abs(- x(* i 2))))1)(if(= 1 b)(incf i)))

Excel VBA, 68 67 Bytes
Anonymous VBE immediate window function that takes input from [A1] and outputs to the VBE immediate window
n=[Int(A1/2)]:For i=-n To n:j=abs(i):?Spc(n-j)String(2*j+1,42):Next

SOGL V0.12, 12 bytes
.↔∫ **}⁰№§╬3

Try it Here!

Ruby, 66 bytes
->n{(-n..n).each{|x|x.abs>1?(puts"*"*x.abs):(puts"*"*x if x>0)}}

Probably a shorter way of doing this, but this is the most straight forward one i came up with.

Japt, 11 bytes
õ_î*ÃÔë ê û

Try it online

Japt -R, 11 bytes
1õU2_ç*Ãê û

Try it
                :Implicit input of integer U
1õU2            :Range [U,1] in increments of 2
    _           :Map each Z
     ç*         :  Repeat "*" Z times
       Ã        :End map
        ê       :Palindromise
          û     :Centre pad each element with spaces to the length of the longest
                :Implicitly join with newlines and output

Python 3, 79 bytes
def f(i):[print(' '*(i//2-abs(j-i//2))+'*'*2*abs(j-i//2)+'*')for j in range(i)]

Oracle SQL, 119 bytes
SQL> select lpad(' ',ceil(n/2)-x-1,' ')||rpad('*',x*2+1,'*')from(select n,abs(ceil(n/2)-rownum)x from t connect by level<=n)
  2  /

LPAD('',CEIL(N/2)-X-1,'')||RPAD('*',X*2+1,'*')
--------------------------------------------------------------------------------
*******
 *****
  ***
   *
  ***
 *****
*******

7 rows selected.

sed 4.2.2, 54 42 bytes
:
H
s/00/ /
t
:a
s/ 0/000/
H
//ba
g
y/0/*/

Takes input in unary (e.g. 3 is 000), allowed as per meta consensus.
Try it online!
Code with comments:
#Create an unnamed branch label (sed 4.2 only)
:
#Append pattern buffer to hold buffer
H
#Replace first two zeroes with a space
s/00/ /
#If we did the previous replacement, branch back to the unnamed label
t
#Create a label a
:a
#Replace last space with two zeroes
s/ 0/000/
#Append pattern buffer to the hold buffer
H
#Check if there is still something to replace (// refers to the previous pattern)
#If so, branch to label a
//ba
#Replace the pattern buffer with the hold buffer
g
#Replace zeroes with asterisks
y/0/*/

-12 bytes thanks to Xcali

You can cut that down to 42 bytes since the trailing spaces are not needed.

@Xcali Ah yes, cutting those off makes this much easier. Thanks :)

Perl 5 -a, 51 bytes
$_%2&&say$"x(("@F"-abs)/2),'*'x abs for-$_..0,2..$_

Try it online!

Rockstar, 141 bytes
listen to N
let X be N--2
F takes X
let Y be N-X
let Y be/2
say " "*Y+"*"*X

while X-1
let X be-2
F taking X

while N-X
let X be+2
F taking X

Try it here (Code will need to be pasted in)

https://www.youtube.com/watch?v=OI65pLrIfdk&ab_channel=FearlessRecords

horrible music if you'd ask me but fitting very good, also nice language @Shaggy


text:
Print the n-th digit of pi
Task
Given an input n, calculate the n-th decimal digit of pi
Rules

Answer can be a full program or a function.
Input must be taken from stdin or from function arguments.
Output must be either sent to stdout, the return value of a function, or written to a file.
all n values between 0 and 20000 must be supported (can be between 1 and 20001 for 1-indexed languages).
Built-ins to calculate pi cannot be used. This includes pi constants (e.g. math.pi in Python) and built-in functions that return either the value of pi, or the n-th digit of pi. This means that an algorithm which calculates pi, or the n-th digit of pi must be implemented in your answer.
Digits must be calculated at runtime.

First digit (0-th or 1-th, depending on the language) is 3.
This is code-golf, so shortest code in bytes wins.
EDIT:
This is not a duplicate of 'Find the n-th decimal of pi', since that challenge allowed built-ins. This one is focused around actually implementing an algorithm to find the digits, rather than relying on built-ins.

The ban of built ins probably makes this different enough.

linking for the sake of completeness. In my opinion it's a dupe, because a lot of those answers can be copy pasted to this challenge. But not voting to close just yet.

base16 allowed?

@dwana No, it has to be in base10

This is a completely different challenge without the use of builtins.  From what I can see all of the answers to the other question are using builtins and don't apply here.

@cleblanc, it seems to me that five of the (undeleted) answers to the other question use series expansions such as the Leibniz series, and one uses an built-in for arctan which isn't technically in violation of the spec of this question. That makes 6 out of 13 answers which could be copied across unmodified.

Python 2, 182 65 bytes
a=p=2*10**20004
i=3
while a:a=i/2*a/i;p+=a;i+=2
print`p`[input()]

repl.it
Uses the Leibniz formula to calculate 20000 correct digits (plus a handful to allow the algorithm to maintain accuracy) then prints the requested digit.

Previous (182):
"The Spigot Algorithm For Pi" of Stanley Rabinowitz and Stan Wagon has the added bonus that it will work for any n when implemented as a generator
p=lambda n,r=3,a=0,b=1,c=1,d=1,e=3,f=3,i=0:i>n and r or p(n,e,*[((2*b+a)*f,b*d,c*f,d+1,(b*(7*d)+2+(a*f))/(c*f),f+2,i),(10*(a-e*c),10*b,c,d,((10*(3*b+a))/c)-10*e,f,i+1)][4*b+a-c<e*c])

repl.it Reaches Python's default recursion limit for the 117th digit.
Here is a non-recursive version for 198 bytes:
def p(n):
 a=i=0;b=c=d=1;e=f=3
 while i<=n:
     r=e
     if 4*b+a-c<e*c:g=10*(a-e*c);e=((10*(3*b+a))/c)-10*e;b*=10;i+=1
     else:g=(2*b+a)*f;h=(b*(7*d)+2+(a*f))/(c*f);b*=d;c*=f;f+=2;d+=1;e=h
     a=g
 print r

repl.it
(first indent space, second indent tab), the digits could, of course, be generated by yielding e at the start of the if clause instead of tracking the last digit with r.

Nice implementation of that algorithm, but by using a different algorithm it can be more than 110 bytes shorter in Python 2, as shown by the two Python 2 algorithms here.

Yeah, I know, am implementing arctan...

link is broken... fascinating implementation. the explanations that i found dont look like that. they use arrays and vectors, which you dont

@donbright Thanks I have updated the broken link to point to a stable link at jstor.org

Java 7, 260 258 bytes
import java.math.*;int c(int n){BigInteger p,a=p=BigInteger.TEN.pow(20010).multiply(new BigInteger("2"));for(int i=1;a.compareTo(BigInteger.ZERO)>0;p=p.add(a))a=a.multiply(new BigInteger(i+"")).divide(new BigInteger((2*i+++1)+""));return(p+"").charAt(n)-48;}

Copy from my answer here. Java's built-in Math.PI has a precision of 15 decimal points, so I was already forced to use an algorithm for the other challenge anyway..
Used @LeakyNun's Python 2 algorithm.
Ungolfed & test code:
Try it here. (The ideone can't handle the last two test cases, but it works within 2 sec in the Eclipse IDE.)
import java.math.*;
class M{
  static int c(int n){
    BigInteger p, a = p = BigInteger.TEN.pow(20010).multiply(new BigInteger("2"));
    for(int i = 1; a.compareTo(BigInteger.ZERO) > 0; p = p.add(a), i++){
      a = a.multiply(new BigInteger(i+"")).divide(new BigInteger((2 * i++ + 1)+""));
    }
    return (p+"").charAt(n) - 48;
  }

  public static void main(String[] a){
    System.out.print(c(0)+", ");
    System.out.print(c(1)+", ");
    System.out.print(c(2)+", ");
    System.out.print(c(3)+", ");
    System.out.print(c(4)+", ");
    System.out.print(c(11)+", ");
    System.out.print(c(101)+", ");
    System.out.print(c(600)+", ");
    System.out.print(c(761)+", ");
    System.out.print(c(1001)+", ");
    System.out.print(c(10001)+", ");
    System.out.print(c(20001));
  }
}

Output:
3, 1, 4, 1, 5, 8, 8, 2, 4, 3, 5, 2

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Sum Chain Sequence
Sequence:

We start at 1.
We first add the current 1-indexed value to the previous number in the sequence.
Then we apply the following mathematical operations in order if they apply to this current value:

Divisible by 2? => Addition
Divisible by 3? => Subtraction
Divisible by 4? => (Addition AND) Multiply
Not divisible by neither 2, 3 nor 4? -> Continue with current sum-result

Output:
Output the first 100 numbers in this sequence:
1, 1, 21, 25, 30, 216, 223, 223, 2169, 2179, 2190, 2202, 2215, 2215, 2245, 2261, 2295, 2295, 2333, 2353, 2395, 2417, 56649, 56649, 56699, 56725, 1533033, 1533061, 1533090, 45993600, 45993631, 45993631, 1517792001, 1517792035, 1517792070, 1517792106, 1517792143, 1517792143, 1517792221, 1517792261, 1517792343, 1517792343, 1517792429, 1517792473, 1517792563, 1517792609, 71336257041, 71336257041, 71336257139, 71336257189, 3638149121841, 3638149121893, 3638149121946, 196460052588000, 196460052588055, 196460052588055, 11198222997525633, 11198222997525691, 11198222997525750, 11198222997525810, 11198222997525871, 11198222997525871, 11198222997525997, 11198222997526061, 11198222997526191, 11198222997526191, 11198222997526325, 11198222997526393, 11198222997526531, 11198222997526601, 795073832824398753, 795073832824398753, 795073832824398899, 795073832824398973, 59630537461829934225, 59630537461829934301, 59630537461829934378, 4651181922022734887568, 4651181922022734887647, 4651181922022734887647, 376745735683841525912529, 376745735683841525912611, 376745735683841525912694, 376745735683841525912778, 376745735683841525912863, 376745735683841525912863, 376745735683841525913037, 376745735683841525913125, 376745735683841525913303, 376745735683841525913303, 376745735683841525913485, 376745735683841525913577, 376745735683841525913763, 376745735683841525913857, 35790844889964944961834465, 35790844889964944961834465, 35790844889964944961834659, 35790844889964944961834757, 3543293644106529551221660545, 3543293644106529551221660645

Here are the first 10 numbers in the sequence with explanation:
// Starting number of the sequence:
1

// 1 (previous number in the sequence)
// + 2 (current index in 1-indexed sequence)
// = 3 -> 3 - 2 (3 is divisible by 3, so we subtract the current index 2)
// = 1
1

// 1 (previous number in the sequence)
// + 3 (current index in 1-indexed sequence)
// = 4 -> 4 + 3 (4 is divisible by 2, so we first add the current index 3)
// = 7 -> 7 * 3 (and 4 is also divisible by 4, so we then also multiply the current index 3)
// = 21
21

// 21 (previous number in the sequence)
// + 4 (current index in 1-indexed sequence)
// = 25 (25 is not divisible by 2, 3 nor 4)
25

// 25 (previous number in the sequence)
// + 5 (current index in 1-indexed sequence)
// = 30 -> 30 + 5 (30 is divisible by 2, so we first add the current index 5)
// = 35 -> 35 - 5 (and 30 is also divisible by 3, so we then also subtract the current index 5)
// = 30
30

// 30 (previous number in the sequence)
// + 6 (current index in 1-indexed sequence)
// = 36 -> 36 + 6 (36 is divisible by 2, so we first add the current index 6)
// = 42 -> 42 - 6 (and 36 is also divisible by 3, so we then also subtract the current index 6)
// = 36 -> 36 * 6 (and 36 is also divisible by 4, so we then also multiply the current index 6)
// = 216
216

// 216 (previous number in the sequence)
// + 7 (current index in 1-indexed sequence)
// = 223 (223 is not divisible by 2, 3 nor 4)
223

// 223 (previous number in the sequence)
// + 8 (current index in 1-indexed sequence)
// = 231 -> 231 - 8 (231 is divisible by 3, so we subtract the current index 8)
// = 223
223

// 223 (previous number in the sequence)
// + 9 (current index in 1-indexed sequence)
// = 232 -> 232 + 9 (232 is divisible by 2, so we first add the current index 9)
// = 241 -> 241 * 9 (and 232 is also divisible by 4, so we then also multiply the current index 9)
// = 2169
2169

// 2169 (previous number in the sequence)
// + 10 (current index in 1-indexed sequence)
// 2179 (2179 is not divisible by 2, 3 nor 4)
2179

Challenge rules:

If your language doesn't support anything bigger than 231-1, you can continue the sequence until that max (so the first 46 numbers, up until - and including - 1,517,792,609).
The output format is flexible. You can return an array or list, a string separated with spaces, commas, etc. Your call.

General rules:

This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.
Default Loopholes are forbidden.
If possible, please add a link with a test for your code.
Also, please add an explanation if necessary.

Do we output the nth value, the first n values, or just until our max integer size?

@GabrielBenamy The first 100 in the sequence.

I'm pretty sure you only have 99 numbers in that block.

My answer disagrees with your output on only the last 13 numbers.

@GabrielBenamy I indeed noticed a bug in my own code. I'm currently fixing the sequence.. Sorry for the inconvenient. EDIT: It should be fixed now (I hope..)

@KevinCruijssen You still only have 99 values.

@Shebang Fixed.. Sorry for the sloppy start.. It has been in the sandbox for 5 days, but I guess neither me nor the others have noticed it.. :S Should be correct now.

05AB1E, 24 23 bytes
-1 byte thanks to Kevin Crujissen
¼¾тF=¼¾+©…+-*v®NÌÖi¾y.V

Try it online!
Explanation:
¼¾                        # set the counter to 1, then push 1
  тF                      # repeat the following 100 times
    =                     # print the current number in the sequence
     ¼¾                   # increment the counter
       +                  # add it to the current number
        ©                 # save the result in the register
         …+-*v            # for each of '+', '-', and '*'...
              ®   i       # if the register...
                 Ö        # is divisible by...
               NÌ         # the loop index + 2...
                   ¾y.V   # then apply the current operation

Tried to find something shorter with the counter variable so the UX can be removed, but I'm unable to. I end up at 24 bytes as well because it starts at 0 instead of 1. I now increased it before the while, but then we have to loop 101 times instead of 100.. Ah well.

@KevinCruijssen yeah, that UX is an eyesore. I tried to get rid of it for a while and ended up with a bunch of 24 and 25 variations: 1тF=NÌ©+DÑ3L>Ãv®…-*+yè.V, 1тL>v=y+©3F®NÌÖiy…+-*Nè.V... I didn't consider using the counter variable, this is interesting.

@KevinCruijssen your 24 inspired a 23: just use тF instead of Ƶ0µ. I've edited that in, thanks! (PS: there should really be a single-byte¼¾...)

Ah nice. Figured you'd find something somehow, haha. ;) And yeah, a single byter for ¼¾ would be nice, although to be quite honest, I almost never use it like that. The single-byte builtin I would prefer most right now is a second ©® variable which doesn't pop. Perhaps starting at an empty string "" as you mentioned in another challenge before.

R, 85 82 79 76 72 70 bytes
for(i in 2:56)T[i]=((z=i+T[i-1])+i*(!z%%2)-i*(!z%%3))*`if`(z%%4,1,i);T

ungolfed:
s=1 ## formerly s=1:56, formerly s=1:100
for(i in 2:56){
    z=i+s[i-1]
    s[i]=(z+i*(z%%2<1)-i*(z%%3<1))*(1+(i-1)*(z%%4<1))
}
s

Thanks to @rturnbull for pointing out that I can use (!z%%3) instead of (z%%3<1) to check the moduli, and that the definition of z an happen when it is first used.
Golfed away 3-4 chars by abusing vector extension: the answer originally started s=1:56... but we don't need to do that, the length of s will be extended as needed.
Saved 3 more bytes by replacing the last condition with a call to the "if" function (yes, it's a proper function in R!)
Saved 4 more bytes by replacing s with T, which is a builtin equal to TRUE which is also equal to 1. I realised it at the same time as @rturnbull (honest!)
This does suffer from some numerical issues once we exceed 2^52, but there is nothing I can do about that --- R can only use double types for numbers larger than 2^31-1, but they store integers up to 2^52 exactly. Thus, I am allowed to only output the first 56 terms (the last term which is "right") which saves one byte over the 100-length case.
Here's the output from the 56-length version:
    > for(i in 2:56){z=i+T[i-1];T[i]=(z+i*(!z%%2)-i*(!z%%3))*`if`(z%%4,1,i)};T
 [1]               1               1              21              25              30             216
 [7]             223             223            2169            2179            2190            2202
[13]            2215            2215            2245            2261            2295            2295
[19]            2333            2353            2395            2417           56649           56649
[25]           56699           56725         1533033         1533061         1533090        45993600
[31]        45993631        45993631      1517792001      1517792035      1517792070      1517792106
[37]      1517792143      1517792143      1517792221      1517792261      1517792343      1517792343
[43]      1517792429      1517792473      1517792563      1517792609     71336257041     71336257041
[49]     71336257139     71336257189   3638149121841   3638149121893   3638149121946 196460052588000
[55] 196460052588055 196460052588055

I would say looping only up to 56 is fair game given the description of the challenge.

@Billywob is indeed right. In the description I state "If your language doesn't support anything bigger than 2^31-1, you can continue the sequence until that max (so the first 46 numbers, up until - and including - 1,517,792,609).", but this of course also applies for different numbers than 32-bit. If R can't handle anything bigger, than the first 56 numbers is completely fine. And yes, if you know it can never go above 56, you may change the 100 to 56 to save a byte.

You can save three bytes by changing z%%2<1 (and so on) to !z%%2, abusing implicit type conversion.

Thanks @rturnbull, for some reason I thought ! didn't beat %%, but apparently it does!

Can you use ~-i instead of (i-1)?

@Neil I think I get your idea, I think best of all is to use an explicit "if" in this case. Good spot though!

You can also abuse T and use that in place of s, allowing you to remove the s=1;, saving another four bytes. It's possible to fold the definition of z into the definition of s[i] (well, T[i] now), like so: T[i]=((z=i+T[i-1])+ ..., which means that you can lose the curly brackets, saving some more bytes. EDIT: Oh, I see that you did the T trick while I was writing my comment! Great minds think alike, they say.

holy hell, if can be used as an unvectorized ifelse. mind blown

Python 3, 82 78 76 74 72 bytes
i=s=1
exec('print(s);i+=1;s+=i;s=(s+i-i*(s%2+(s%3<1)))*i**(s%4<1);'*100)

Output:
1
1
21
25
30
216
223
223
2169
2179
2190
2202
2215
2215
2245
2261
2295
2295
2333
2353
2395
2417
56649
56649
56699
56725
1533033
1533061
1533090
45993600
45993631
45993631
1517792001
1517792035
1517792070
1517792106
1517792143
1517792143
1517792221
1517792261
1517792343
1517792343
1517792429
1517792473
1517792563
1517792609
71336257041
71336257041
71336257139
71336257189
3638149121841
3638149121893
3638149121946
196460052588000
196460052588055
196460052588055
11198222997525633
11198222997525691
11198222997525750
11198222997525810
11198222997525871
11198222997525871
11198222997525997
11198222997526061
11198222997526191
11198222997526191
11198222997526325
11198222997526393
11198222997526531
11198222997526601
795073832824398753
795073832824398753
795073832824398899
795073832824398973
59630537461829934225
59630537461829934301
59630537461829934378
4651181922022734887568
4651181922022734887647
4651181922022734887647
376745735683841525912529
376745735683841525912611
376745735683841525912694
376745735683841525912778
376745735683841525912863
376745735683841525912863
376745735683841525913037
376745735683841525913125
376745735683841525913303
376745735683841525913303
376745735683841525913485
376745735683841525913577
376745735683841525913763
376745735683841525913857
35790844889964944961834465
35790844889964944961834465
35790844889964944961834659
35790844889964944961834757
3543293644106529551221660545
3543293644106529551221660645

Suggestions are welcome!

Use a while loop and reorder the arithmetic for -2.

05AB1E, 34 31 30 bytes
XTnFD,NÌ©+D3L>%_`X®‚sèrŠs-®*+*

Try it online!
Explanation
X                               # initialize stack with 1
 TnF                            # for N in [0 ... 99]
    D,                          # print a copy of top of stack
      NÌ©                       # increase index N by 2 and store in register
         +                      # add this to current value
          D                     # make a copy of the current value
           3L>                  # push the list [2,3,4]
              %                 # take current value mod elements in list
               _                # invert this
                `               # push the elements from the list to stack
                 X®‚sè          # index into list [1,N+2] with the result of mod 4
                      rŠs-      # subtract result of mod 3 from result of mod 2
                          ®*    # multiply by N+2
                            +   # add this to current value
                             *  # multiply current value with the result from index operation

Python 2, 76 Bytes
Pretty standard implementation, I think using an exec statement rather than a while loop saved 2 bytes or so. A recursive method may be shorter, I imagine xnor will pop up soon ;)
n=1
f=1
exec'print f;n+=1;d=f+n;f=(d+n*(d%2<1)-n*(d%3<1))*[1,n][d%4<1];'*100

If I used the updates that TheNumberOne figured out, I would be at 69 bytes (but then I would be copying)
n=f=1;exec'print f;n+=1;d=f+n;f=(d+n-n*(d%2+(d%3<1))*n**(d%4<1);'*100

Output:
1
1
21
25
30
216
223
223
2169
2179
2190
2202
2215
2215
2245
2261
2295
2295
2333
2353
2395
2417
56649
56649
56699
56725
1533033
1533061
1533090
45993600
45993631
45993631
1517792001
1517792035
1517792070
1517792106
1517792143
1517792143
1517792221
1517792261
1517792343
1517792343
1517792429
1517792473
1517792563
1517792609
71336257041
71336257041
71336257139
71336257189
3638149121841
3638149121893
3638149121946
196460052588000
196460052588055
196460052588055
11198222997525633
11198222997525691
11198222997525750
11198222997525810
11198222997525871
11198222997525871
11198222997525997
11198222997526061
11198222997526191
11198222997526191
11198222997526325
11198222997526393
11198222997526531
11198222997526601
795073832824398753
795073832824398753
795073832824398899
795073832824398973
59630537461829934225
59630537461829934301
59630537461829934378
4651181922022734887568
4651181922022734887647
4651181922022734887647
376745735683841525912529
376745735683841525912611
376745735683841525912694
376745735683841525912778
376745735683841525912863
376745735683841525912863
376745735683841525913037
376745735683841525913125
376745735683841525913303
376745735683841525913303
376745735683841525913485
376745735683841525913577
376745735683841525913763
376745735683841525913857
35790844889964944961834465
35790844889964944961834465
35790844889964944961834659
35790844889964944961834757
3543293644106529551221660545
3543293644106529551221660645

JavaScript, 75 63 bytes
for(n=p=0;n++<57;alert(p=p%4?q:q*n))q=(p+=n)%2?p:p+n,q-=p%3?0:n

Another version:
for(n=p=0;n++<57;)alert(p=((p+=n)+(!(p%2)-!(p%3))*n)*(p%4?1:n))

Both stop at index 57 (0-indexed) because that's when the output surpasses JavaScript's safe number size (253 - 1). Turns out a loop is way shorter than a recursive function, even with ES6:
f=(n=0,p=0)=>n++>56?[]:(q=(p+=n)%2?p:p+n,q-=p%3?0:n,[q*=p%4?1:n,...f(n,q)])

This one returns an array of the first 57 elements.

I think you should avoid going above ~50-60 because then you exceed Number.MAX_SAFE_INTEGER, and your divisions will become incorrect. I also tried the map version for completeness and it too clocked in at 75 bytes.

@Neil Ah, thanks. To be precise, it surpasses Number.MAX_SAFE_INTEGER after 57 entries.

Brain-Flak 476 466 462 456 446 Bytes
Saved 6 bytes thanks to Wheat Wizard
(((((((())<>()(())()){}){}){}())){}{}){({}[()]<(((({})<>({}())<>))<({}(()())(<()>)){({}[()]<(({}()[({})])){{}(<({}({}))>)}{}>)}({}{}<{}(())>){((<{}{}>))}{}{(<{}({}<>({})<>)>)}{}>)(({})<({}(()()())(<()>)){({}[()]<(({}()[({})])){{}(<({}({}))>)}{}>)}({}{}<{}(())>){((<{}{}>))}{}{(<{}({}<>[({})]<>)>)}{}>)({}(()()()())(<()>)){({}[()]<(({}()[({})])){{}(<({}({}))>)}{}>)}({}{}<{}(())>){((<{}{}>))}{}{(<{}(<>({}))({<({}[()])><>({})<>}{}<><{}>)>)}{}>)}{}

Try it Online!
This is really slow. TIO can't handle the whole 100 numbers (the limit seems to be 22 or 23). So, this example only generates the first 20, but the code would work for 100 as well.
Brief Explanation:
      (())<>                           # push a 1 (the index) and switch stacks
            (())                       # then push a 1 (the starting number)
((((((          ()()){}){}){}())){}{}) # and a 99 (a counter so that we only print the
                                       # first 100 numbers)

# repeat until the counter is 0
{
  # pop the counter and push it minus 1 after:
  ({}[()]<
    # hold onto the current number plus the index (leave a copy on the stack to be printed)
    # and increment the index
    (((({})<>({}())<>))<
      # push logical not of (current mod 2)
      ({}(()())(<()>)){({}[()]<(({}()[({})])){{}(<({}({}))>)}{}>)}({}{}<{}(())>){((<{}{}>))}{}
      # if !(current mod 2) is 1, add the index
      {(<{}({}<>({})<>)>)}{}
    # push the current number back on
    >)
    # hold onto the current number
    (({})<
     # push logical not of (current mod 3)
     ({}(()()())(<()>)){({}[()]<(({}()[({})])){{}(<({}({}))>)}{}>)}({}{}<{}(())>){((<{}{}>))}{}
     # if !(current mod 3) is 1, then subtract the index
     {(<{}({}<>[({})]<>)>)}{}
    # push the current number back on
    >)
    # push logical not of (current mod 4)
    ({}(()()()())(<()>)){({}[()]<(({}()[({})])){{}(<({}({}))>)}{}>)}({}{}<{}(())>){((<{}{}>))}{}
    # if !(current mod 4) is 1, multiply by the index
    {(<{}(<>({}))({<({}[()])><>({})<>}{}<><{}>)>)}{}
  # put the counter back on
  >)
# loop until done
}
# pop the counter
{}

({}<>[({})]<>)(<()>) can be replaced with (<({}<>[({})]<>)>)

@WheatWizard Updated. Thanks!

Java 7, 316 bytes
import java.math.*;String c(){String r="";BigInteger t=BigInteger.ONE,x,p;for(int i=2;i<102;){r+=t+" ";p=(t=t.add(x=new BigInteger(i+++"")));t=x(p,2)?t.add(x):t;t=x(p,3)?t.subtract(x):t;t=x(p,4)?t.multiply(x):t;}return r;}boolean x(BigInteger p,int i){return p.mod(new BigInteger(i+"")).compareTo(BigInteger.ONE)<0;}

Ungolfed & test code:
Try it here.
import java.math.*;
class M{
  static String c(){
    String r = "";
    BigInteger t = BigInteger.ONE,
               x,
               p;
    for(int i = 2; i < 102;){
      r += t+" ";
      p = (t = t.add(x = new BigInteger(i++ + "")));
      t = x(p, 2)
           ? t.add(x)
           : t;
      t = x(p, 3)
           ? t.subtract(x)
           : t;
      t = x(p, 4)
           ? t.multiply(x)
           : t;
    }
    return r;
  }

  public static void main(String[] a){
    System.out.println(c());
  }

  static boolean x(BigInteger p, int i){
    return p.mod(new BigInteger(i+"")).compareTo(BigInteger.ONE) < 0;
  }
}

Output:
1 1 21 25 30 216 223 223 2169 2179 2190 2202 2215 2215 2245 2261 2295 2295 2333 2353 2395 2417 56649 56649 56699 56725 1533033 1533061 1533090 45993600 45993631 45993631 1517792001 1517792035 1517792070 1517792106 1517792143 1517792143 1517792221 1517792261 1517792343 1517792343 1517792429 1517792473 1517792563 1517792609 71336257041 3424140340272 3424140340321 3424140340371 3424140340473 3424140340525 3424140340631 3424140340631 3424140340741 3424140340797 3424140340911 3424140340969 202024280124133 202024280124193 202024280124315 202024280124377 12727529647843689 814561897462000192 52946523335030016705 52946523335030016771 52946523335030016905 52946523335030016973 52946523335030017111 52946523335030017111 52946523335030017253 52946523335030017253 52946523335030017399 52946523335030017473 3970989250127251321725 301795183009671100456876 301795183009671100456953 301795183009671100457031 301795183009671100457110 301795183009671100457270 301795183009671100457351 301795183009671100457433 25049000189802701337980717 25049000189802701337980801 25049000189802701337980971 25049000189802701337981057 2179263016512835016404367097 191775145453129481443584312280 17067987945328523848479003800841 1536118915079567146363110342083790 1536118915079567146363110342083790 1536118915079567146363110342083974 1536118915079567146363110342083974 144395178017479311758132372155911228 13717541911660534617022575354811575685 13717541911660534617022575354811575781 13717541911660534617022575354811575975 13717541911660534617022575354811576073 1358036649254392927085234960126346050829

C#, 120 Bytes
Just as no sane person would golf in Java, no sane person should golf in C#! But screw that, I wanted to see what I can do. The 1M casts f to be a decimal which has enough precision for this answer without me having to write decimal. Also, the in-place incrementing saves some bytes on my Python answer. in the end it is still 50 bytes longer.
void k(){int n=1;var f=1M;while(n<101){Console.WriteLine(f);var d=++n+f;f=(d+n*((d%2<1?1:0)-(d%3<1?1:0)))*(d%4<1?n:1);}}

Here's the more readable (and runnable) version:
using System;
class P
{
    static void Main(string[]a)
    {
        int n = 1;
        var f = 1M;
        while (n < 101)
        {
            Console.WriteLine(f);
            var d = ++n + f;
            f = (d + n * ((d % 2 < 1 ? 1 : 0) - (d % 3 < 1 ? 1 : 0))) * (d % 4 < 1 ? n : 1);
        }
        Console.Read();
    }
}

You can golf 1 byte by changing the while to for and inserting the int like this: for(int n=1;n<101;)

You can even golf it some more like this: void k(){for(decimal f=1,d,n=1;n<101;)Console.WriteLine(f=((d=++n+f)+n*((d%2<1?1:0)-(d%3<1?1:0)))*(d%4<1?n:1));} (112 bytes)

Batch, 110 bytes
@set n=0
@for /l %%i in (1,1,46)do @set/an=((n+=%%i)+(!(n%%2)-!(n%%3))*%%i)*(~-%%i*!(n%%4)+1)&call echo %%n%%

Uses @ETHproductions' formula, but tweaked slightly because Batch doesn't have ?:. Batch uses 32-bit signed integers so the loops stops at 46.

Perl, 75 Bytes
use bigint;$a+=$_,say$a=($a+($a%2?0:$_)-($a%3?0:$_))*($a%4?1:$_)for(1..100)

The code outputs each value on a new line, and computes all 100 values.

-Mbigint, no parenthesis around the 1..100, and !($a%2)*$_ instead of ($a%2?0:$_) (same for a%3..) should save a few bytes ;)

Gets it down to 60 bytes with those suggestions and a few other massages.

Haskell, 70 64 bytes
a%b=0^mod a b
n#i|s<-n+i=(s+s%2*i-s%3*i)*i^s%4
scanl1(#)[1..100]

scanl1(#)[1..100] returns the list with the first 100 elements. One byte less if I can stay in the 2^31 range (-> [1..46]).
scanl1 is like foldl1 but collects the intermediate results in a list. The divisibility tests are done via the helper function % which returns 0^0 = 1 if divisible and 0^x = 0 if not.

J, 46 bytes
(,{:((]^0=4|+)*(]*0=2|+)++-]*0=3|+)1+#)^:99]1x

Applies the method described in the challenge.
Usage
The extra command (,.~#\) is used to add indices to each value.
   (,.~#\) (,{:((]^0=4|+)*(]*0=2|+)++-]*0=3|+)1+#)^:99]1x
  1                            1
  2                            1
  3                           21
  4                           25
  5                           30
  6                          216
  7                          223
  8                          223
  9                         2169
 10                         2179
 11                         2190
 12                         2202
 13                         2215
 14                         2215
 15                         2245
 16                         2261
 17                         2295
 18                         2295
 19                         2333
 20                         2353
 21                         2395
 22                         2417
 23                        56649
 24                        56649
 25                        56699
 26                        56725
 27                      1533033
 28                      1533061
 29                      1533090
 30                     45993600
 31                     45993631
 32                     45993631
 33                   1517792001
 34                   1517792035
 35                   1517792070
 36                   1517792106
 37                   1517792143
 38                   1517792143
 39                   1517792221
 40                   1517792261
 41                   1517792343
 42                   1517792343
 43                   1517792429
 44                   1517792473
 45                   1517792563
 46                   1517792609
 47                  71336257041
 48                  71336257041
 49                  71336257139
 50                  71336257189
 51                3638149121841
 52                3638149121893
 53                3638149121946
 54              196460052588000
 55              196460052588055
 56              196460052588055
 57            11198222997525633
 58            11198222997525691
 59            11198222997525750
 60            11198222997525810
 61            11198222997525871
 62            11198222997525871
 63            11198222997525997
 64            11198222997526061
 65            11198222997526191
 66            11198222997526191
 67            11198222997526325
 68            11198222997526393
 69            11198222997526531
 70            11198222997526601
 71           795073832824398753
 72           795073832824398753
 73           795073832824398899
 74           795073832824398973
 75         59630537461829934225
 76         59630537461829934301
 77         59630537461829934378
 78       4651181922022734887568
 79       4651181922022734887647
 80       4651181922022734887647
 81     376745735683841525912529
 82     376745735683841525912611
 83     376745735683841525912694
 84     376745735683841525912778
 85     376745735683841525912863
 86     376745735683841525912863
 87     376745735683841525913037
 88     376745735683841525913125
 89     376745735683841525913303
 90     376745735683841525913303
 91     376745735683841525913485
 92     376745735683841525913577
 93     376745735683841525913763
 94     376745735683841525913857
 95   35790844889964944961834465
 96   35790844889964944961834465
 97   35790844889964944961834659
 98   35790844889964944961834757
 99 3543293644106529551221660545
100 3543293644106529551221660645

Perl 6, 62 bytes
1,{((my \v=$_+my \n=++$+1)+n*(v%%2-v%%3))*(v%%4*n||1)}.../645/

Try it online!
REALLY had to work to get my byte count below those of the other non-golf-language solutions.

Stax, 27 bytes
üµu█QZN/┴¶▬▲▌∙.h├û:╬πa⌠ú-Bq

Run and debug it
Can be improved, definitely, just can't find a way to remove the register usage.
Explanation
1AJDQ_^Y+X"+-*"{]xi^^%{ysl}{d}?F
1                                 push 1
 AJ                               push 10 squared
   D                              repeat the rest of the program 100 times
    Q                             print the current number
     _^                           iteration number
       Y                          store in Y
        +X                        add the two, store in X
          "+-*"{               F  for each of +,-,*
                ]                 convert to string
                 xi^^%            x modulo (iteration count + 2)
                      {   }   ?   if true:
                       ysl        push y and apply the operation
                           { }    else:
                            d     delete the operation

@KevinCruijssen added it.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Code Golf Golf Golf
Golf Challenge
Given the below ASCII "Green".
|          |
|  |>      |
|  |       |
|  O       |
|          |
|          |
|          |
|          |
|          |
|          |

Let | Denote a wall
Let | Denote half the flag pole
Let > Denote the flag on the pole
Let O Denote the hole
Let o Denote the ball
The dimensions of the "Green" is 10x10. There are ten spaces between the two walls |.
There are also ten spaces, empty or not between the top and the bottom of the green.
Challenge
Input an x and y value or
generate two random numbers to "shoot" a golf ball onto the green.
If the x, y generated does not touch the hole or the flag pole/flag output "Try Again!"
If the x, y generated hits the hole output "Hole in One!"
if the x, y generated hits the pole output "Lucky Shot!"
if the x, y generated hits the flag output "Close One!"
After the shot, output the location of the ball on the green with a o, replacing any character it hit. Also output the respective saying above.
Examples:
//Hole in one example, the O was replaced with a o
Randomed x = 3
Randomed y = 4

"Hole in One!"

|          |
|  |>      |
|  |       |
|  o       |
|          |
|          |
|          |
|          |
|          |
|          |

//Clone example, the top half of the pole was replaced with a o
Randomed x = 3
Randomed y = 2

"Lucky Shot!"

|          |
|  o>      |
|  |       |
|  O       |
|          |
|          |
|          |
|          |
|          |
|          |

//Lucky Shot example, the > was replaced with a o
Randomed x = 4
Randomed y = 2

"Close One!"

|          |
|  |o      |
|  |       |
|  O       |
|          |
|          |
|          |
|          |
|          |
|          |

//Try Again example, the <space> was replaced with a o
Randomed x = 5
Randomed y = 1

"Try Again!"

|     o    |
|  |>      |
|  |       |
|  O       |
|          |
|          |
|          |
|          |
|          |
|          |

Have fun and good luck and as this is code-golf the shortest code wins!

Is the flag / pole always at the same position?

You can leave it where it is, or have some fun with it and move it around. I figured it would be too much of a pain to move it around but I think it adds a fun challenge. If you move it I would make sure 2<h<=10 where h is the hole's height index. That way the flag isn't off the screen.

Does "Input an x and y value or generate two random numbers" mean we can choose or does it mean we need to handle input, with no input as random? Can we generate one number of 100 and/or take one such input?

Either take two paramters i and k where 0<i<=10 and 0<k<=10 or set i and k using random number generation

Can we use zero-indexing?

@corvus_192 absolutely

Those output strings are painful for code golf. Since there are no answers yet, consider allowing to take them as an input

@Luis Definitely painful and that's the part that I need to work on to bring my byte count down :-)

Are the flagpole characters intended to be the same as the walls?

@JDL Yes they are the same

JavaScript (ES6) 210 208 193 184 bytes
f=(a,b)=>((s=[...(`
|          |`).repeat(10)])[17]=s[30]='|',s[18]='>',s[43]=0,s[a+=1+b*13]='o',(a-17&&a-30?a-18?a-43?'Try Again!':'Hole in One!':'Close One!':'Lucky Shot!')+s.join``)

-9 bytes thanx to Hedi

Demo

Jelly, 78 bytes
ċÐ€®Ḍị“ȷþḄ7Ẋ“þẹƊ⁴ḳL&Ṛ“qĠṂ®““ÞzḊṁġ“»;”!Ṅṛ
⁶ẋ“€¡®µC‘ż“|>|O”©F”o⁸¦Ç
ṭḌ‘Çs⁵j@€⁾||Y

Play a Skill-Game or a Crap-Shoot at TryItOnline!
(Crap-shoot cost more bytes).
How?
ṭḌ‘Çs⁵j@€⁾||Y - Main link: x, y (0-based)
ṭ             - tack            -> [y, x]
 Ḍ            - cast to decimal -> 10y+x
  ‘           - increment       -> 10y+x+1
   Ç          - call last link (1) as a monad
    s⁵        - split into chunks of size 10 (rows of green display)
         ⁾||  - literal ['|','|']
      j@€     - join €ach  with reversed @rguments (make the border)
            Y - join with line feeds
              - implicit print

⁶ẋ“€¡®µC‘ż“|>|O”©F”o⁸¦Ç - Link 1, Make green & place the ball: decimal 1-based location
  “€¡®µC‘               - code page indexes -> [12,0,8,9,67]
⁶                       - literal ' '
 ẋ                      - repeat (vectorises)
         ż              - zip with
          “|>|O”        - literal ['|','>','|','O']
                ©       -     and place the flag parts into the register
                 F      - flatten list
                     ¦  - apply to index at
                    ⁸   - input value
                  ”o    - literal 'o'
                      Ç - call the last link (2) as a monad

ċÐ€®Ḍị“ȷþḄ7Ẋ“þẹƊ⁴ḳL&Ṛ“qĠṂ®““ÞzḊṁġ“»;”!Ṅṛ - Link 2, Print message: green with ball
   ®                                     - read register (the flag parts)     | > | O
ċÐ€                                      - count occurrences e.g. HoleInOne: [2,1,2,0]
    Ḍ                                    - cast to decimal                  ->2120
     ị                                   - index into (1-based & modular) 2120 % 6 = 2
      “ȷþḄ7Ẋ“þẹƊ⁴ḳL&Ṛ“qĠṂ®““ÞzḊṁġ“»      - compressed list of (6) strings:
              ...["Lucky Shot","Hole in One","Try Again","","Close One",""]
                                   ;     - concatenate with
                                    ”!   - literal '!'
                                      Ṅ  - print with linefeed
                                       ṛ - yield right argument (the green)

Python 2, 290 264 262 252 248 245 bytes
It's not pretty and it's not short but I'm tired and its the first only Python answer. Enter shot in x,y format.
Edit
Golfed off 26 by redefining the way the list is built. Still no luck with the long if statement though.
-2 by replacing the long if with a dictionary and a shorter if.
-10 with thanks to @Noodle9 - I'd missed that one :)
-4 - thanks again :)
Another 3 off. Thanks.
x,y=input();a=[' ']*120;a[15]=a[27]='|';a[16],a[39],b='>','0',x+y*12
a[b],k='o',"Lucky Shot!";l={16:"Close One!",15:k,27:k,39:"Hole in One!"}
print l[b]if b in l else"Try Again!"
for z in range(10):c=z*12;a[c]=a[c+11]='|';print''.join(a[c:c+12])

For anyone who is interested in the logic, ungolfed with comments (1316 bytes but still easily fits on a 3.5" disk if anyone remembers them):
x,y=input()                                     #Get the input as a tuple
a=[' ']*120                                     #Create a great big list of spaces for the whole green
a[15]=a[27]='|'                                 #Put the flag pole in place
a[16]='>'                                       #Add the flag
a[39]='0'                                       #Add the hole
b=x+y*12                                        #Get the absolute position in the list of the input tuple
a[b]='o'                                        #Place the ball on the green
k="Lucky Shot!"                                 #Set a variable for k because it is long and we're going to use it twice
l={16:"Close One!",15:k,27:k,39:"Hole in One!"} #Create a dictionary of the comments (using k)
print l[b]if b in l else"Try Again!"            #If the absolute index is in the dict then print it otherwise print the default
for z in range(10):                             #Loop through the length of the green
    c=z*12                                      #Set a variable for the start point of each line
    a[c]=a[c+11]='|'                            #Add the left and right walls
    print''.join(a[c:c+12])                     #Print each line in turn. Because this is in a for loop then Python will deal with newlines

Definitely the first time for me that a dictionary has been the best data format in a golf challenge.

you can use anything that's hashable as a dictionary key

C, 236 bytes
n,m;char*a[]={"Try Again!","Hole in One!","Lucky Shot!","Close One!"};f(x,y){n=130;m=142-y*13-x;puts(a[(m==87)+2*(m==113|m==100)+3*(m==112)]);while(n--)putchar(m==n?111:n%13?n%13==1|n%13==12|n==113|n==100?124:n==112?62:n==87?79:32:10);}

Ungolfed:
n,m;
char*a[]={"Try Again!","Hole in One!","Lucky Shot!","Close One!"};
f(x,y){
 n=130;
 m=142-y*13-x;
 puts(a[(m==87) + 2*(m==113|m==100) + 3*(m==112)]);
 while(n--)
  putchar(m==n?111:n%13?n%13==1|n%13==12|n==113|n==100?124:n==112?62:n==87?79:32:10);
}

Scala, 238 bytes
(x:Int,y:Int)=>{val r="<          |\n"
('"'+(if(x==2&y==3)"Hole in One!"else
if(x==2&(y==1|y==2))"Lucky Shot!"else
if(x==3&y==1)"Close One!"else
"Try again!")+"'",(r+"|  |>      |\n|  |       |\n|  O       |\n"+r*6)updated(1+x+13*y,'o'))}

Using zero-indexing.
This is way too readable :(
Explanation:
(x:Int,y:Int)=>{                                      //define an anonymous function
  val r="|          |\n"                                //a shortcut for an empty row
  (                                                     //return a tuple of
    '"'+                                                  //a double quote
    (if(x==2&y==3)"Hole in One!"                          //plus the correct string
    else if(x==2&(y==1|y==2))"Lucky Shot!"
    else if(x==3&y==1)"Close One!"
    else "Try again!"
    )+"'"                                                 //and another quote
  ,                                                     //and
    (r+"|  |>      |\n|  |       |\n|  O       |\n"+r*6) //the field
    updated(1+x+13*y,'o')                                //with the (1+x+13*y)th char replaced with a ball
  )
}

I've used the formula 1+x+13*y to calculate the correct index, since each row is 13 chars long (2 borders, a newline and 10 spaces) plus an offset of one because (0,0) should be the second char.

Perl, 225 209 bytes
$_="|".$"x10 ."|
";$_.=sprintf("|  %-8s|
"x3,"|>","|",O).$_ x6;$d="Try Again!";($x,$y)=@ARGV;say$x==3?$y~~[2,3]?"Lucky Shot!":$y==4?"Hole in One!":$d:$x==4&&$y==2?"Close One!":$d;substr($_,$y*13-13+$x,1)=o;say

The two literal newlines each save one byte.  Pretty standard.  Prints the declaration, then the game board.

Charcoal, 99 bytes
ＮαＮβ× ⁵↑¹⁰‖Ｃ←Ｊ⁴¦²←>↓²OＭ⁴↖Ｐ⁺⎇∧⁼α³⁼β⁴Hole in One⎇∧⁼α³⁼¹÷β²Lucky Shot⎇∧⁼α⁴⁼β²Close One¦Try Again¦!Ｊαβo

Takes 1-based input, space-separated, on stdin. Most of the code is for printing (one of) the four messages. Try it online!
Note: Charcoal is still a work in progress. This code works as of the current commit. If it stops working in the future (in particular, if the TIO link doesn't work as expected), ping me and I'll try to add a non-competing updated version that works.
Explanation
ＮαＮβ       Read two inputs as numbers into variables α and β

               Construct the green and flag:
× ⁵          Print to canvas 5 spaces
↑¹⁰          Print 10 | characters going up
‖Ｃ←         Reflect and copy leftward
             At this point, borders of green are complete; cursor is above left wall
Ｊ⁴¦²        Jump 4 units right and 2 down
←>           Print the flag, going leftward
↓²           Print the pin (2 | characters), going downward
O            Print the hole
             The last print was rightward by default, which means we're now at (4,4)
Ｍ⁴↖         Move 4 units up and left; cursor is above left wall again

               Add the proper message:
⎇∧⁼α³⁼β⁴    If α is 3 and β is 4 (in the hole):
Hole in One
⎇∧⁼α³⁼¹÷β²  Else if α is 3 and β is 2 or 3 (hit the pin):
Lucky Shot
⎇∧⁼α⁴⁼β²    Else if α is 4 and β is 2 (hit the flag):
Close One
             Else:
¦Try Again
⁺...¦!       Concatenate a ! to the string
Ｐ           Print it without changing the cursor position

               Overwrite the appropriate spot with o:
Ｊαβ         Jump α units right and β units down
o            Print o

Brain-Flak, 1466 1938 bytes
(<()>)<>((()()()()()){}){({}[()]<(((((((()()()()()){})){}{}()){}){})<((()()()()()){}){({}[()]<(((((()()){}){}){}){})>)}{}>)((()()()()()){})>)}{}((((()()){}){}){}()){({}[()]<({}<>)<>>)}{}{}{}(((((()()()()()){})){}{}()){})(((((((()()()()()){})){}{}()){}){})<(((()()()){}){}()){({}[()]<({}<>)<>>)}{}{}>)(((()()()){}){}()){({}[()]<({}<>)<>>)}{}{}(((((()()()){}){}){}){}){<>({}<>)}(<>{}((((({}[()])){}){})){}{}{}()<>{}){({}[()]<({}<>)<>>)}{}({}<(((((((()()()){}){})){}{}())){}{}){<>({}<>)}>)(({}<((({}(((()()){}){}){}()){})[()])>)[((((()()){}){}){}){}]){({}[(((()()){}){}){}]){({}[((()()()){}()){}]){{}{}(((((((((()()()){}()){}){}()){}){})[()()()()()])[(()()()){}()])<(((((()()()()()){}){}){}()){}())(((((()()){}){}){}){})>(((()()){}){}){}())(([((()()()){}()){}](({})<>)<>)[((()()){}){}])((<>{}<>[()()()()])[(((()()()()()){}){}){}()])<>}{}{{}((((((((((()()()){}){}){}()){}){}())<>)<>((()()())){}{})[(((()()()()()){})){}{}()])<(((((()()){}){}){}){})((((<>{}<>)((()()()){}()){})[()()()()])[()()()])>[((()()()){}){}])<>}}{}{{}((((((((()()()){}){}){}()){}){}())((()()())){}{})[(((()()()()()){})){}{}()])((((((()()){}){}){}){})<(((((()()()()()){}){({}[()])}{}){})[()()()()()])>)((((((((()()()){}){}){}()){}){}())(()()()){}())()()())((((((()()()){}){}){})){}{})<>}{}}{}{{}(((((((()()()()()){}){({}[()])}{}){})[()()()()()])[((()()){}){}])(()()()){})(((((((((((()()){}){}){}){})))({}<({}{}())>)[()()()()]){}())[(()()()){}()])[(((()()()()()){})){}{}])<>}<>(((((()()){}){}){}()){})

Try it online!

Did I win?

You seem to have a null byte being printed at the end of the first line of output.

@1000000000 yes. I have fixed that with my latest update. Thank you for pointing that out.

Dyalog APL, 147 (or 127) bytes
Takes (y,x) as argument.
{G←10 10⍴''
G[⍳4;3]←' ||O'
G[2;4]←'>'
G[⊃⍵;⊃⌽⍵]←'o'               ⍝ G[y;x]←
⎕←'|',G,'|'                 ⍝ Print G with sides
4 3≡⍵:'Hole in One!'        ⍝ If (y,x) ≡ (4,3)
(⊂⍵)∊2 3∘.,3:'Lucky Shot!'  ⍝ If (y,x) ∊ {(2,3), (2,3)}
2 4≡⍵:'Close One!'
'Try Again!'}               ⍝ Else

From version 16.0, we can almost halve the byte-count with the new @ operator;
@ puts the left operand into the right-operand positions in the right argument: NewChars @ Positions ⊢ Data
{⎕←'|','|',⍨' ||O>o'@((2 4)⍵,⍨3,⍨¨⍳4)⊢10 10⍴''
4 3≡⍵:'Hole in One!'
(⊂⍵)∊2 3∘.,3:'Lucky Shot!'
2 4≡⍵:'Close One!'
'Try Again!'}

Slightly modified code to make permissible in TryAPL:
Hole in One, Lucky Shot 1, Lucky Shot 2, Close One, Random

TI-Basic, 183 bytes
Input X
Input Y
X+1➡X
ClrHome
For(I,1,10
Output(I,1,"|
Output(I,12,"|
End
Output(2,4,"|>
Output(3,4,"|
Output(4,4,"O
Output(Y,X,"o
13
Output(1,Ans,"TRY AGAIN!
If X=4 and Y=4
Output(1,Ans,"HOLE IN ONE!
If X=5 and Y=2
Output(1,Ans,"CLOSE ONE!
If Y=2 or Y=3 and X=4
Output(1,Ans,"LUCKY SHOT!

Thank goodness TI-Basic uses tokens.
The | cannot normally be typed, but it is in the character set.
Please let me know if the result of the shot absolutely has to be lowercase.
I will add a screenshot of an example program result later.

Groovy - 235 bytes
My first attempt - A groovy closure accepting 2 integers from 0 to 9 as the X and Y coordinates for the shot.
{j,k->j++;c='';b='|';f='>';h='O';s=' ';v=[2:b,3:b,4:h];(0..9).each{y->l=(b+s*10+'|\n').chars;l[3]=v[y]?:s;l[4]=y==2?f:s;if(k==y){m=[(s):'Try Again!',(b):'Lucky Shot!',(f):'Close One!',(h):'Hole In One!'][""+l[j]];l[j]='o'};c+=l};c+=m}

Turtled, 164 bytes
Once again, showcasing Turtlèd's balance between golfiness and verbosity for the simplest things (like incrementing a number), Turtlèd beats all but the golfing langs.
6;11[*'|:'|>;<u]'|rrr'O8:'|u'|>;'|ddd'|l'|uuu<"|>":l'|u'|>11;'|?<:?;( #Try Again!#)(>#Close One!#)(|#Lucky Shot!#)(O#Hole in One!#)'o[|r][ u]dl[|l][ u]u@"-,r["+.r_]

Try it online
Note that it is half zero indexed and half one indexed; x is one indexed, y is zero indexed; 3,3 is a hole in one

R, 230 226 bytes
M=matrix("|",10,10);M[2:9,]=" ";M[34]="0";M[4,2:3]="f";M[15]=">";function(x,y){m=switch(M[y,x],">"="Close One","f"="Lucky Shot","0"="Hole In One","Try again");M[y,x]="o";cat(m,"!\n",sep="");cat(gsub("f","|",M),sep="",fill=10)}

Thanks to @billywob for -2 bytes, noticing M[a,b] is equivalent to M[c] in a couple of cases.
Annoyingly, the two cat calls (!) can't be concatenated into one, since the fill argument messes up the message. Argh!

Move the creation of the matrix inside the function and make in an unnamed one: function(x,y){M=matrix("|",10,10);M[2:9,]=" ";M[34]="0";M[4,2:3]="f";M[15]=">";m=switch(M[y,x],">"="Close One","f"="Lucky Shot","0"="Hole In One","Try again");M[y,x]="o";cat(m,"!\n",sep="");cat(gsub("f","|",M),sep="",fill=10)}

Oh, fair enough. Mind you, I don't think I needed f= in my solution anyway. Removed.