### Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

### Topics - JWinslow23

Pages: 1 [2] 3 4
16
##### Community Contests / [ENDED] Code Golf Contest #11
« on: September 22, 2014, 08:52:42 pm »
#MakeEleventyAThing

NEXT: Here
PREVIOUS: Here

Challenge 11

Problem

Create a program that, given an integer 0 through 999,999, does the "4 is magic" transformation. If you don't know what that is, this is it:
• Take the number written out in English and count the number of letters (i.e. 21 is "twenty-one" is 9 letters, 102 is "one hundred two" is 13 letters, 9999 is "nine thousand nine hundred ninety-nine" is 33 letters).
• If the result is 4, output "4 is magic." and exit.
• Else, output "(original number) is (result)." and repeat step 1 with the result.
Example:
Code: [Select]
31 is 9.9 is 4.4 is magic.
-70% bonus if you actually display the number-words instead of the numbers.

October 5, 2014, 1:00 AM EST

If any further clarification is needed, contact me. I'll try to make your troubles disappear.

Ruby
 Rank User Size Date Code 1 Juju 548-70%=164.4 9/23/2014 6:25:12 PM Spoiler For Spoiler: def w(n)case nwhen 0..19["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"][n]when 20..99["twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"][n/10-2]+(n%10==0?"":" "+w(n%10))when 100..999w(n/100)+" hundred"+(n%100==0?"":" "+w(n%100))when 1000..999999w(n/1000)+" thousand"+(n%1000==0?"":" "+w(n%1000))endenda=gets.to_iwhile a!=4p w(a)+" is "+w(a=w(a).delete(" ").length)+"."endp"four is magic."

Golfscript
 Rank User Size Date Code 1 JWinslow23 360-70%=108 10/4/2014 9:37:27 AM Spoiler For Spoiler: ~{.20<{.12>["zero""one""two""three""four""five""six""seven""eight""nine""ten""eleven""twelve""thir""four""fif""six""seven""eigh""nine"]@="teen"@*+}{.100<{.10/2-["twen""thir""for""fif""six""seven""eigh""nine"]{"ty"+}%\=\10%a" "\++}{.1000<{.100/a" hundred "+\100%a+}{.1000/a" thousand "+\1000%a+}if}if}if" zero"%""+}:a;{.4=}{a." "/""+," is "\.n\}until" is magic"

Python
 Rank User Size Date Code 1 Ivoah 962-70%=288.6 9/26/2014 6:32:23 PM Spoiler For Spoiler: import sysa = {1:' one',2:' two',3:' three',4:' four',5:' five',6:' six',7:' seven',8:' eight',9:' nine',10:' ten',11:' eleven',12:' twelve',13:' thirteen',14:' fourteen',15:' fifteen',16:' sixteen',17:' seventeen',18:' eighteen',19:' nineteen',20:' twenty',30:' thirty',40:' forty',50:' fifty',60:' sixty',70:' seventy',80:' eighty',90:' ninety',100:' hundred',1000:' thousand'}def b(n): if n<=20:  if n==0:return 'zero'  else:return a[n].strip() else:  c=''  for d,e in enumerate(str(n)):   i=10**(len(str(n))-d-1)   j=int(e)   if i==1e5:c+=a[j]+a[100]   elif i==1e4:c+=a[j*10]   elif i==1e3:    if c[-3:]=='ten'and j!=0:c=c[:-4]+a[j+10]    else:c+=a[j]    c+=a[1e3]   elif i==100:c+=a[j]+a[100]   elif i==10:c+=a[j*10]   elif i==1:    if c[-3:]=='ten'and j!=0:c=c[:-4]+a[j+10]    else:c+=a[j]  c=c.strip()  return cn=sys.argv[1]while True: f=len(''.join(b(n).split())) print b(n),'is',b(f) n=f if f==4:print b(4),'is magic!';break

Java
 Rank User Size Date Code 1 3298 611-70%=183.3 10/4/2014 2:54:53 PM Spoiler For Spoiler: class G{static String[]x={"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve"},y={"twen","thir","four","fif","six","seven","eigh","nine"};static String t(int n){String s="";if(n>99){s=x[n/100]+" hundred ";n%=100;if(n==0)return s;}return s+(n<13?x[n]+" ":n<20?y[n-12]+"teen ":y[n/10-2]+"ty "+(n%10==0?"":x[n%10]+" "));}public static void main(String[]i){for(int n=Integer.parseInt(i[0]);{String s=n>999?t(n/1000)+"thousand "+(n%1000==0?"":t(n%1000)):t(n);int m=0;for(char c:s.toCharArray())if(c>64)++m;System.out.println(s+"is "+(n==4?"magic":m));if(n==4)break;n=m;}}} 2 ben_g 676-70%=202.8 9/28/2014 2:52:53 PM Spoiler For Spoiler: class e{public static void main(String[] a){int i=Integer.parseInt(a[0]);while(i!=4){a[0]=b(i).trim();if(a[0].length()==0)a[0]="zero";System.out.println(a[0]+" is "+(i=a[0].replace(" ","").length()));}System.out.println("four is magic");}static String b(int i){String[]n={"","one","two","three","four","five","six","seven","eight","nine","then","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"},m={"","","twenty","thirty","fourty","fifty","sixty","seventy","eighty","ninety","hundred"};if(i<20)return n;if(i<100)return m[i/10]+" "+n[i%10];if(i<1000)return b(i/100)+" hundred "+b(i%100);return b(i/1000)+" thousand "+b(i%1000);}}

C
 Rank User Size Date Code 1 3298 630-70%=189 10/4/2014 2:54:53 PM Spoiler For Spoiler: #includechar*x[]={"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve"},*y[]={"twen","thir","four","fif","six","seven","eigh","nine"};int l;p(char*s){printf("%s",s);l+=strlen(s);}t(int n){if(n>99){p(x[n/100]);p(" hundred");--l;if(!(n%=100))return;p(" ");--l;}if(n<13)p(x[n]);else if(n<20){p(y[n-12]);p("teen");}else{p(y[n/10-2]);p("ty");if(n%=10){p(" ");--l;p(x[n]);}}}main(int c,char**v){int n=0;while(*(v[1]))n=10*n+*(v[1]++)-48;r:l=0;if(n>999){t(n/1000);p(" thousand");--l;if(n%1000){p(" ");--l;t(n%1000);}}else t(n);if(n-4){n=l;printf(" is %i\n",n);goto r;}p(" is magic\n");} 2 ben_g 861-70%=258.3 10/3/2014 3:52:36 AM Spoiler For Spoiler: #include #include #include static const char *m[]={"","one","two","three","four","five","six","seven","eight","nine","then","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};static const char *n[]={"","","twenty","thirty","fourty","fifty","sixty","seventy","eighty","ninety","hundred"};const char * w(int l, char* u){if(l==0){sprintf(u,"zero");return;}if(l<20){sprintf(u,"%s",m[l]);return;}if(l<100){sprintf(u,"%s %s",n[l/10],m[l%10]);return;}if(l<1000) {sprintf(u,"%s hundred ",m[l/100]);w(l%100,u+strlen(u));return;}w(l/1000,u);sprintf(u+strlen(u)," thousand ");w(l%1000,u+strlen(u));return;}int main(int argc,char *argv[]){int a=atoi(argv[1]);while(a!=4){char b[70]={0};int i=0;w(a,b);a=0;while(b!='\0'){if(b!=' ')a++;i++;}printf("%s is %i,\n",b,a);}printf("4 is magic.\n");}

SysRPL
 Rank User Size Date Code 1 3298 493.5-70%=148.05 10/4/2014 2:54:53 PM Spoiler For Spoiler: ::  { "twen" "thir" "four" "fif" "six" "seven" "eigh" "nine" }  ' ::    BINT100 #/ DUP#0=ITE DROPNULL$:: 1GETLAMSWAP_ NTHCOMPDROP " hundred " &$    ;    SWAP DUP#0=csDROP    BINT13 OVER#> case    ::      1GETLAMSWAP_ NTHCOMPDROP      APPEND_SPACE &$; BINT20 OVER#> case :: BINT11 #- 3GETLAM SWAP NTHCOMPDROP "teen " &$ &$; BINT10 #/ 3GETLAM SWAP#1- NTHCOMPDROP "ty " &$SWAP    DUP#0=csedrp &$1GETLAMSWAP_ NTHCOMPDROP APPEND_SPACE &$ &$; { "one" "two" "three" "four" "five" "six" "seven" "eight" "nine" "ten" "eleven" "twelve" } 3NULLLAM{}_ BIND COERCE BEGIN DUP#0=ITE "zero " :: DUP # 3E8 #/ DUP#0=csedrp 2GETEVAL 2GETEVAL "thousand " &$SWAP      2GETEVAL &$; BINT0 OVERLEN$ #1+_ONE_DO      [email protected] SUB$1# BINT64 #> IT #1+ LOOP UNROT "is " &$SWAP    BINT4 #=case    ::      RDROP SWAPDROP ABND      "magic" &$; OVER #>$ &$SWAP AGAIN; Language Ranking  Rank Lang User Size Date 1 Golfscript JWinslow23 108 10/4/2014 9:37:27 AM 2 SysRPL 3298 148.05 10/4/2014 2:54:53 PM 3 Ruby Juju 164.4 9/23/2014 6:25:12 PM 4 Java 3298 183.3 10/4/2014 2:54:53 PM 5 C 3298 189 10/4/2014 2:54:53 PM 6 Python Ivoah 288.6 9/26/2014 6:32:23 PM 17 ##### Community Contests / [ENDED] Code Golf Contest #10 « on: September 15, 2014, 06:50:58 pm » Ten is three, three is four, four is MAGIC. NEXT: Here PREVIOUS: Here Challenge 10 Problem Create a program which displays the Olympic Rings, following these criteria: • The rings may be a picture or ASCII art • The rings must overlap (-40% if they interlock in the proper way!) • The rings should be in color if at all possible (-50% if so) • The program must not access an external source, Juju Deadline September 22, 2014, 1:00 AM EST If any further clarifica...you know what? Nobody ever reads this part! Whatever, I don't have a pun anyways. Not that anybody reads that, either. Ruby  Rank User Size Date Code 1 Juju 220-70%=66 9/16/2014 8:35:42 AM Spoiler For Spoiler: puts"\x1b[2J"def H(x,y);"\x1b["+x.to_s+";"+y.to_s+"H";enddef a(x,y,c);2.times{|i|puts"\x1b[3"+c.to_s+"m"+H(x+i+1,y)+"#"+H(x+i+1,y+5)+"#"+H(x+3*i,y+1)+""+"\x1b[0m"};enda(1,1,4);a(1,7,0);a(1,13,1);a(3,4,3);a(3,10,2) Golfscript  Rank User Size Date Code 1 JWinslow23 47-40%=28.2 9/15/2014 11:16:11 PM Spoiler For Spoiler: ' bb ll rrb '' by lg rr'.);[email protected]' yy gg' CJam  Rank User Size Date Code 1 JWinslow23 47-40%=28.2 9/15/2014 11:16:11 PM Spoiler For Spoiler: " bb ll rrb "" by lg rr"_);[email protected]" yy gg" 2 pimathbrainiac 54-40%=32.4 9/15/2014 7:11:40 PM Spoiler For Spoiler: " bb ll rr"N"b by lg r"N" by lg rr"N" yy gg" C  Rank User Size Date Code 1 pimathbrainiac 101-40%=60.6 9/15/2014 7:11:40 PM Spoiler For Spoiler: #include int main(){printf(" bb ll rr\nb by lg r\n by lg rr\n yy gg");return 0;} Nspire Lua  Rank User Size Date Code 1 Jens_K 94-70%=28.2 9/16/2014 7:18:56 AM Spoiler For Spoiler: function on.paint(g)for i=0,4 dog:setColorRGB(9E5*i)g:drawArc(9+i*5,9+i%2*5,9,9,205-i%2*90,i>0 and 330 or 360)endend 2 LDStudios 80-50%=40 9/18/2014 5:26:33 AM Spoiler For Spoiler: for i=1,5 do a=(i>3 and 5 or 0)gc:setColorRGB(i*42)gc:drawString(0,i*8-a*4,a)end 3 Adriweb 84-50%=42 9/15/2014 11:38:14 PM Spoiler For Spoiler: function on.paint(g)for i=4,16,3 do g:setColorRGB(i^5)g:drawString(0,i,i%2*4)end end Language Ranking  Rank Lang User Size Date 1 CJam JWinslow23 28.2 9/15/2014 11:16:11 PM 2 Golfscript JWinslow23 28.2 9/15/2014 11:16:11 PM 3 Nspire Lua Jens_K 28.2 9/16/2014 7:18:56 AM 4 C pimathbrainiac 60.6 9/15/2014 7:11:40 PM 5 Ruby Juju 66 9/16/2014 8:35:42 AM 18 ##### Community Contests / [ENDED] Code Golf Contest #9 « on: September 08, 2014, 07:38:31 pm » In a world without numbers... NEXT: Here PREVIOUS: Here Challenge 9 Problem Create a program that prints the number 1337...but here's the catch: • The program must not have any numerical characters (and the language must, Adriweb ) • The program must not rely on any external variables • The program must only use the printable ASCII characters (" " to "~") • The program must not exit on an error message, Jens_K Deadline September 15, 2014, 1:00 AM EST If any further clarification is needed, contact me. Let the games BigInt()! Python2  Rank User Size Date Code 1 Sorunome 32 9/8/2014 7:05:34 PM Spoiler For Spoiler: print ord('$')*ord('$')+ord(')') Golfscript  Rank User Size Date Code 1 JWinslow23 9 9/9/2014 6:46:01 PM Spoiler For Spoiler: !.))...+) TI-83+ BASIC  Rank User Size Date Code 1 calc84maniac 9 9/8/2014 8:49:45 PM Spoiler For Spoiler: int(pi^^2^pi+int(epi 2 JWinslow23 11 9/8/2014 7:22:47 PM Spoiler For Spoiler: int(10^(pi)-pi-10^(sqrt(e 3 123outerme 38 9/9/2014 5:22:07 PM Spoiler For Spoiler: A=A->BOutput(B,B,Ans+Ans^^2+BOutput(B,Ans,Ans^^2*Ans+Ans^^2+B Ruby  Rank User Size Date Code 1 Juju 18 9/8/2014 10:03:56 PM Spoiler For Spoiler: p"~~~~~~~~~~M".sum Perl  Rank User Size Date Code 1 Juju 22 9/10/2014 1:46:43 PM Spoiler For Spoiler: print unpack"cc","\r%" 2 willrandship 39 9/9/2014 5:15:38 PM Spoiler For Spoiler:$_=(hex'fed')-(hex'aaa')-(hex'a');print

