8 replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
source | link

C#, 242 241 238 230 222 219 Bytes

Spurred on by Martin's commentMartin's comment, here's my first attempt at something like this:

string h(int n){int x=0;string p="",r=n==0?"O":p;if(n>0){for(;x++<n;){r+=" /\\";p+=" \\/";}r+="\nO  ";for(;x-->2;)r+="/  ";r+="O\n"+p;}else if(n<0){r+=@" O
/ \
";for(--x;x-->n;)r+=@"\ /
 \
/ \
";r+=@"\ /
 O";}return r;}

More readably:

string h(int n)
{
    int x = 0;
    string p = "",
            r = n==0 ? "O" : p;
    if (n > 0) {
        for (; x++ < n;) {
            r += " /\\";
            p += " \\/";
        }
        r += "\nO  ";
        for (; x-- > 2;) r += "/  ";
        r += "O\n" + p;
    }
    else if(n<0) {
        r += @" O
/ \
";
        for (--x; x-- > n;) r += @"\ /
 \
/ \
";
        r += @"\ /
 O";
    }
    return r;
}

C#, 242 241 238 230 222 219 Bytes

Spurred on by Martin's comment, here's my first attempt at something like this:

string h(int n){int x=0;string p="",r=n==0?"O":p;if(n>0){for(;x++<n;){r+=" /\\";p+=" \\/";}r+="\nO  ";for(;x-->2;)r+="/  ";r+="O\n"+p;}else if(n<0){r+=@" O
/ \
";for(--x;x-->n;)r+=@"\ /
 \
/ \
";r+=@"\ /
 O";}return r;}

More readably:

string h(int n)
{
    int x = 0;
    string p = "",
            r = n==0 ? "O" : p;
    if (n > 0) {
        for (; x++ < n;) {
            r += " /\\";
            p += " \\/";
        }
        r += "\nO  ";
        for (; x-- > 2;) r += "/  ";
        r += "O\n" + p;
    }
    else if(n<0) {
        r += @" O
/ \
";
        for (--x; x-- > n;) r += @"\ /
 \
/ \
";
        r += @"\ /
 O";
    }
    return r;
}

C#, 242 241 238 230 222 219 Bytes

Spurred on by Martin's comment, here's my first attempt at something like this:

string h(int n){int x=0;string p="",r=n==0?"O":p;if(n>0){for(;x++<n;){r+=" /\\";p+=" \\/";}r+="\nO  ";for(;x-->2;)r+="/  ";r+="O\n"+p;}else if(n<0){r+=@" O
/ \
";for(--x;x-->n;)r+=@"\ /
 \
/ \
";r+=@"\ /
 O";}return r;}

More readably:

string h(int n)
{
    int x = 0;
    string p = "",
            r = n==0 ? "O" : p;
    if (n > 0) {
        for (; x++ < n;) {
            r += " /\\";
            p += " \\/";
        }
        r += "\nO  ";
        for (; x-- > 2;) r += "/  ";
        r += "O\n" + p;
    }
    else if(n<0) {
        r += @" O
/ \
";
        for (--x; x-- > n;) r += @"\ /
 \
/ \
";
        r += @"\ /
 O";
    }
    return r;
}
7 "r" initialisation optimisation
source | link

C#, 242 241 238 230 222222 219 Bytes

Spurred on by Martin's comment, here's my first attempt at something like this:

string h(int n){int x=0;string r=""p="",p="";if(n==0)r="O";else ifr=n==0?"O":p;if(n>0){for(;x++<n;){r+=" /\\";p+=" \\/";}r+="\nO  ";for(;x-->2;)r+="/  ";r+="O\n"+p;}else if(n<0){r+=@" O
/ \
";for(--x;x-->n;)r+=@"\ /
 \
/ \
";r+=@"\ /
 O";}return r;}

More readably:

string h(int n)
{
    int x=0;x = 0;
    string rp = "", 
 p           r = "";n==0 ? "O" : p;
    if (n > 0) {
        for (; x++ < n;) {
            r += " /\\";
            p += " \\/";
        }
        r += "\nO  ";
        for (; x-- >2;)
          > 2;) r += "/  ";
        r += "O\n"+p;"O\n" + p;
    }
    else if (n < 0n<0) {
        r += @" O
/ \
";
        for (--x; x-- > n;)
            r += @"\ /
 \
/ \
";
        r += "\\@"\ /\n O";
    }
    else {
        r = "O";O";
    }
    return r;
}

C#, 242 241 238 230 222 Bytes

Spurred on by Martin's comment, here's my first attempt at something like this:

string h(int n){int x=0;string r="",p="";if(n==0)r="O";else if(n>0){for(;x++<n;){r+=" /\\";p+=" \\/";}r+="\nO  ";for(;x-->2;)r+="/  ";r+="O\n"+p;}else{r+=@" O
/ \
";for(--x;x-->n;)r+=@"\ /
 \
/ \
";r+=@"\ /
 O";}return r;}

More readably:

string h(int n)
{
    int x=0;
    string r = "", p = "";
    if (n > 0) {
        for (; x++ < n;) {
            r += " /\\";
            p += " \\/";
        }
        r += "\nO  ";
        for (; x-- >2;)
            r += "/  ";
        r += "O\n"+p;
    }
    else if (n < 0) {
        r += @" O
/ \
";
        for (--x; x-- > n;)
            r += @"\ /
 \
/ \
";
        r += "\\ /\n O";
    }
    else {
        r = "O";
    }
    return r;
}

C#, 242 241 238 230 222 219 Bytes

Spurred on by Martin's comment, here's my first attempt at something like this:

string h(int n){int x=0;string p="",r=n==0?"O":p;if(n>0){for(;x++<n;){r+=" /\\";p+=" \\/";}r+="\nO  ";for(;x-->2;)r+="/  ";r+="O\n"+p;}else if(n<0){r+=@" O
/ \
";for(--x;x-->n;)r+=@"\ /
 \
/ \
";r+=@"\ /
 O";}return r;}

More readably:

string h(int n)
{
    int x = 0;
    string p = "", 
            r = n==0 ? "O" : p;
    if (n > 0) {
        for (; x++ < n;) {
            r += " /\\";
            p += " \\/";
        }
        r += "\nO  ";
        for (; x-- > 2;) r += "/  ";
        r += "O\n" + p;
    }
    else if(n<0) {
        r += @" O
/ \
";
        for (--x; x-- > n;) r += @"\ /
 \
/ \
";
        r += @"\ /
 O";
    }
    return r;
}
6 loop condition optimisations
source | link

C#, 242 241 238 230230 222 Bytes

Spurred on by Martin's comment, here's my first attempt at something like this:

string ih(int n){int x;stringx=0;string r="",p="";if(n==0)r="O";else if(n>0){for(x=0;x<n;x++;x++<n;){r+=" /\\";p+=" \\/";}r+="\nO  ";for(x=1;x<n;x++;x-->2;)r+="/  ";r+="O\n"+p;}else{r+=@" O
/ \
";for(x=-1;x>n;x-x;x-->n;)r+=@"\ /
 \
/ \
";r+=@"\ /
 O";}return r;}

More readably:

private static string h(int n)
{
    int x;x=0;
    string r = "", p = "";
    if (n == 0) r = "O";
    else if (n > 0) {
        for (x = 0;; xx++ < n; x++) {
            r += " /\\";
            p += " \\/";
        }
        r += "\nO  ";
        for (x = 1;; x < n;-- x++>2;)
            r += "/  ";
        r += "O\n"+p;
    }
    else if (n < 0) {
        r += @" O
/ \
";
        for (x = -1;-x; x-- > n; x--)
            r += @"\ /
 \
/ \
";
        r += @"\"\\ /
 \n O";
    }
    else {
        r = "O";
    }
    return r;
}

C#, 242 241 238 230 Bytes

Spurred on by Martin's comment, here's my first attempt at something like this:

string i(int n){int x;string r="",p="";if(n==0)r="O";else if(n>0){for(x=0;x<n;x++){r+=" /\\";p+=" \\/";}r+="\nO  ";for(x=1;x<n;x++)r+="/  ";r+="O\n"+p;}else{r+=@" O
/ \
";for(x=-1;x>n;x--)r+=@"\ /
 \
/ \
";r+=@"\ /
 O";}return r;}

More readably:

private static string h(int n)
{
    int x;
    string r = "", p = "";
    if (n == 0) r = "O";
    else if (n > 0) {
        for (x = 0; x < n; x++) {
            r += " /\\";
            p += " \\/";
        }
        r += "\nO  ";
        for (x = 1; x < n; x++)
            r += "/  ";
        r += "O\n"+p;
    }
    else {
        r += @" O
/ \
";
        for (x = -1; x > n; x--)
            r += @"\ /
 \
/ \
";
        r += @"\ /
  O";
    }
    return r;
}

C#, 242 241 238 230 222 Bytes

Spurred on by Martin's comment, here's my first attempt at something like this:

string h(int n){int x=0;string r="",p="";if(n==0)r="O";else if(n>0){for(;x++<n;){r+=" /\\";p+=" \\/";}r+="\nO  ";for(;x-->2;)r+="/  ";r+="O\n"+p;}else{r+=@" O
/ \
";for(--x;x-->n;)r+=@"\ /
 \
/ \
";r+=@"\ /
 O";}return r;}

More readably:

string h(int n)
{
    int x=0;
    string r = "", p = "";
    if (n > 0) {
        for (; x++ < n;) {
            r += " /\\";
            p += " \\/";
        }
        r += "\nO  ";
        for (; x-- >2;)
            r += "/  ";
        r += "O\n"+p;
    }
    else if (n < 0) {
        r += @" O
/ \
";
        for (--x; x-- > n;)
            r += @"\ /
 \
/ \
";
        r += "\\ /\n O";
    }
    else {
        r = "O";
    }
    return r;
}
5 deleted 11 characters in body
source | link
4 deleted 11 characters in body
source | link
3 deleted 68 characters in body
source | link
2 added 50 characters in body
source | link
1
source | link