Skip to main content
Commonmark migration
Source Link

#C# 233 221 213 203 bytes

C# 233 221 213 203 bytes

method takes an int array a as the list of fallen pins

string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;){var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ":"( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y="";z+=" ";}}return o;} 

wrapped

string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;) {var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ": "( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y=""; z+=" ";}}return o;} 

expanded

string S(int[] a) { string o = "", x = o, y = o, z= o; for (int i = 10; i > 0;) { var c = a.Contains(i); x = (c ? " " : "(.,.) ") + x; y = (c ? "_____ " : "( : ) ") + y; if (i==7|i<5&i--!=3) { o += $"{z}{x}\n{z}{y}\n"; x = y = ""; z += " "; } } return o; } 

knocked off a few bytes by suggestions in comments from Ghost, raznagul and auhmaan.

#C# 233 221 213 203 bytes

method takes an int array a as the list of fallen pins

string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;){var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ":"( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y="";z+=" ";}}return o;} 

wrapped

string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;) {var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ": "( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y=""; z+=" ";}}return o;} 

expanded

string S(int[] a) { string o = "", x = o, y = o, z= o; for (int i = 10; i > 0;) { var c = a.Contains(i); x = (c ? " " : "(.,.) ") + x; y = (c ? "_____ " : "( : ) ") + y; if (i==7|i<5&i--!=3) { o += $"{z}{x}\n{z}{y}\n"; x = y = ""; z += " "; } } return o; } 

knocked off a few bytes by suggestions in comments from Ghost, raznagul and auhmaan.

C# 233 221 213 203 bytes

method takes an int array a as the list of fallen pins

string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;){var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ":"( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y="";z+=" ";}}return o;} 

wrapped

string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;) {var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ": "( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y=""; z+=" ";}}return o;} 

expanded

string S(int[] a) { string o = "", x = o, y = o, z= o; for (int i = 10; i > 0;) { var c = a.Contains(i); x = (c ? " " : "(.,.) ") + x; y = (c ? "_____ " : "( : ) ") + y; if (i==7|i<5&i--!=3) { o += $"{z}{x}\n{z}{y}\n"; x = y = ""; z += " "; } } return o; } 

knocked off a few bytes by suggestions in comments from Ghost, raznagul and auhmaan.

language formatting
Source Link
Erresen
  • 459
  • 4
  • 12
string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;){var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ":"( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y="";z+=" ";}}return o;} 
string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;){var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ":"( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y="";z+=" ";}}return o;} 
string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;) {var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ": "( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y=""; z+=" ";}}return o;} 
string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;) {var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ": "( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y=""; z+=" ";}}return o;} 
string S(int[] a) { string o = "", x = o, y = o, z= o; for (int i = 10; i > 0;) { var c = a.Contains(i); x = (c ? " " : "(.,.) ") + x; y = (c ? "_____ " : "( : ) ") + y; if (i==7|i<5&i--!=3) { o += $"{z}{x}\n{z}{y}\n"; x = y = ""; z += " "; } } return o; } 
string S(int[] a) { string o = "", x = o, y = o, z= o; for (int i = 10; i > 0;) { var c = a.Contains(i); x = (c ? " " : "(.,.) ") + x; y = (c ? "_____ " : "( : ) ") + y; if (i==7|i<5&i--!=3) { o += $"{z}{x}\n{z}{y}\n"; x = y = ""; z += " "; } } return o; } 
string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;){var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ":"( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y="";z+=" ";}}return o;} 
string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;) {var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ": "( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y=""; z+=" ";}}return o;} 
string S(int[] a) { string o = "", x = o, y = o, z= o; for (int i = 10; i > 0;) { var c = a.Contains(i); x = (c ? " " : "(.,.) ") + x; y = (c ? "_____ " : "( : ) ") + y; if (i==7|i<5&i--!=3) { o += $"{z}{x}\n{z}{y}\n"; x = y = ""; z += " "; } } return o; } 
string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;){var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ":"( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y="";z+=" ";}}return o;} 
string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;) {var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ": "( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y=""; z+=" ";}}return o;} 
string S(int[] a) { string o = "", x = o, y = o, z= o; for (int i = 10; i > 0;) { var c = a.Contains(i); x = (c ? " " : "(.,.) ") + x; y = (c ? "_____ " : "( : ) ") + y; if (i==7|i<5&i--!=3) { o += $"{z}{x}\n{z}{y}\n"; x = y = ""; z += " "; } } return o; } 
switched to ternary
Source Link
Erresen
  • 459
  • 4
  • 12