C
 Rank User Size Date Code 1 alberthrocks 33 9/15/2014 12:00:00 AM Spoiler For Spoiler: main(){printf("%i",'!'*'+'-'R');} 2 willrandship 63 9/9/2014 5:15:38 PM Spoiler For Spoiler: #includeint main(){printf("%d",('H'-'A')*('~'+'A'));}

C++
 Rank User Size Date Code 1 willrandship 62 9/9/2014 5:15:38 PM Spoiler For Spoiler: #includeint main(){std::cout<<('H'-'A')*('~'+'A');}

PHP
 Rank User Size Date Code 1 Juju 22 9/10/2014 12:51:19 PM Spoiler For Spoiler:

CJam
 Rank User Size Date Code 1 JWinslow23 4 9/9/2014 6:46:01 PM Spoiler For Spoiler: DHK+ 2 Adriweb 4 9/11/2014 10:04:21 AM Spoiler For Spoiler: DHK+

Lua
 Rank User Size Date Code 1 Adriweb 35 9/9/2014 8:26:10 PM Spoiler For Spoiler: a=#"-_-"b=#'_'print(b..a..a..a+a+b)

Axe
 Rank User Size Date Code 1 Hayleia 9 9/11/2014 8:22:12 AM Spoiler For Spoiler: Disp 'F'+'F'+'F'+'F'+'F'+'F'+'F'+'F'+'F'+'F'+'F'+'F'+'F'+'F'+'F'+'F'+'A'+'A'+'W'>Dec

Nspire Lua
 Rank User Size Date Code 1 LDStudios 34 9/14/2014 8:04:05 PM Spoiler For Spoiler: print(("\r"):byte()..("%"):byte())

Befunge93
 Rank User Size Date Code 1 Juju 8 9/13/2014 10:13:41 PM Spoiler For Spoiler: "Y' "*[email protected] 2 Hooloovoo 9 9/13/2014 6:29:06 PM Spoiler For Spoiler: ")"*[email protected]