#C# 233 221 213213 203 bytes

knocked off a few bytes by adapting Ghost's suggestion, and a few more from raznagul.

method takes an int array a as the list of fallen pins

string S(int[]a){string o="",x=""x=o,y=""y=o,z="";for z=o;for(int i=10;i>0;){if(avar c=a.Contains(i)){x=" ;x=(c?" "+x;y="_____ "+y;}else{x="":"(.,.) "+x;y="")+x;y=(c?"_____ ":"( : ) "+y;}if")+y;if(i==7|i<5&i--!=3) {o+=$"{z}{x}\n{z}{y}\n";x=y="";z+=" ";}}return o;} 

wrapped

string S(int[]a){string o="",x=""x=o,y=""y=o,z="";forz=o;for(int i=10;i>0;) {if(avar c=a.Contains(i)){x=" ;x=(c?" "+x;y="_____ "+y;}else{x="":"(.,.) "+x;y="")+x;y=(c?"_____ ":  "( : ) "+y;}if")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y="";z\n";x=y=""; +="z+=" ";}}return o;} 

expanded

string S(int[] a) { string o = "", x = ""o, y = ""o, z= "";o; for (int i = 10; i > 0;) { ifvar (c = a.Contains(i)) {;   x = "  (c ? " + x;  y = "_____ " + y;  } else { x =: "(.,.) ") + x; y = (c ? y"_____ =" : "( : ) ") + y;  } if (i==7|i<5&i--!=3) { o += $"{z}{x}\n{z}{y}\n"; x = y = ""; z += " "; } } return o; } 

knocked off a few bytes by suggestions in comments from Ghost, raznagul and auhmaan.

#C# 233 221 213 bytes

knocked off a few bytes by adapting Ghost's suggestion, and a few more from raznagul.

method takes an int array a as the list of fallen pins

string S(int[]a){string o="",x="",y="",z="";for (int i=10;i>0;){if(a.Contains(i)){x="  "+x;y="_____ "+y;}else{x="(.,.) "+x;y="( : ) "+y;}if(i==7|i<5&i--!=3) {o+=$"{z}{x}\n{z}{y}\n";x=y="";z+=" ";}}return o;} 

wrapped

string S(int[]a){string o="",x="",y="",z="";for(int i=10;i>0;) {if(a.Contains(i)){x="  "+x;y="_____ "+y;}else{x="(.,.) "+x;y="( :  ) "+y;}if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y="";z +=" ";}}return o;} 

expanded

string S(int[] a) { string o = "", x = "", y = "", z= ""; for (int i = 10; i > 0;) { if (a.Contains(i)) {   x = "  " + x;  y = "_____ " + y;  } else { x = "(.,.) " + x; y = "( : ) " + y;  } if (i==7|i<5&i--!=3) { o += $"{z}{x}\n{z}{y}\n"; x = y = ""; z += " "; } } return o; } 

#C# 233 221 213 203 bytes

method takes an int array a as the list of fallen pins

string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;){var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ":"( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y="";z+=" ";}}return o;} 

wrapped

string S(int[]a){string o="",x=o,y=o,z=o;for(int i=10;i>0;) {var c=a.Contains(i);x=(c?" ":"(.,.) ")+x;y=(c?"_____ ": "( : ) ")+y;if(i==7|i<5&i--!=3){o+=$"{z}{x}\n{z}{y}\n";x=y=""; z+=" ";}}return o;} 

expanded

string S(int[] a) { string o = "", x = o, y = o, z= o; for (int i = 10; i > 0;) { var c = a.Contains(i); x = (c ? " " : "(.,.) ") + x; y = (c ? "_____ " : "( : ) ") + y; if (i==7|i<5&i--!=3) { o += $"{z}{x}\n{z}{y}\n"; x = y = ""; z += " "; } } return o; } 

knocked off a few bytes by suggestions in comments from Ghost, raznagul and auhmaan.

declare strings in single statement
Source Link
Erresen
  • 459
  • 4
  • 12
Loading
removes one contains
Source Link
Erresen
  • 459
  • 4
  • 12
Loading
Source Link
Erresen
  • 459
  • 4
  • 12
Loading