Befunge98
 Rank User Size Date Code 1 alberthrocks 9 9/15/2014 12:00:00 AM Spoiler For Spoiler: '$:*')[email protected] dc  Rank User Size Date Code 1 alberthrocks 7 9/15/2014 12:00:00 AM Spoiler For Spoiler: CEC F-p MATLAB  Rank User Size Date Code 1 alberthrocks 11 9/15/2014 12:00:00 AM Spoiler For Spoiler: '$'*'$'+')' Language Ranking  Rank Lang User Size Date 1 CJam JWinslow23 4 9/9/2014 6:46:01 PM 2 dc alberthrocks 7 9/15/2014 12:00:00 AM 3 Befunge93 Juju 8 9/13/2014 10:13:41 PM 4 TI-83+ BASIC calc84maniac 9 9/8/2014 8:49:45 PM 5 Golfscript JWinslow23 9 9/9/2014 6:46:01 PM 6 Axe Hayleia 9 9/11/2014 8:22:12 AM 7 Befunge98 alberthrocks 9 9/15/2014 12:00:00 AM 8 MATLAB alberthrocks 11 9/15/2014 12:00:00 AM 9 Ruby Juju 18 9/8/2014 10:03:56 PM 10 PHP Juju 22 9/10/2014 12:51:19 PM 11 Perl Juju 22 9/10/2014 1:46:43 PM 12 Python2 Sorunome 32 9/8/2014 7:05:34 PM 13 C alberthrocks 33 9/15/2014 12:00:00 AM 14 Nspire Lua LDStudios 34 9/14/2014 8:04:05 PM 15 Lua Adriweb 35 9/9/2014 8:26:10 PM 16 C++ willrandship 62 9/9/2014 5:15:38 PM 19 ##### Community Contests / [ENDED] Code Golf Contest #8 « on: September 01, 2014, 11:56:35 am » This challenge should confuse some people. NEXT: Here PREVIOUS: Here Challenge 8 Problem Check if a string is conveniently palindromic, and output 1 if it is and 0 if it isn't. This means that the char pairs () {} [] <> should be handled such that strings such as Code: [Select] (<)i(>)<}<{}>{>][()][}{[]}{would return 1, and strings like Code: [Select] ())(<(){}[][}{)(<(({))<<would return 0. Case insensitive when possible. Deadline September 8, 2014, 1:00 AM EST If any further clarification is needed, contact me. I'll try not to get everything backwards for you. (*crickets* Seriously, nothing? ) Golfscript  Rank User Size Date Code 1 JWinslow23 68 9/1/2014 2:39:28 PM Spoiler For Spoiler: {.96>32*-}/]''+.['()''{}''[]''<>']{.(;\);@1$/"\0"*2$/\*"\0"/\*}/-1%= Ruby2  Rank User Size Date Code 1 Juju 63 9/1/2014 2:59:26 PM Spoiler For Spoiler: p (a=gets.chop.upcase)==a.reverse.tr("[{(<>)}]","]})><({[")?1:0 TI-83+ BASIC  Rank User Size Date Code 1 JWinslow23 177 9/2/2014 5:43:43 PM Spoiler For Spoiler: " "+Ans+" ->Str1Ans->Str3"({[<)}]>->Str2For(X,1,length(Str1For(Y,1,4sub(Str1,X,15(Ans=sub(Str2,Y,1))+(Ans=sub(Str2,Y+4,1If Anssub(Str1,1,X-1)+sub(Str2,Y+Ans-1,1)+sub(Str1,X+1,length(Str1)-X->Str1EndEndStr1For(X,1,length(Ans)-1sub(Ans,2X,1)+AnsEndStr3=sub(Ans,1,X Nspire Lua  Rank User Size Date Code 1 Jens_K 145 9/4/2014 4:52:18 PM Spoiler For Spoiler: function cgc8(s)R=1r="<>()[]{}/\\"l=s:len()for i=1,l dop=r:find(s:sub(i,i),1,1)or 0p=p+p%2*2-1q=l-i+1R=p>0 and r:sub(p,p)~=s:sub(q,q)and 0 or Rendprint(R)end Language Ranking  Rank Lang User Size Date 1 Ruby2 Juju 63 9/1/2014 2:59:26 PM 2 Golfscript JWinslow23 68 9/1/2014 2:39:28 PM 3 Nspire Lua Jens_K 145 9/4/2014 4:52:18 PM 4 TI-83+ BASIC JWinslow23 177 9/2/2014 5:43:43 PM 20 ##### Miscellaneous / Some special effects to end the summer « on: September 01, 2014, 12:04:35 am » I have no idea how to embed videos, so here you go. A couple of amateur special effects that I made today. Nothing other than jump cuts and a tiny bit of speedup here and there. If I could just compress them a bit more, then I could have a bunch of ready-made vines! Whaddaya think? 21 ##### Community Contests / [ENDED] Code Golf Contest #7 « on: August 25, 2014, 04:52:22 pm » This must be your lucky day! NEXT: Here PREVIOUS: Here Challenge 7 Problem Make a program that, given an input as a string, outputs the (newline-separated) indexes of the string where the letters that make up the word "code" appear (one of each in order). For example, for input such as: School is about to start! Be sure to do your homework! the letters that make up the word "code" are marked by asterisks here: School is about to start! Be sure to do your homework! ^ ^ ^ ^ (in that exact order) (search should be case-insensitive if possible) And the output would be: 2 4 38 49 (the positions of the characters in the string). Simply output ONLY 0 if such is impossible. Deadline September 1, 2014, 1:00 AM EST If any further clarification is needed, contact me. I will try to search for order. (honestly, nobody comments about the puns anymore ) Java  Rank User Size Date Code 1 3298 189 8/29/2014 12:16:14 PM Spoiler For Spoiler: class G{public static void main(String[]s){String o="";int p=0;for(char c:"code".toCharArray()){p=s[0].toLowerCase().indexOf(c,p);if(p<0){o="0";break;}o=o+(p+1)+"\n";}System.out.print(o);}} 2 pimathbrainiac 268 8/25/2014 6:57:57 PM Spoiler For Spoiler: import java.util.Arrays;public class C7{public static void main(String[] args){String s=Arrays.toString(args);int a,b,c,d;a=s.indexOf('c')-1;b=s.indexOf('o')-1;if(b>a){c=s.indexOf('d')-1;if(c>b){d=s.indexOf('e')-1;if(d>c){System.out.print(a+"\n"+b+"\n"+c+"\n"+d);}}}}} Golfscript  Rank User Size Date Code 1 JWinslow23 55 8/25/2014 7:22:08 PM Spoiler For Spoiler: 0:a;{.96>32 0if-}/]"CODE"{1$?.a+:a\@>}/;]..$=*.{n*}0if Nspire Lua  Rank User Size Date Code 1 Jens_K 82 8/30/2014 6:52:41 AM Spoiler For Spoiler: function cgc7(s)i=0repeatp=s:find(("c.*o.*d.*e"):sub(i*3+1),p)or 0print(p)i=i+1until p*(4-i)<1end 2 Adriweb 104 8/26/2014 9:43:18 AM Spoiler For Spoiler: function y(s)t={}for a=1,4 do t[#t+1]=s:find(("code"):sub(a,a),t[#t])end print(#t<4 and 0 or table.concat(t,"\n"))end end TI-83+ BASIC  Rank User Size Date Code 1 JWinslow23 50 8/26/2014 10:54:23 AM Spoiler For Spoiler: Input Str11For(X,1,4inString(Str1,sub("CODE",X,1),AnsIf not(AnsClrHomeDisp AnsIf not(AnsReturnEnd Axe  Rank User Size Date Code 1 JWinslow23 152 8/28/2014 9:43:23 AM Spoiler For Spoiler: "CODE"->Str1input->M0->AFor(X,0,3)If inData({X+Str1},A+M)+AEnd!If ->A4->XClrHomeEndDisp A>Dec,iEnd XTend  Rank User Size Date Code 1 3298 163 8/29/2014 12:16:14 PM Spoiler For Spoiler: class G{def static void main(String[]s){var o=""var p=0;for(c:"code".toCharArray){p=s.head.toLowerCase.indexOf(c,p)if(p<0){print(0)return}o=o+(p+1)+"\n"}print(o)}} Haskell  Rank User Size Date Code 1 3298 174 8/29/2014 12:16:14 PM Spoiler For Spoiler: import Data.Charg i=putStr o where(_,o,_)=foldl h(i,"",0)"code"h(s,r,n)c=if t/=""then(tail t,r++(show m)++"\n",m)else(t,"0",m)where(d,t)=span((/=c).toLower)s;m=n+1+length d SysRPL  Rank User Size Date Code 1 3298 104 8/29/2014 3:04:40 PM Spoiler For Spoiler: :: NULL$SWAP ONESWAP "code"  BEGIN    2DUP CAR$2DUP 7PICK POSCHR UNROT CHR># BINT32 #- #>CHR 6ROLL POSCHR 2DUP 2#0=OR ITE #MAX #MIN DUP#0=csedrp :: RDROP 3DROP tok0 ; DUP4UNROLL #>$ NEWLINE&$5ROLL SWAP&$ 4UNROLL CDR$DUPNULL$? UNTIL 3DROP;

C
 Rank User Size Date Code 1 3298 169 8/30/2014 9:50:11 AM Spoiler For Spoiler: #includemain(int m,char**i){++i;int o[]={0,0,0,0},c=0,n=1;for(;**i&&c<4;++n)if("code"[c]==(*(*i)++|32))o[c++]=n;for(c=o[3]!=0?0:3;c<4;++c)printf("%i\n",o[c]);} 2 alberthrocks 188 8/29/2014 4:09:31 PM Spoiler For Spoiler: #define f for(i=0;i<4;i++){main(){char *s,*p,c[5]="code",r[4],i=0,x=0;scanf("%m[^\n]s",&s);f p=strchr(s+x,c);if(!p){printf("0\n");exit(0);}x=p-s;r=x+1;}i=0;f printf("%i\n",r);}}

Python3
 Rank User Size Date Code 1 willrandship 99 8/30/2014 3:07:52 AM Spoiler For Spoiler: b=0;e='';f=0for c in input(): b+=1; if'code}'[f]==c:e+='\n'+str(b);f+=1if len(e)<8:e=0print(e) 2 alberthrocks 116 8/29/2014 4:09:31 PM Spoiler For Spoiler: import sys;s=input().lower();i=0;a=""for l in "code":i=s.find(l,i);i<0 and sys.exit('0');a+=str(i+1)+"\n"print(a)

Bash
 Rank User Size Date Code 1 alberthrocks 181 8/29/2014 4:09:31 PM Spoiler For Spoiler: x(){ echo "0";exit 1; };s="code";r[0]=0;read i;for n in {0..3};do p=${r[-1]};r[$n]=expr index "${i:${r[-1]}}" "${s:$n:1}"||x;r[$n]=expr${r[-1]} + $p;done;printf '%s\n'${r}[/l][/l][/l][/l]

Ruby2
 Rank User Size Date Code 1 Juju 77 8/29/2014 8:20:46 PM Spoiler For Spoiler: p 0if !gets.match(/.*?(c).*?(o).*?(d).*?(e).*/i){|a|4.times{|b|p a.end(b+1)}}

Perl
 Rank User Size Date Code 1 willrandship 96 8/30/2014 3:07:52 AM Spoiler For Spoiler: for(split//,<>){$b++;$d=substr"code",$f,1;if($d eq$_){$e.=$b."\n";$f++}}$_=length$e<8?0:$e;print Language Ranking  Rank Lang User Size Date 1 TI-83+ BASIC JWinslow23 50 8/26/2014 10:54:23 AM 2 Golfscript JWinslow23 55 8/25/2014 7:22:08 PM 3 Ruby2 Juju 77 8/29/2014 8:20:46 PM 4 Nspire Lua Jens_K 82 8/30/2014 6:52:41 AM 5 Perl willrandship 96 8/30/2014 3:07:52 AM 6 Python3 willrandship 99 8/30/2014 3:07:52 AM 7 SysRPL 3298 104 8/29/2014 3:04:40 PM 8 Axe JWinslow23 152 8/28/2014 9:43:23 AM 9 XTend 3298 163 8/29/2014 12:16:14 PM 10 C 3298 169 8/30/2014 9:50:11 AM 11 Haskell 3298 174 8/29/2014 12:16:14 PM 12 Bash alberthrocks 181 8/29/2014 4:09:31 PM 13 Java 3298 189 8/29/2014 12:16:14 PM [/list] 22 ##### Community Contests / [ENDED] Code Golf Contest #6 « on: August 18, 2014, 12:26:04 pm » Let's start fresh. NEXT: Here PREVIOUS: Here Challenge 6 Problem Make a program that, given an input as a number, outputs the program size as a word (i.e. SEVENTY-FIVE or ONE HUNDRED TWELVE or ONE THOUSAND ONE HUNDRED THIRTY-SEVEN), then the square of the sum of the digits of the input (separated by newlines). Deadline August 25, 2014, 1:00 AM EST As each program WILL be different, no examples are given. I do expect that you understand it enough to give a decent solution. If any further clarification is needed, contact me. I will try to reduce your sighs (size). (Bad pun, I know ) Ruby2  Rank User Size Date Code 1 Juju 50 8/22/2014 9:41:36 PM Spoiler For Spoiler: a=0;gets.each_char{|b| a+=b.to_i};p "FIFTY";p a**2 Golfscript  Rank User Size Date Code 1 JWinslow23 26 8/18/2014 12:23:43 PM Spoiler For Spoiler: "TWENTY-SIX"\n\0\{48-+}/.* TI-83+ BASIC  Rank User Size Date Code 1 JWinslow23 30 8/19/2014 10:25:34 AM Spoiler For Spoiler: ClrHomeDisp "THIRTY.5xrootsum(int(10fPart(Ans/10^(cumSum(binomcdf(98,0 Batch  Rank User Size Date Code 1 JWinslow23 129 8/18/2014 1:23:40 PM Spoiler For Spoiler: @set/an=0@for /f "delims=" %%a in ('cmd/u/cecho %1^|find/v""')do @set/an+=%%a@set/an*=n@echo ONE HUNDRED TWENTY-NINE@echo %n% Python3  Rank User Size Date Code 1 JWinslow23 59 8/19/2014 10:07:00 PM Spoiler For Spoiler: z=0for y in input():z=z+eval(y)print("FIFTY-NINE\n",z**2) 2 willrandship 62 8/19/2014 9:02:51 PM Spoiler For Spoiler: b=0for a in input():b=b+eval(a)print("SIXTY-TWO\n"+str(b*b)) CJam  Rank User Size Date Code 1 JWinslow23 20 8/19/2014 10:25:34 AM Spoiler For Spoiler: "TWENTY"Ac+0q{~+}/_* Axe  Rank User Size Date Code 1 JWinslow23 110 8/19/2014 2:04:56 AM Spoiler For Spoiler: Ans->X0->NWhile X^10+N->NX/10->XEndDisp "ONE HUNDRED TEN",i,N^^2>Dec Perl  Rank User Size Date Code 1 willrandship 68 8/19/2014 8:58:36 PM Spoiler For Spoiler: for(split//,<>){$b+=ord($_)-48;}$b+=38;$b**=2;print"SIXTY-EIGHT\n$b"

Language Ranking
 Rank Lang User Size Date 1 CJam JWinslow23 20 8/19/2014 10:25:34 AM 2 Golfscript JWinslow23 26 8/18/2014 12:23:43 PM 3 TI-83+ BASIC JWinslow23 30 8/18/2014 12:23:43 PM 4 Ruby2 Juju 50 8/20/2014 9:41:36 PM 5 Python3 JWinslow23 59 8/19/2014 10:07:00 PM 6 Perl willrandship 68 8/19/2014 8:58:36 PM 7 Axe JWinslow23 110 8/19/2014 2:04:56 AM 8 Batch JWinslow23 129 8/18/2014 1:23:40 PM

23
##### Community Contests / [ENDED] Code Golf Contest #5
« on: August 11, 2014, 01:19:21 pm »
This challenge will never happen again.

NEXT: Here
PREVIOUS: Here

Challenge 5

Problem
You must make a game of Snake (or Nibbles, if you know it as that). It must follow all of these guidelines:
• It must be played on an square "grid" (each space being the width of one snake segment) as large as possible
• The graphics for the food and the snake segments must each be different
• The border must be clearly defined, and have different graphics from the food or the snake
• The food must spawn on a random EMPTY square, Adriweb
• The snake is moved with interactive input (such as a getKey-like command) if possible; if not supported, you may enter a direction each frame
• Your snake must wrap around the sides of the board
• At game's end, the program must display however many pieces of food were eaten in some way
• Your game, above all, must be playable
August 18, 2014, 1:00 AM EST

As there is random chance involved, and it is interactive input, no sample input shall be given.

If any further clarification is needed, contact me or Runer112. We will try to guide your heads in the right direction. (Get it? Like, you're guiding the snake's head in a certain dire...ah, just forget it.)

Nspire Lua
 Rank User Size Board Size Date Code 1 Adriweb 548 23*23 8/16/2014 4:57:21 PM Spoiler For Spoiler: a,b=5,2x,y=0,1g,h={5},{2}c=0f=0m=math.randomr=table.removetimer.start(.1)on={charIn=function(n)x=({x=-1,z=1})[n]or 0y=({r=-1,y=1})[n]or 0end,paint=function(n)z=n.drawStringz(n,f,14*a,9*b)for e=1,#g doz(n,8,14*g[e],9*h[e])endend,timer=function()g[#g+1]=(g[#g]+x)%23h[#h+1]=(h[#h]+y)%23for n=1,#g-1 doif g[n]==g[#g]and h[n]==h[#h]thenerror(c)endendif a==g[#g]and b==h[#h]thenrepeata=m(22)b=m(21)for n=1,#g doif a==g[n]and b==h[n]thend=0breakelsed=1endenduntil d>0c=c+1elser(g,1)r(h,1)endplatform.window:invalidate()end}

TI-83+ BASIC
 Rank User Size Board Size Date Code 1 JWinslow23 301 21*21 8/11/2014 9:55:09 AM Spoiler For Spoiler: 26->K1.01->B{4Ans->A"300fPart(Ans)-2->u"2-3int(Ans->vClrDrawAxesOffZStandard104->Xmax~72->YminZIntegerVertical 63For(A,1,440Repeat not(sum(⌊A=AnsrandInt(1,21)+.01randInt(1,21->CEndRepeat sum(Ans=CA->dim(⌊A⌊A(1Pt-On(u,v,2BPt-Off(u,v,2CPt-On(u,v,3Pt-Off(u,vgetKey->LIf Ans=34 or 2>abs(Ans-25Ans->K⌊A(A->B⌊A(1)+(K=34)-(K=25)+.01((K=26)-(K=24Ans+21(not(int(Ans))-(22=int(Ans))+.01(not(fPart(Ans))-(.22=fPart(AnsIf L=45 or sum(⌊A=AnsGoto 0augment({Ans},⌊A->AEndaugment(Ans,{Ans(A->AEndLbl 0ClrHomeA

TI-84+CSE BASIC
 Rank User Size Board Size Date Code 1 JWinslow23 336 165*165 8/12/2014 4:02:45 PM Spoiler For Spoiler: 26->K:1.001->B:{4Ans->AClrDraw:AxesOffBorderColor 3BackgroundOff:ZStandardVertical 2.5,12For(A,1,600Repeat not(sum(⌊A=AnsrandInt(1,165)+.001randInt(1,165->CEndRepeat sum(Ans=CA->dim(⌊A⌊A(1Pxl-On(fPart(Ans)E3-1,int(Ans-1),14Pxl-Off(fPart(B)E3-1,1-int(B-1Pxl-On(fPart(C)E3-1,1-int(C-1),11getKey->LIf Ans=34 or 2>abs(Ans-25Ans->K⌊A(A->B⌊A(1)+(K=34)-(K=25)+.001((K=26)-(K=24Ans+165(not(int(Ans))-(166=int(Ans)))+.165(not(fPart(Ans))-(.166=fPart(AnsIf L=45 or sum(⌊A=AnsGoto 0augment({Ans},⌊A->AEndaugment(Ans,{Ans(A->AEndLbl 0ClrHomeA

Java
 Rank User Size Board Size Date Code 1 ben_g 1610 (screen_height-20)*(screen_height-20) 8/12/2014 1:16:46 PM Spoiler For Spoiler: import java.awt.*;import java.awt.event.*;import java.util.*;import java.util.List;import javax.swing.*;class S{static List s;static int x=20,y=20,d=0,h,i=x,j=y,o=0;static Graphics g;public static void main(String[]a){s=new ArrayList();for(int i=0;i<60;i++)s.add(new N(19,20));final JFrame f = new JFrame();f.setUndecorated(true);h=Toolkit.getDefaultToolkit().getScreenSize().height-20;f.setBounds(0,20,h,h);f.addKeyListener(new KeyListener(){@Overridepublic void keyPressed(KeyEvent k){if(k.getKeyCode()==k.VK_ESCAPE)System.exit(0);if(k.getKeyCode()==k.VK_RIGHT)d=0;if(k.getKeyCode()==k.VK_DOWN)d=1;if(k.getKeyCode()==k.VK_LEFT)d=2;if(k.getKeyCode()==k.VK_UP)d=3;}@Overridepublic void keyReleased(KeyEvent k){}@Overridepublic void keyTyped(KeyEvent k){}});JPanel p=new JPanel();f.setContentPane(p);f.setVisible(true);g=f.getGraphics();while(!c(x,y)){x%=h;y%=h;if(x<0)x=h-1;if(y<0)y=h-1;g.setColor(Color.green);g.fillRect(x,y,1,1);g.setColor(Color.red);g.fillRect(i,j,1,1);g.setColor(Color.white);g.fillRect(s.get(0).x,s.get(0).y,1,1);s.add(new N(x,y));if(i==x&&j==y){o=0;for(int i=0;i<30;i++)s.add(new N(x,y));if(s.size()>=h*h)System.exit(0);}else{s.remove(0);}if(o==0){o=1;f();}long m=System.currentTimeMillis();while(System.currentTimeMillis()-m<20){}if(d==0)x++;if(d==1)y++;if(d==2)x--;if(d==3)y--;}System.out.print(s.size()/10-7);System.exit(0);}static void f(){while(c(i,j)){i=(int)(Math.random()*h);j=(int)(Math.random()*h);}}static boolean c(int x,int y){for(int i=0;i

SysRPL
 Rank User Size Board Size Date Code 1 3298 278 64*64 8/17/2014 6:59:16 PM Spoiler For Spoiler: ::  RECLAIMDISP BINT0 BINT64 BINT128  2DUP BINT0 2OVER LINEON LINEON  BINT2 BINT4  BINT32 DUP TWO{}N ONE{}N TRUE  BEGIN    VERYSLOW    IT ::      BEGIN        BINT64 UNCOERCE DUP        %RAN %* COERCE #2* SWAP        %RAN %* COERCE        2DUP PIXON? UNROT PIXON      NOT_UNTIL      ROT#1+UNROT    ;    SWAP GETTOUCH IT ::      { BINT10 BINT14 BINT15 BINT16 }      NTHOF DUP#0<> ?SWAPDROP    ;    DUPDUP 4UNROLL    BINT1 #AND #0=    3PICK FPTR2 ^LASTCOMP INCOMPDROP    3PICK ?SWAP 4ROLL    BINT2 #>ITE BINT1 BINT63 #+    BINT63 #AND    ROT ?SWAP 2DUP TWO{}N    4ROLLSWAP >TCOMP UNROTSWAP    #2* SWAP2DUP PIXON?    3PICK3PICK SWAP#1+SWAP PIXON?    2SWAP 2DUP SWAP#1+SWAP LINEON    5PICK 4PICK LENCOMP #< IT ::      ROTDUP CDRCOMP 4UNROLL      CARCOMP INCOMPDROP      SWAP #2* SWAP2DUP SWAP#1+SWAP      LINEOFF    ;  UNTIL 3DROP;

Ruby
 Rank User Size Board Size Date Code 1 Juju 611 (height-1)*(height-1) 8/18/2014 11:40:15 AM Spoiler For Spoiler: f=[7,7]s=[[4,4]]t=0z=trued=:rl,r=stty size.splitl=l.to_i-1while z doprint"\x1b[2J\x1b["+f[1].to_s+";"+f[0].to_s+"H*"s.each{|a|print"\x1b["+a[1].to_s+";"+a[0].to_s+"H#"}print"\x1b["+(l+1).to_s+";1H"+t.to_sstty raw -echoc=STDIN.read_nonblock(1)rescue nilstty -raw echocase cwhen'a'd=:lwhen's'd=:dwhen'w'd=:uwhen'd'd=:rendx,y=s[-1]case dwhen:lx-=1when:dy+=1when:uy-=1when:rx+=1endx=1 if x>lx=l if x<1y=1 if y>ly=l if y<1n=[x,y]if s.index(n)!=nilz=falseelses.push(n)if n==ft+=1while(f=[1+rand(l),1+rand(l)]).index(n)!=nil do endelses.shiftendendsleep 0.1end

Language Ranking
 Rank Lang User Size Board Size Date 1 SysRPL 3298 278 64*64 8/17/2014 6:59:16 PM 2 TI-83+ BASIC JWinslow23 301 21*21 8/11/2014 9:55:09 AM 3 TI-84+CSE BASIC JWinslow23 305 165*165 8/12/2014 4:02:45 PM 4 Nspire Lua Adriweb 548 23*23 8/16/2014 4:57:21 PM 5 Ruby Juju 611 (height-1)*(height-1) 8/18/2014 11:40:15 AM 6 Java ben_g 1610 (screen_height-20)*(screen_height-20) 8/12/2014 1:16:46 PM

24
##### Community Contests / [ENDED] Code Golf Contest #4
« on: August 04, 2014, 05:37:33 pm »
You know the drill.

NEXT: Here
PREVIOUS: Here

Challenge 4
To clear anything up, a tie will result in the earlier solution becoming the winner in the category.

Problem
For a given string input consisting of only uppercase letters and numbers, add the ASCII value of each alphabetical character (that's 65-90 for uppercase A-Z) and subtract every number. Display the result, but printed vertically with each digit on a new line.

You CAN end up with a negative number, in which case the first line should have a - sign.

August 11, 2014, 1:00 AM EST

Sample input 1
A45FTUX
Sample output 1
3
8
3
Sample input 2
99A874512995
Sample output 2
-
3
Sample input 3
CODEGOLF
Sample output 3
5
7
9

If any further clarification is necessary, contact me or willrandship. We will try to keep your heads from exploding.

TI-83+ BASIC
 Rank User Size Date Code 1 Runer112 139 8/7/2014 11:54:17 PM Spoiler For Spoiler: Ans->Str1DelVar BFor(A,1,length(Str1inString("876543210ABCDEFGHIJKLMNOPQRSTUVWXYZ",sub(Str1,A,1B+Ans-9+64(Ans>9->BEnd"     If B<0Disp Ans+Ans+Ans+"~For(A,int(~log(abs(B)+not(B)+.1)),~1Disp iPart(10fPart(abs(B10^(AEnd 2 JWinslow23 141 8/4/2014 4:34:15 PM Spoiler For Spoiler: DelVar CInput Str1For(X,1,length(Str164+inString("ABCDEFGHIJKLMNOPQRSTUVWXYZ",sub(Str1,X,1If Ans=64~expr(sub(Str1,X,1C+Ans->CEnd"     If C<0Pause Ans+Ans+Ans+"~For(X,~int(log(abs(C))),0Pause int(abs(C10^(Xabs(C)-Ans10^(~X->CEnd

Ruby2
 Rank User Size Date Code 1 Juju 98 8/4/2014 8:02:43 PM Spoiler For Spoiler: a=0;gets.chomp.each_char{|b|c=('0'..'9')===b&&1||-1;a-=c*b.ord-(24*c+24)};a.to_s.each_char{|b|p b}

 Rank User Size Date Code 1 bb010g 68 8/8/2014 12:54:03 PM Spoiler For Spoiler: mapM(putStrLn.(:[])).show.sum.map((\x->x+(48-2*x)*div 57x).fromEnum) 2 3298 70 8/7/2014 6:55:04 AM Spoiler For Spoiler: g s=mapM(putStrLn.(:[]))$show$sum$map(n.fromEnum)sn c|c<58=48-c|c>0=c SysRPL  Rank User Size Date Code 1 3298 63.5 8/7/2014 9:07:43 AM Spoiler For Spoiler: :: %0 OVERLEN$ #1+_ONE_DO    [email protected] SUB$1# BINT58 OVER#> IT :: UNCOERCE %- BINT48 ; UNCOERCE %+ LOOP xR>I DO>STR ONE MINUSONE FPTR2 ^StrCutNchr2_ DROPSWAPDROP; Java  Rank User Size Date Code 1 Runer112 137 (requires Java 8 ) 8/10/2014 12:43:30 PM Spoiler For Spoiler: class D{public static void main(String[]a){System.out.print(Long.toString(a[0].chars().map(c->c<65?48-c:c).sum()).replaceAll("","\n"));}} 2 3298 156 8/9/2014 5:14:28 AM Spoiler For Spoiler: class G{public static void main(String[]c){Long n=0L;for(int p:c[0].getBytes())n+=p<58?48-p:p;for(char p:n.toString().toCharArray())System.out.println(p);}} XTend  Rank User Size Date Code 1 3298 125 8/9/2014 5:14:28 AM Spoiler For Spoiler: class G{def static main(String[]c){for(p:c.head.getBytes.fold(0)[n,p|n+if(p<58)48-p else p].toString.toCharArray)println(p)}} Perl  Rank User Size Date Code 1 willrandship 68 8/5/2014 7:50:40 PM Spoiler For Spoiler: for(split//,<>){$b+=ord($_)>64?ord($_):-$_;}$b=~s/(.)/$1\n/g;print$b

NSpire Lua
 Rank User Size Date Code 1 LDStudios 105 8/10/2014 1:27:16 PM Spoiler For Spoiler: n=0 function on.charIn(c)n=tonumber(c)and n-c or n+c:byte()s=""..nfor i=0,#s do print(s:sub(i,i))end end 2 Adriweb 107 (function body) 8/10/2014 5:48:57 PM Spoiler For Spoiler: function codegolf4(s)    n=0;for i=1,#s do t=s:sub(i,i):byte()n=n-(t<58 and t-48 or-t)end;z=""..n;for i=1,#z do print(z:sub(i,i))endend 3 Jens_K 115 8/9/2014 5:46:04 PM Spoiler For Spoiler: n=0for c in clipboard.getText():gmatch"."don=n+(tonumber(c)and -c or c:byte())..""endprint((n:gsub(".","%1\n")))

Golfscript
 Rank User Size Date Code 1 Runer112 22 8/7/2014 11:54:17 PM Spoiler For Spoiler: 0\{.65<\[.48\-]=+}/n*

CJam
 Rank User Size Date Code 1 Runer112 22 8/7/2014 11:54:17 PM Spoiler For Spoiler: 0q{i_'A<{48\}0?-+}/N*

TI-83+ z80
 Rank User Size Date Code 1 Runer112 59 8/7/2014 11:54:17 PM Spoiler For Spoiler: ;#SECTION "MAIN", CODE   org   userMem - 2   db   0BBh, 6DhStart:   B_CALL   _RclAns   rst   rFINDSYM   B_CALL   _OP1Set0   ex   de, hl   ld   c, (hl)   inc   hl   ld   b, (hl)   add   hl, bcSumLoop:   push   hl   cp   10   jq   nc, Letter   B_CALL   _SetXXOP2   B_CALL   _FPSub   jq   ContinueLetter:   add   a, '0'   B_CALL   _SetXXOP2   rst   rFPADDContinue:   pop   hl   ld   a, (hl)   dec   hl   sub   '0'   jq   nc, SumLoop   B_CALL   _FormEReal   ld   l, OP3 & 0FFhDispLoop:   ld   a, (hl)   or   a   ret   z   inc   hl   push   hl   B_CALL   _PutC   B_CALL   _NewLine   pop   hl   jq   DispLoop

C
 Rank User Size Date Code 1 3298 154 8/9/2014 5:14:18 AM Spoiler For Spoiler: #include main(int x,char**c){char s[12],*p=c[1];int n=0;for(;*p>0;++p){n+=*p<58?48-*p:*p;}sprintf(s,"%i",n);for(p=s;*p>0;++p)printf("%c\n",*p);}

Language Ranking

 Rank Lang User Size Date 1 CJam Runer112 22 8/7/2014 11:54:17 PM 2 Golfscript Runer112 22 8/7/2014 11:54:17 PM 3 TI-83+ z80 Runer112 59 8/7/2014 11:54:17 PM 4 SysRPL 3298 63.5 8/7/2014 9:07:43 AM 5 Perl willrandship 68 8/5/2014 7:50:40 PM 6 Haskell bb010g 68 8/8/2014 12:54:03 PM 7 Ruby2 Juju 98 8/4/2014 8:02:43 PM 8 NSpire Lua LDStudios 105 8/10/2014 1:27:16 PM 9 XTend 3298 125 8/9/2014 5:14:28 AM 10 Java Runer112 137 (requires Java 8 ) 8/10/2014 12:43:30 PM 11 TI-83+ BASIC Runer112 139 8/7/2014 11:54:17 PM 12 C 3298 154 8/9/2014 5:14:18 AM

25
##### Community Contests / [ENDED] Code Golf Contest #3
« on: July 28, 2014, 03:29:31 pm »
This is the same deal as the other two contests.

NEXT: Here
PREVIOUS: Here

Challenge 3

Problem
Make a program that, given an integer of reasonable size, outputs the greatest prime factor of that integer, in binary, but with all 0s replaced with underscores (_) and all 1s replaced with minus signs (-).

August 4, 2014, 1:00 AM EST

Sample input 1
15
Sample output 1
-_-
Sample input 2
7
Sample output 2
---
Sample input 3
115
Sample output 3
-_---

If any further clarification is necessary, contact me or willrandship, and we will explain the best we can.

Ranking

TI-83+ BASIC
 Rank User Size Date Code 1 Runer112 75 8/3/2014 2:17:19 PM Spoiler For Spoiler: For(A,Ans,2,~1If not(fPart(Ans/AA->PEnd"BFor(A,0,log(P)/log(2sub("_-",iPart(2fPart(P/2/2^A))+1,1)+AnsEndsub(Ans,1,A 2 JWinslow23 90 7/29/2014 11:43:19 AM Spoiler For Spoiler: Ans->XX=1->AWhile X>12->AWhile fPart(X/AIS>(A,XEndX/A->XEnd"_If A" Ans->Str1While A"_If fPart(.5A"-Ans+Str1->Str1int(.5A->AEndStr1

Python2
 Rank User Size Date Code 1 willrandship 147 7/29/2014 12:51:41 AM Spoiler For Spoiler: def f(z): for y in range(2,z+1):  if z%y:continue  return z if y==z else f(z/y)a=""for c in bin(f(input()))[2:]:a+='-'if c=='1'else'_'print a

Ruby
 Rank User Size Date Code 1 Juju 115 7/29/2014 2:47:50 AM Spoiler For Spoiler: a=gets.to_f;b=2;while a>1;(c=a/b)==c.to_i&&(a=c)||b+=1 end;p b.to_s(2).gsub('0','_').gsub('1','-')

Nspire Lua
 Rank User Size Date Code 1 Jens_K 132 8/1/2014 6:59:33 AM Spoiler For Spoiler: n=0+clipboard.getText()f=nrepeat f=(f>2 and f-1 or n)until n%f<1b=""repeat b=(f%2>0 and"-"or"_")..b;f=(f-f%2)/2 until f<1print(b)

SysRPL
 Rank User Size Date Code 1 3298 59.5 7/31/2014 5:18:48 PM Spoiler For Spoiler: ::  FPTR2 ^NFactorSpc  DUPLENCOMP  NTHCOMPDROP  FPTR2 ^Z>#  NULL$SWAP BEGIN DUP #2/ UNROT BINT1 #AND #1= ITE CHR_- CHR_UndScore >T$  SWAP #0=UNTIL DROP;

Perl
 Rank User Size Date Code 1 willrandship 98 7/31/2014 2:15:31 PM Spoiler For Spoiler: $z=<>;sub f{for(2..$z){$z/=$z%$_?next:$_;return$z>1?&f:$_;}}$_=sprintf"%b",f;s/1/-/g;s/0/_/g;print Haskell  Rank User Size Date Code 1 3298 122 8/3/2014 6:16:11 PM Spoiler For Spoiler: import Numericg i=showIntAtBase 2c(f(i,2))""f(1,j)=jf(i,j)=if mod i j==0then f(quot i j,j)else f(i,j+1)c 0='_'c 1='-' 2 bb010g 216 8/2/2014 7:11:01 PM Spoiler For Spoiler: import Numeric;import Data.Char;main=fmap(\n->concatMap(\case{'0'->"_";_->"-"})$showIntAtBase 2intToDigit(last[x|x<-[1..n-1],nmodx==0,elem x[n|n<-[2..x],not$elem n[j*k|j<-[2..n-1],k<-[2..n-1]]]])"")readLn>>=putStr CJam  Rank User Size Date Code 1 Runer112 16 8/3/2014 2:17:19 PM Spoiler For Spoiler: q~mfZ=2b{"_-"=}% Golfscript  Rank User Size Date Code 1 Runer112 33 8/3/2014 2:17:19 PM Spoiler For Spoiler: ~.,2>-1%{].~%!=}/2base{"_-"=}%""+ Java  Rank User Size Date Code 1 Runer112 172 8/3/2014 2:17:19 PM Spoiler For Spoiler: class C{public static void main(String[]a){long x=Long.decode(a[0]),i=x;while(i-->2)x=(x%i)==0?i:x;System.out.print(Long.toString(x,2).replace('0','_').replace('1','-'));}} 2 3298 185 8/3/2014 6:16:11 PM Spoiler For Spoiler: class G{public static void main(String[]c){int n=Integer.parseInt(c[0]),i=2;while(i TI-83+ z80  Rank User Size Date Code 1 Runer112 58 8/3/2014 2:17:19 PM Spoiler For Spoiler: ;#SECTION "MAIN", CODE org userMem - 2 db 0BBh, 6DhStart: B_CALL _RclAns B_CALL _ConvOP1 ld h, d ld l, eTrialDivideLoop: push de push hl B_CALL _DivHLByDE ld a, h or l pop hl pop de jq nz, NotFactor ld h, d ld l, eNotFactor: dec de ld a, e dec a or d jq nz, TrialDivideLoop ld b, h ld c, l ld hl, OP1 + 15 ld (hl), dBitLoop: dec hl srl b rr c ld (hl), '_' jq nc, BitUnset ld (hl), '-' ld d, h ld e, lBitUnset: jq nz, BitLoop ex de, hl B_CALL _PutS B_CALL _NewLine ret XTend  Rank User Size Date Code 1 3298 179 8/3/2014 6:16:11 PM Spoiler For Spoiler: class G{def static void main(String[]c){var n=Integer.parseInt(c.get(0))var i=2while(i Language Ranking  Rank Lang User Size Date 1 CJam Runer112 16 8/3/2014 2:17:19 PM 2 Golfscript Runer112 33 8/3/2014 2:17:19 PM 3 TI-83+ z80 Runer112 58 8/3/2014 2:17:19 PM 4 SysRPL 3298 59.5 (don't ask me why; I'm going off of what he said) 7/31/2014 5:18:48 PM 5 TI-83+ BASIC Runer112 75 8/3/2014 2:17:19 PM 6 Ruby Juju 98 7/30/2014 12:01:58 AM 7 Perl willrandship 98 7/31/2014 2:15:31 PM 8 Haskell 3298 122 8/3/2014 6:16:11 PM 9 Nspire Lua Jens_K 132 8/1/2014 6:59:33 AM 10 Python2 willrandship 147 7/29/2014 12:51:41 AM 11 Java Runer112 172 8/3/2014 2:17:19 PM 12 XTend 3298 179 8/3/2014 6:16:11 PM 26 ##### Community Contests / [ENDED] Code Golf Contest #2 « on: July 22, 2014, 11:32:51 am » Here is the second code golf contest. Rules here. NEXT: Here PREVIOUS: Here Challenge 2 Problem Make a program with the following input and output: Input: A string of any length, made up of clusters of characters and numbers separated by spaces. Output: All non-number "words", concatenated together in reverse order, with the sum of all numeric "words" following, all separated by spaces. Deadline July 28, 2014, 1:00 AM EST Sample input 1 "1 asdf 15 1fg Iamamazing 14" Sample output 1 "Iamamazing 1fg asdf 30" Sample input 2 "Hello W0rld 63 How 4r3 you 6" Sample output 2 "you 4r3 How W0rld Hello 69" If any further clarification is necessary, please contact me or willrandship. We will try to explain. Ranking Ruby 2  Rank User Size Date Code 1 Juju 80 7/23/2014 12:39:40 PM Spoiler For Spoiler: a=0;print gets.split.reverse.reject{|b|a!=a+=Integer(b)rescue 0}.join(" ")," ",a Golfscript  Rank User Size Date Code 1 Runer112 32 7/27/2014 12:27:24 PM Spoiler For Spoiler: " "%-1%0\{.{|}*64<{~+}{" "@}if}/ 2 JWinslow23 60 7/22/2014 1:02:09 PM Spoiler For Spoiler: " "%-1%0:a;{..{.47>\59 Nspire Lua  Rank User Size Date Code 1 Jens_K 113 (copy input to clipboard) 7/23/2014 9:15:32 AM Spoiler For Spoiler: s,n="",0for w in clipboard.getText():gmatch"%S+"doif tonumber(w)then n=n+w else s=w.." "..s endendprint(s..n) 2 LDStudios 162 7/23/2014 3:30:25 PM Spoiler For Spoiler: i="" p={} function on.charIn(h) s="" i=i..h p=i:split(s) n=0 for i,v in ipairs(p) do if v:find("%a") then s=v.." "..s elseif v:find("%d") then n=n+v end end print(i) print(s..n) end Python3  Rank User Size Date Code 1 willrandship 83 7/22/2014 3:08:29 PM Spoiler For Spoiler: s=0;o=''for w in input().split(): try:s+=int(w) except:o=o+w+" "print(o+str(s)) Java  Rank User Size Date Code 1 Runer112 174 7/27/2014 12:27:24 PM Spoiler For Spoiler: class B{public static void main(String[]a){int x=0,i=a.length;while(i>0)try{x+=Integer.parseInt(a[--i]);}catch(Exception e){System.out.print(a+' ');}System.out.print(x);}} 2 3298 178 7/27/2014 1:58:00 PM Spoiler For Spoiler: class G{public static void main(String[]c){int n=0;String s="";for(String i:c[0].split(" ")){try{n+=Integer.parseInt(i);}catch(Exception e){s=i+" "+s;}}System.out.println(s+n);}} 3 ben_g 198 7/22/2014 4:01:06 PM Spoiler For Spoiler: public class Main{public static void main(String[] args){String s="";int i=0;for(String t:args[0].split(" ")){try{i+=Integer.parseInt(t);}catch(Exception e){s=t+" "+s;}}s+=i;System.out.println(s);}} CJam  Rank User Size Date Code 1 Runer112 27 7/27/2014 12:27:24 PM Spoiler For Spoiler: qS%W%0\{_:i:|'A<{~+}{[email protected]}?}/ XTend  Rank User Size Date Code 1 3298 159 7/27/2014 1:58:00 PM Spoiler For Spoiler: class G{static var n=0;def static void main(String[]c){println(c.get(0).split(" ").fold("")[s,i|try{n=n+Integer.parseInt(i);s}catch(Exception _){i+" "+s}]+n)}} Haskell  Rank User Size Date Code 1 3298 138 7/27/2014 1:58:00 PM Spoiler For Spoiler: import Text.Readg c=(fst f)++show(snd f)where f=foldr(\i(s,n)->case readMaybe i of Nothing->(s++i++" ",n);Just m->(s,n+m))("",0)(words c) SysRPL  Rank User Size Date Code 1 3298 79 7/27/2014 1:58:00 PM Spoiler For Spoiler: :: BINT0 FPTR2 ^StrCutNchr_ Z0_ NULL$ ROT BEGIN    SEP$NL FPTR2 ^S>Z? ITE :: 4ROLL FPTR2 ^QAdd UNROT ; :: APPEND_SPACE ROT &$SWAP ;  DUPNULL$? UNTIL DROPSWAP FPTR2 ^Z>S &$;

Language Ranking

 Rank Lang User Size Date 1 CJam Runer112 27 7/27/2014 12:27:24 PM 2 Golfscript Runer112 32 7/27/2014 12:27:24 PM 3 SysRPL 3298 79 7/27/2014 1:58:00 PM 4 Ruby 2 Juju 80 7/23/2014 12:39:40 PM 5 Python3 willrandship 83 7/22/2014 3:08:29 PM 6 Nspire Lua Jens_K 113 (copy input to clipboard) 7/23/2014 9:15:32 AM 7 Haskell 3298 138 7/27/2014 1:58:00 PM 8 XTend 3298 159 7/27/2014 1:58:00 PM 9 Java Runer112 174 7/27/2014 1:58:00 PM

27
##### Community Contests / [ENDED] Code Golf Contest #1 (thanks for the many submissions!)
« on: July 14, 2014, 01:52:12 pm »
This is the first of what I hope to be many contests I will hold here on Omnimaga: Code Golf.

Code golf is a competition where you have to solve a coding challenge in the fewest bytes possible. For example, a TI-BASIC entry for a prime tester could be:
Code: [Select]
Input N:0:If N and not(fPart(N:2=sum(seq(not(fPart(abs(N)/I)),I,1,abs(N:Ans(note that this is not the speediest it could be, but speed is not factored in your score, only size)
The score would be 34 bytes (for TI-BASIC programs, score=size - 9 - length of name). The lowest score out of the entries will be the winner.

How this tournament will work:
First off, you need to code an actual program that will solve the given problem (or at least give the right result for all the test cases ). All languages are allowed, including calc languages and computer languages. When you have an entry, PM it to me, and I will test it if possible (but just in case I don't have an Nspire or I can't download the latest version of Perl or some such problem, try if you can to give back the results of any and all given test cases). I will then save your entry and update the scores accordingly.
After one week, a winner shall be determined in each language category, as well as the smallest overall. In each language category, the winners shall all suggest possible problems for the next competition. I shall pick the next challenge out of these, and present test cases for any possible input or output. Also, you will get to see everyone else's solutions for the previous challenge.

NEXT: Here
PREVIOUS: Here

Challenge 1

Problem
Determine if an inputted number is happy. Happy numbers are defined like this: Take any positive integer, replace it with the sum of the squares of its digits, and repeat the process until it equals 1 or it loops indefinitely in a loop that does not include 1. If it ends up with 1, the number is happy, otherwise it's sad.
July 21, 2014, 1:00 AM EST
Sample input 1:
1
Sample output 1:
Code: [Select]
HAPPYSample input 2:
1337
Sample output 2:
Code: [Select]
HAPPYSample input 3:
385
Sample output 3:
Either one of
Code: [Select]
SADor
Code: [Select]
UNHAPPY
Ranking

Python
 Rank User Size Date Code 1 willrandship 94 7/19/2014 11:16:56 PM Spoiler For Spoiler: x=input();b="UNHAPPY"for a in b: z=0 for y in str(x):z+=eval(y)**2;x=zprint(b[(z==1)*2:7]) 2 Juju 148 7/15/2014 4:22:50 PM Spoiler For Spoiler: def h(n): while n>1 and n!=4:  n=sum(dict([(c,int(c)**2)for c in"0123456789"])[d] for d in str(n)) return n==1print(("SAD","HAPPY")[h(input())])

Golfscript
 Rank User Size Date Code 1 Runer112 32 7/15/2014 5:17:50 PM Spoiler For Spoiler: ~{0\{48-.*+}/}9*("SAD""HAPPY"if

CJam
 Rank User Size Date Code 1 Runer112 30 7/15/2014 5:17:50 PM Spoiler For Spoiler: q~{Ab0\{_*+}/}9*("SAD""HAPPY"?

TI-83+ BASIC
 Rank User Size Date Code 1 calc84maniac 46 7/16/2014 5:03:49 PM Spoiler For Spoiler: Repeat Ans<5sum(.5×√int(10fPart(Ans/10^(cumSum(binomcdf(98,0→AEnd"HAPPYIf log(A"SADAns 2 Runer112 46 7/16/2014 5:09:28 PM Spoiler For Spoiler: Repeat A≤4iPart(10fPart(Ans10^(~cumSum(binomcdf(14,0sum(Ans²→AEnd"HAPPYIf log(A"SADAns 3 Hayleia 71 7/16/2014 2:18:36 AM Spoiler For Spoiler: Prompt NRepeat N=1 or N=4sum(seq((10fPart(iPart(N10^(~I))/10))²,I,0,14→NEnd"HAPPYIf N=4"SADDisp Ans

TI-83+ z80
 Rank User Size Date Code 1 Runer112 58 7/20/2014 9:32:08 PM Spoiler For Spoiler: ;#SECTION "MAIN", CODE   org   userMem - 2   db   0BBh, 6DhStart:   B_CALL   _RclAnsStepLoop:   push   bc   sbc   hl, hl   ld   b, hDigitPairLoop:   dec   eDigitLoop:   ex   de, hl   xor   a   rrd   ex   de, hl   ld   c, aSquareLoop:   add   hl, bc   dec   a   jq   nz, SquareLoop   ld   a, (de)   or   a   jq   nz, DigitLoop   ld   a, e   cp   (OP1 + 2) & 0FFh   jq   nz, DigitPairLoop   push   hl   B_CALL   _SetXXXXOP2   rst   30h   pop   hl   pop   bc   djnz   StepLoop   dec   l   ld   hl, UnhappyStr   jq   nz, Unhappy   inc   hl   inc   hlUnhappy:   B_CALL   _PutS   ret;#SECTION "StrData", DATAUnhappyStr:   db   "UNHAPPY", 0 2 calc84maniac 60 7/16/2014 12:12:44 PM Spoiler For Spoiler: #define bcall(xxxx) rst 28h \\ .dw xxxx#define _RclAns $4AD7#define _PutS$450A#define OP1 $8478 .org$9D93    .db $BB,$6D    bcall(_RclAns)    ex de,hlHappyCalcLoop:    xor a    ld c,a    ld d,a    ld e,aHappyByteLoop:    ;Carry is reset, upper nibble of A is 0    dec lHappyNibbleLoop:    rrd    ld b,aHappyMulLoop:    push af     add a,e     daa     ld e,a     ld a,c     adc a,d     daa     ld d,a    pop af    djnz HappyMulLoop    ccf    jr c,HappyNibbleLoop    ld a,l    sub (OP1+2)&$FF jr nz,HappyByteLoop ld (hl),d inc l ld (hl),e inc l inc (hl) jr nz,HappyCalcLoop ld hl,HappyString dec e jr z,$+4    dec hl    dec hl    bcall(_PutS)    ret    UnhappyString:    .db "UN"HappyString:    .db "HAPPY",0

Batch
 Rank User Size Date Code 1 JWinslow23 182 7/19/2014 7:26:37 PM Spoiler For Spoiler: @set/p#=:@@set $=0&@for /f "delims=" %%a in ('cmd /U /C echo %#%^|find /V ""')do @set/a$+=%%a*%%a@set #=%$%&@if %$% neq 1 if %$% neq 4 goto @@if %$%==1 (echo happy) else echo sad

Language Ranking
 Rank Lang User Size Date 1 CJam Runer112 30 7/15/2014 5:17:50 PM 2 Golfscript Runer112 32 7/15/2014 5:17:50 PM 3 TI-83+ BASIC calc84maniac 46 7/16/2014 5:03:49 PM 4 TI-83+ z80 Runer112 58 7/20/2014 9:32:08 PM 5 Python willrandship 94 7/19/2014 11:16:56 PM 6 Batch JWinslow23 182 7/19/2014 7:26:37 PM

28
##### Miscellaneous / How would I organize a monthly Code Golf contest here?
« on: July 12, 2014, 03:12:10 pm »
I would like to propose a monthly contest on Omnimaga: Code Golf.

Code golf is basically solving a certain coding problem in the fewest amount of bytes possible. For example, a golfed primality tester in TI-BASIC would be:
Code: [Select]
Input N:0:If N and not(fPart(N:2=sum(seq(not(fPart(abs(N)/I)),I,1,abs(N:AnsThe score then would be 43 bytes (technically, 43+length of name, but for calc-language purposes, the name is not included in the score). Lowest score wins.
(note this isn't as speedy as it could be, but speed would not count against you)
If possible, have it work for as many possible test cases as you can while still making it short.

Anybody could submit challenges (so long as you give test cases as well). Hopefully we can allow all calc languages, as well as computer languages (so long as you can test them, and you can show us the results of the test cases).

Who would I talk to in order to get something like this started here?

29
##### Humour and Jokes / Autological Phrases (not sure if this is in the right thread)
« on: June 27, 2014, 02:25:29 am »
After many long days of work, I am finally done.

This is a collection of phrases that describe the number of letters that the phrase has. For example, "a two written next to a one" describes 21, and has 21 letters.
Here are some examples from 1 to 100:
Code: [Select]
ABiTriFourFifthSextetSeventhTwoCubedCompositeTriangularLucasNumberZodiacNumberUnluckyNumberEInHexadecimalPentatopeNumberFourthPowerOfTwoTenPlusSixPlusOneFiftyEightModFortyPrimeAfterSeventeenPositionOfTheLetterTATwoWrittenNextToAOneSecondMultipleOfElevenSmallestPrimeOverTwentySeventeenPlusTwoPlusFiveAreaOfSquareWithWidthFiveHalfOfAStandardDeckOfCardsSquareRootOfSevenTwentyNineTheOnlyTwoDigitPerfectNumberDaysInFebruaryIfItIsALeapYearSmallerCoprimeNumbersArePrimesBaskinRobbinsHasThisManyFlavorsPowerOfTwoInWhichDigitsArePrimesElvisPresleyIsCastInThisManyFilmsNinthIntegerInTheFibonacciSequenceTheSumOfTheCubesOfTheFirstTwoPrimesNumberOfPianoKeysThatAreASharpOrFlatTheNumberOfFederalReserveBanksInTheUSItsFormInBinaryIsOneZeroZeroOneOneZeroWriteTheFirstOddPrimeNextToItsOwnSquareAtomicNumberOfTheElementKnownAsZirconiumForMexicansThisNumberIsConsideredAGaySlurItsTheAnswerToLifeTheUniverseAndEverythingSmallestPrimeThatIsntTheSumOfTwoPalindromesRetiredMLBNumberForHankAaronAndReggieJacksonTheTelephoneDialingCodeForTheCountryOfDenmarkItIsTheValueInDecimalForTheASCIICodeForAPeriodThisNumberAppearsInAlmostAllTheStarTrekEpisodesInternationalDirectDialCodeForPhoneCallsToPolandNumberOfStringsOnTheHarpAndNumberOfKeysOnACelestaTheNumberOfStatesThatAreInTheUnitedStatesOfAmericaTheTopSecretAircraftTestingFacilityInSouthernNevadaTheNumberOfWeeksThatAreInAYearInTheGregorianCalendarItsTheThirdNumberNWhichDividesTheSumOfTheFirstNPrimesNumberOfColoredStickersOnEachOfTheSquaresOnARubiksCubeLargestNumberInTheFibonacciSeriesThatsATriangularNumberAsHardToBelieveAsItSoundsItsATownNameInTheStateOfMontanaTheModelNameOfACarMadeByTheGermanAutomobileCompanyMaybachItIsTheSmallestSmithNumberForWhichTheSumOfItsDigitsIsPrimeTheNASCARDriverMarcosAmbroseRacesWithThisNumberOnHisRacecarTheNumberOfSecondsInAMinuteAndAlsoTheNumberOfMinutesInAnHourTheSmallestPrimeForWhichItsReversalIsAlsoAPerfectSquareNumberTheOnlyNumberWhoseCubeIsMadeOfThreeDigitsThatEachOccurTwoTimesTheAlphanumericalValueOfThisNumbersRomanNumeralIsThisSameNumberThisIsTheNumberOfSquaresThatAreOnTheChessBoardOrTheCheckersBoardTheSmallestNumberThatBecomesSquareIfItsReverseIsAddedOrSubtractedWellItGoesThroughStLouisJoplinMissouriAndOklahomaCityLooksSoPrettyTheSmallestPrimeWhichBecomesPandigitalWhenItIsRaisedToTheTenthPowerAsADecimalNumberThisNumberIsTheLastTwoDigitNumberToAppearInPisDigitsYouHaveADirtyMindIfYouThinkOfThisNumberHowIThinkYouAreThinkingOfItNowItsTheLargestNumberNSuchThatTheSumOfTheDigitsOfTwoToThePowerOfNEqualsNTheNumberOfDifferentCharactersThatCanBeUsedWithAStandardEnglishKeyboardTheSmallestNumberThatRaisedToTheFifthPowerIsTheSumOfFiveOtherFifthPowersItsTheTwentyFirstPrimeItsReverseIsTheTwelfthAndItsAlsoAPalindromeInBinaryOnePlusTwoPlusThreePlusSixPlusNinePlusTenPlusTwentyPlusFortyMinusSeventeenTheSmallestNumberThatIsPandigitalInQuaternaryAsInItIsOneThousandTwentyThreeOnePlusOnePlusTwoPlusTwoPlusThreePlusThreePlusThreePlusTenPlusSixtyMinusNineThisisTheSmallestPositiveIntegerThatRequiresFiveSyllablesInTheEnglishLanguageIfYouAddUpTheGiftsInTheSongTheTwelveDaysOfChristmasTheyWouldAddUpToThisIntegerTheSmallestNumberThatCannotBeRepresentedAsTheSumOfFewerThanNineteenPowersOfFourTheAtomicNumberOfTheElementKnownAsMercuryAnElementWhichWasOnceUsedInThermometersThisNumberIsTheOnlyPositiveRealNumberBesidesOneThatIsTheSquareOfTheSumOfItsDigitsTheInternationalStandardBookNumberGroupIdentifierForBooksThatWerePublishedInNorwayTheSmallestPrimeNumberWhichIsTheSumOfAPrimeNumberOfPrimeNumbersInAPrimeNumberOfWaysTheSmallestNumberThatIsAlsoTheSumOfThreeDistinctPrimesRaisedToDistinctPrimeExponentsTheSmallestNumberWhichCanAlsoBeExpressedAsTheSumOfTwoDistinctSquaresInTwoDistinctWaysTheLargestNumberNSuchThatTwoToThePowerOfNDoesNotContainAZeroDigitInItsDecimalExpansionTheNumberOfYearsBetweenTheSigningOfTheDeclarationOfIndependenceAndTheBattleOfGettysburgTheNumberOfConstellationsUpInTheSkyAsCurrentlyDefinedByTheInternationalAstronomicalUnionTheSmallestPrimeWhichIsAConcatenationOfPToThePowerOfQAndQToThePowerOfPWherePAndQArePrimesIfAnAngleInEuclideanGeometryHasAMeasurementOfThisManyDegreesThatMeansTheAngleIsARightAngleInUSCentsThisIsTheSumOfTheValuesOfOneEachOfAllTheCoinsOfDenominationsThatAreLessThanADollarTheNumberOfWaysThatEightQueensCanBePlacedOnAnEightByEightChessboardSoNoTwoCanAttackEachOtherOnePlusOnePlusTwoPlusTwoPlusThreePlusThreePlusThreePlusFourPlusFourPlusTenPlusTwentyPlusFortyThisIsTheSmallestEvenNumberWithMoreThanOneDigitWhichHasNoRepresentationAsTheSumOfTwoTwinPrimesTheRacingNumberThatWasOnRacecarLightningMcQueenTheMainCharacterInTheDisneyPixarAnimatedFilmCarsAlthoughThisMightBeHardToBelieveThisNumberIsActuallyTheNameOfASmallCityInTheStateOfSouthCarolinaTheLargestPrimeNumberUnderOneHundredAndAlsoTheLargestTwoDigitNumberWhereTheSumOfItsDigitsIsSquareTheHighestJerseyNumberOneMayWearInTheNationalHockeyLeagueAsNinetyNineWasRetiredToHonorWayneGretzkyInTheUKAndIrelandThisIsTheNameOfAnIceCreamConeWithACadburyChocolateFlakePressedHalfwayInTheIceCreamOnTheCelsiusScaleThisNumberOfDegreesWhichIsTwoHundredTwelveDegreesFahrenheitIsTheBoilingPointOfWater`I spent a LONG time on these.

Are there any improvements you can think of? Do you not get a reference that a certain phrase makes? Please, give me feedback.

30
##### TI Z80 / TI-2048 by Josiah W.
« on: May 22, 2014, 08:15:13 pm »
I have worked for months on this game, and it is FINALLY ready for a release!

TI-2048
Join the numbers and get to the 2048 tile!

HOW TO PLAY: Use your arrow keys to move the tiles. When
two tiles with the same number touch, they merge into one!

NOTE: This is not the official version of 2048; it is simply a port.
You can play the original at http://git.io/2048. All other apps or
sites are derivatives or fakes, and should be used with caution.

Port created by Josiah Winslow, with help from the Omnimaga
community. Original game created by Gabriele Cirulli. Original
based on 1024 by Veewo Studio and conceptually similar to
Threes by Asher Vollmer.

Please help me with optimizations and play testing, everyone! Give me any suggestions you can! Seriously, my code is kinda hackish right now.

NOTE: This requires A2048 and LIB3BYTE on your calc to compile properly. I'll compress it soon, I promise.
This also saves your highscore in an appvar called "TI2048". It is automatically archived upon exit.

Spoiler For Credits:
Hayleia for providing tile graphics, and moral support.
Runer112 for general support, a library giving me access to 3-byte numbers, and giving me the sliding algorithm that eluded me for SO long! I know I told you this before with another project, but this would only have been an idea without you!
willrandship for...something I forget. Optimization? I swear, this project is really taking a toll on my memory.
The whole Omnimaga community for giving me support along the way!

Spoiler For Version History:
v1.0: 5,761 bytes. Initial release.
v1.1: 5,845 bytes. Fixed score display bug upon win.

Pages: 1 [2] 3 4