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 :P

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.

Deadline
October 5, 2014, 1:00 AM EST

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

Ruby
RankUserSizeDateCode
1Juju548-70%=164.49/23/2014 6:25:12 PM
Spoiler For Spoiler:
def w(n)
case n
when 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..999
w(n/100)+" hundred"+(n%100==0?"":" "+w(n%100))
when 1000..999999
w(n/1000)+" thousand"+(n%1000==0?"":" "+w(n%1000))
end
end
a=gets.to_i
while a!=4
p w(a)+" is "+w(a=w(a).delete(" ").length)+"."
end
p"four is magic."

Golfscript
RankUserSizeDateCode
1JWinslow23360-70%=10810/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
RankUserSizeDateCode
1Ivoah962-70%=288.69/26/2014 6:32:23 PM
Spoiler For Spoiler:
import sys
a = {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 c
n=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
RankUserSizeDateCode
13298611-70%=183.310/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;}}}
2ben_g676-70%=202.89/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
RankUserSizeDateCode
13298630-70%=18910/4/2014 2:54:53 PM
Spoiler For Spoiler:
#include<stdio.h>
char*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");}
2ben_g861-70%=258.310/3/2014 3:52:36 AM
Spoiler For Spoiler:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
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
RankUserSizeDateCode
13298493.5-70%=148.0510/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
      OVERINDEX@ SUB$1#
      BINT64 #> IT #1+
    LOOP
    UNROT "is " &$SWAP
    BINT4 #=case
    ::
      RDROP SWAPDROP ABND
      "magic" &$
    ;
    OVER #>$ &$SWAP
  AGAIN
;

Language Ranking
RankLangUserSizeDate
1GolfscriptJWinslow2310810/4/2014 9:37:27 AM
2SysRPL3298148.0510/4/2014 2:54:53 PM
3RubyJuju164.49/23/2014 6:25:12 PM
4Java3298183.310/4/2014 2:54:53 PM
5C329818910/4/2014 2:54:53 PM
6PythonIvoah288.69/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. O.O

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 :P
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
RankUserSizeDateCode
1Juju220-70%=669/16/2014 8:35:42 AM
Spoiler For Spoiler:
puts"\x1b[2J"
def H(x,y);"\x1b["+x.to_s+";"+y.to_s+"H";end
def 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"};end
a(1,1,4);a(1,7,0);a(1,13,1);a(3,4,3);a(3,10,2)

Golfscript
RankUserSizeDateCode
1JWinslow2347-40%=28.29/15/2014 11:16:11 PM
Spoiler For Spoiler:
' bb  ll  rr
b '' by  lg  rr'
.);n@'
   yy  gg'

CJam
RankUserSizeDateCode
1JWinslow2347-40%=28.29/15/2014 11:16:11 PM
Spoiler For Spoiler:
" bb  ll  rr
b "" by  lg  rr"
_);N@"
   yy  gg"
2pimathbrainiac54-40%=32.49/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
RankUserSizeDateCode
1pimathbrainiac101-40%=60.69/15/2014 7:11:40 PM
Spoiler For Spoiler:
#include <stdio.h>
int main(){printf(" bb  ll  rr\nb  by  lg  r\n by  lg  rr\n   yy  gg");return 0;}

Nspire Lua
RankUserSizeDateCode
1Jens_K94-70%=28.29/16/2014 7:18:56 AM
Spoiler For Spoiler:
function on.paint(g)
for i=0,4 do
g:setColorRGB(9E5*i)g:drawArc(9+i*5,9+i%2*5,9,9,205-i%2*90,i>0 and 330 or 360)end
end
2LDStudios80-50%=409/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
3Adriweb84-50%=429/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
RankLangUserSizeDate
1CJamJWinslow2328.29/15/2014 11:16:11 PM
2GolfscriptJWinslow2328.29/15/2014 11:16:11 PM
3Nspire LuaJens_K28.29/16/2014 7:18:56 AM
4Cpimathbrainiac60.69/15/2014 7:11:40 PM
5RubyJuju669/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 :P )
  • 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 :P
Deadline
September 15, 2014, 1:00 AM EST

If any further clarification is needed, contact me. Let the games BigInt()! XD

Python2
RankUserSizeDateCode
1Sorunome329/8/2014 7:05:34 PM
Spoiler For Spoiler:
print ord('$')*ord('$')+ord(')')

Golfscript
RankUserSizeDateCode
1JWinslow2399/9/2014 6:46:01 PM
Spoiler For Spoiler:
!.))...+)

TI-83+ BASIC
RankUserSizeDateCode
1calc84maniac99/8/2014 8:49:45 PM
Spoiler For Spoiler:
int(pi^^2^pi+int(epi
2JWinslow23119/8/2014 7:22:47 PM
Spoiler For Spoiler:
int(10^(pi)-pi-10^(sqrt(e
3123outerme389/9/2014 5:22:07 PM
Spoiler For Spoiler:
A=A->B
Output(B,B,Ans+Ans^^2+B
Output(B,Ans,Ans^^2*Ans+Ans^^2+B

Ruby
RankUserSizeDateCode
1Juju189/8/2014 10:03:56 PM
Spoiler For Spoiler:
p"~~~~~~~~~~M".sum

Perl
RankUserSizeDateCode
1Juju229/10/2014 1:46:43 PM
Spoiler For Spoiler:
print unpack"cc","\r%"
2willrandship399/9/2014 5:15:38 PM
Spoiler For Spoiler:
$_=(hex'fed')-(hex'aaa')-(hex'a');print

C
RankUserSizeDateCode
1alberthrocks339/15/2014 12:00:00 AM
Spoiler For Spoiler:
main(){printf("%i",'!'*'+'-'R');}
2willrandship639/9/2014 5:15:38 PM
Spoiler For Spoiler:
#include<stdio.h>
int main(){printf("%d",('H'-'A')*('~'+'A'));}

C++
RankUserSizeDateCode
1willrandship629/9/2014 5:15:38 PM
Spoiler For Spoiler:
#include<iostream>
int main(){std::cout<<('H'-'A')*('~'+'A');}

PHP
RankUserSizeDateCode
1Juju229/10/2014 12:51:19 PM
Spoiler For Spoiler:
<?=ord("\r").ord("%");
2Sorunome359/10/2014 4:00:54 AM
Spoiler For Spoiler:
<? echo ord('$')*ord('$')+ord(')');

CJam
RankUserSizeDateCode
1JWinslow2349/9/2014 6:46:01 PM
Spoiler For Spoiler:
DHK+
2Adriweb49/11/2014 10:04:21 AM
Spoiler For Spoiler:
DHK+

Lua
RankUserSizeDateCode
1Adriweb359/9/2014 8:26:10 PM
Spoiler For Spoiler:
a=#"-_-"b=#'_'print(b..a..a..a+a+b)

Axe
RankUserSizeDateCode
1Hayleia99/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
RankUserSizeDateCode
1LDStudios349/14/2014 8:04:05 PM
Spoiler For Spoiler:
print(("\r"):byte()..("%"):byte())

Befunge93
RankUserSizeDateCode
1Juju89/13/2014 10:13:41 PM
Spoiler For Spoiler:
"Y' "*+@
2Hooloovoo99/13/2014 6:29:06 PM
Spoiler For Spoiler:
")$$"*+.@

Befunge98
RankUserSizeDateCode
1alberthrocks99/15/2014 12:00:00 AM
Spoiler For Spoiler:
'$:*')+.@

dc
RankUserSizeDateCode
1alberthrocks79/15/2014 12:00:00 AM
Spoiler For Spoiler:
CEC F-p

MATLAB
RankUserSizeDateCode
1alberthrocks119/15/2014 12:00:00 AM
Spoiler For Spoiler:
'$'*'$'+')'

Language Ranking
RankLangUserSizeDate
1CJamJWinslow2349/9/2014 6:46:01 PM
2dcalberthrocks79/15/2014 12:00:00 AM
3Befunge93Juju89/13/2014 10:13:41 PM
4TI-83+ BASICcalc84maniac99/8/2014 8:49:45 PM
5GolfscriptJWinslow2399/9/2014 6:46:01 PM
6AxeHayleia99/11/2014 8:22:12 AM
7Befunge98alberthrocks99/15/2014 12:00:00 AM
8MATLABalberthrocks119/15/2014 12:00:00 AM
9RubyJuju189/8/2014 10:03:56 PM
10PHPJuju229/10/2014 12:51:19 PM
11PerlJuju229/10/2014 1:46:43 PM
12Python2Sorunome329/8/2014 7:05:34 PM
13Calberthrocks339/15/2014 12:00:00 AM
14Nspire LuaLDStudios349/14/2014 8:04:05 PM
15LuaAdriweb359/9/2014 8:26:10 PM
16C++willrandship629/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
RankUserSizeDateCode
1JWinslow23689/1/2014 2:39:28 PM
Spoiler For Spoiler:
{.96>32*-}/]''+.['()''{}''[]''<>']{.(;\);@1$/"\0"*2$/\*"\0"/\*}/-1%=

Ruby2
RankUserSizeDateCode
1Juju639/1/2014 2:59:26 PM
Spoiler For Spoiler:
p (a=gets.chop.upcase)==a.reverse.tr("[{(<>)}]","]})><({[")?1:0

TI-83+ BASIC
RankUserSizeDateCode
1JWinslow231779/2/2014 5:43:43 PM
Spoiler For Spoiler:
" "+Ans+" ->Str1
Ans->Str3
"({[<)}]>->Str2
For(X,1,length(Str1
For(Y,1,4
sub(Str1,X,1
5(Ans=sub(Str2,Y,1))+(Ans=sub(Str2,Y+4,1
If Ans
sub(Str1,1,X-1)+sub(Str2,Y+Ans-1,1)+sub(Str1,X+1,length(Str1)-X->Str1
End
End
Str1
For(X,1,length(Ans)-1
sub(Ans,2X,1)+Ans
End
Str3=sub(Ans,1,X

Nspire Lua
RankUserSizeDateCode
1Jens_K1459/4/2014 4:52:18 PM
Spoiler For Spoiler:
function cgc8(s)
R=1
r="<>()[]{}/\\"l=s:len()for i=1,l do
p=r:find(s:sub(i,i),1,1)or 0
p=p+p%2*2-1
q=l-i+1
R=p>0 and r:sub(p,p)~=s:sub(q,q)and 0 or R
end
print(R)
end

Language Ranking
RankLangUserSizeDate
1Ruby2Juju639/1/2014 2:59:26 PM
2GolfscriptJWinslow23689/1/2014 2:39:28 PM
3Nspire LuaJens_K1459/4/2014 4:52:18 PM
4TI-83+ BASICJWinslow231779/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 :P )

Java
RankUserSizeDateCode
132981898/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);}}
2pimathbrainiac2688/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
RankUserSizeDateCode
1JWinslow23558/25/2014 7:22:08 PM
Spoiler For Spoiler:
0:a;{.96>32 0if-}/]"CODE"{1$?.a+:a\@>}/;]..$=*.{n*}0if

Nspire Lua
RankUserSizeDateCode
1Jens_K828/30/2014 6:52:41 AM
Spoiler For Spoiler:
function cgc7(s)
i=0
repeat
p=s:find(("c.*o.*d.*e"):sub(i*3+1),p)or 0
print(p)i=i+1
until p*(4-i)<1
end
2Adriweb1048/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
RankUserSizeDateCode
1JWinslow23508/26/2014 10:54:23 AM
Spoiler For Spoiler:
Input Str1
1
For(X,1,4
inString(Str1,sub("CODE",X,1),Ans
If not(Ans
ClrHome
Disp Ans
If not(Ans
Return
End

Axe
RankUserSizeDateCode
1JWinslow231528/28/2014 9:43:23 AM
Spoiler For Spoiler:
"CODE"->Str1
input->M
0->A
For(X,0,3)
If inData({X+Str1},A+M)
+A
End
!If ->A
4->X
ClrHome
End
Disp A>Dec,i
End

XTend
RankUserSizeDateCode
132981638/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
RankUserSizeDateCode
132981748/29/2014 12:16:14 PM
Spoiler For Spoiler:
import Data.Char
g 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
RankUserSizeDateCode
132981048/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
RankUserSizeDateCode
132981698/30/2014 9:50:11 AM
Spoiler For Spoiler:
#include<stdio.h>
main(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]);}
2alberthrocks1888/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
RankUserSizeDateCode
1willrandship998/30/2014 3:07:52 AM
Spoiler For Spoiler:
b=0;e='';f=0
for c in input():
 b+=1;
 if'code}'[f]==c:e+='\n'+str(b);f+=1
if len(e)<8:e=0
print(e)
2alberthrocks1168/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
RankUserSizeDateCode
1alberthrocks1818/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
RankUserSizeDateCode
1Juju778/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
RankUserSizeDateCode
1willrandship968/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
RankLangUserSizeDate
1TI-83+ BASICJWinslow23508/26/2014 10:54:23 AM
2GolfscriptJWinslow23558/25/2014 7:22:08 PM
3Ruby2Juju778/29/2014 8:20:46 PM
4Nspire LuaJens_K828/30/2014 6:52:41 AM
5Perlwillrandship968/30/2014 3:07:52 AM
6Python3willrandship998/30/2014 3:07:52 AM
7SysRPL32981048/29/2014 3:04:40 PM
8AxeJWinslow231528/28/2014 9:43:23 AM
9XTend32981638/29/2014 12:16:14 PM
10C32981698/30/2014 9:50:11 AM
11Haskell32981748/29/2014 12:16:14 PM
12Bashalberthrocks1818/29/2014 4:09:31 PM
13Java32981898/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 :P )

Ruby2
RankUserSizeDateCode
1Juju508/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
RankUserSizeDateCode
1JWinslow23268/18/2014 12:23:43 PM
Spoiler For Spoiler:
"TWENTY-SIX"\n\0\{48-+}/.*

TI-83+ BASIC
RankUserSizeDateCode
1JWinslow23308/19/2014 10:25:34 AM
Spoiler For Spoiler:
ClrHome
Disp "THIRTY
.5xrootsum(int(10fPart(Ans/10^(cumSum(binomcdf(98,0

Batch
RankUserSizeDateCode
1JWinslow231298/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
RankUserSizeDateCode
1JWinslow23598/19/2014 10:07:00 PM
Spoiler For Spoiler:
z=0
for y in input():z=z+eval(y)
print("FIFTY-NINE\n",z**2)
2willrandship628/19/2014 9:02:51 PM
Spoiler For Spoiler:
b=0
for a in input():b=b+eval(a)
print("SIXTY-TWO\n"+str(b*b))

CJam
RankUserSizeDateCode
1JWinslow23208/19/2014 10:25:34 AM
Spoiler For Spoiler:
"TWENTY"Ac+0q{~+}/_*

Axe
RankUserSizeDateCode
1JWinslow231108/19/2014 2:04:56 AM
Spoiler For Spoiler:
Ans->X
0->N
While X
^10+N->N
X/10->X
End
Disp "ONE HUNDRED TEN",i,N^^2>Dec

Perl
RankUserSizeDateCode
1willrandship688/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
RankLangUserSizeDate
1CJamJWinslow23208/19/2014 10:25:34 AM
2GolfscriptJWinslow23268/18/2014 12:23:43 PM
3TI-83+ BASICJWinslow23308/18/2014 12:23:43 PM
4Ruby2Juju508/20/2014 9:41:36 PM
5Python3JWinslow23598/19/2014 10:07:00 PM
6Perlwillrandship688/19/2014 8:58:36 PM
7AxeJWinslow231108/19/2014 2:04:56 AM
8BatchJWinslow231298/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. :P

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 :P
  • 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 :P
Deadline
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
RankUserSizeBoard SizeDateCode
1Adriweb54823*238/16/2014 4:57:21 PM
Spoiler For Spoiler:
a,b=5,2
x,y=0,1
g,h={5},{2}c=0
f=0
m=math.random
r=table.remove
timer.start(.1)on={charIn=function(n)x=({x=-1,z=1})[n]or 0
y=({r=-1,y=1})[n]or 0
end,paint=function(n)z=n.drawString
z(n,f,14*a,9*b)for e=1,#g do
z(n,8,14*g[e],9*h[e])end
end,timer=function()g[#g+1]=(g[#g]+x)%23
h[#h+1]=(h[#h]+y)%23
for n=1,#g-1 do
if g[n]==g[#g]and h[n]==h[#h]then
error(c)end
end
if a==g[#g]and b==h[#h]then
repeat
a=m(22)b=m(21)for n=1,#g do
if a==g[n]and b==h[n]then
d=0
break
else
d=1
end
end
until d>0
c=c+1
else
r(g,1)r(h,1)end
platform.window:invalidate()end}

TI-83+ BASIC
RankUserSizeBoard SizeDateCode
1JWinslow2330121*218/11/2014 9:55:09 AM
Spoiler For Spoiler:
26->K
1.01->B
{4Ans->A
"300fPart(Ans)-2->u
"2-3int(Ans->v
ClrDraw
AxesOff
ZStandard
104->Xmax
~72->Ymin
ZInteger
Vertical 63
For(A,1,440
Repeat not(sum(⌊A=Ans
randInt(1,21)+.01randInt(1,21->C
End
Repeat sum(Ans=C
A->dim(⌊A
⌊A(1
Pt-On(u,v,2
B
Pt-Off(u,v,2
C
Pt-On(u,v,3
Pt-Off(u,v
getKey->L
If Ans=34 or 2>abs(Ans-25
Ans->K
⌊A(A->B
⌊A(1)+(K=34)-(K=25)+.01((K=26)-(K=24
Ans+21(not(int(Ans))-(22=int(Ans))+.01(not(fPart(Ans))-(.22=fPart(Ans
If L=45 or sum(⌊A=Ans
Goto 0
augment({Ans},⌊A->A
End
augment(Ans,{Ans(A->A
End
Lbl 0
ClrHome
A

TI-84+CSE BASIC
RankUserSizeBoard SizeDateCode
1JWinslow23336165*1658/12/2014 4:02:45 PM
Spoiler For Spoiler:
26->K:1.001->B:{4Ans->A
ClrDraw:AxesOff
BorderColor 3
BackgroundOff:ZStandard
Vertical 2.5,12
For(A,1,600
Repeat not(sum(⌊A=Ans
randInt(1,165)+.001randInt(1,165->C
End
Repeat sum(Ans=C
A->dim(⌊A
⌊A(1
Pxl-On(fPart(Ans)E3-1,int(Ans-1),14
Pxl-Off(fPart(B)E3-1,1-int(B-1
Pxl-On(fPart(C)E3-1,1-int(C-1),11
getKey->L
If Ans=34 or 2>abs(Ans-25
Ans->K
⌊A(A->B
⌊A(1)+(K=34)-(K=25)+.001((K=26)-(K=24
Ans+165(not(int(Ans))-(166=int(Ans)))+.165(not(fPart(Ans))-(.166=fPart(Ans
If L=45 or sum(⌊A=Ans
Goto 0
augment({Ans},⌊A->A
End
augment(Ans,{Ans(A->A
End
Lbl 0
ClrHome
A

Java
RankUserSizeBoard SizeDateCode
1ben_g1610(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<N> 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<N>();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(){@Override
public 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;}@Override
public void keyReleased(KeyEvent k){}@Override
public 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<s.size();i++){if(s.get(i).x==x&&s.get(i).y==y){return true;}}return false;}}class N{int x,y;public N(int v,int w){x=v;y=w;}}

SysRPL
RankUserSizeBoard SizeDateCode
1329827864*648/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
RankUserSizeBoard SizeDateCode
1Juju611(height-1)*(height-1)8/18/2014 11:40:15 AM
Spoiler For Spoiler:
f=[7,7]
s=[[4,4]]
t=0
z=true
d=:r
l,r=`stty size`.split
l=l.to_i-1
while z do
print"\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_s
`stty raw -echo`
c=STDIN.read_nonblock(1)rescue nil
`stty -raw echo`
case c
when'a'
d=:l
when's'
d=:d
when'w'
d=:u
when'd'
d=:r
end
x,y=s[-1]
case d
when:l
x-=1
when:d
y+=1
when:u
y-=1
when:r
x+=1
end
x=1 if x>l
x=l if x<1
y=1 if y>l
y=l if y<1
n=[x,y]
if s.index(n)!=nil
z=false
else
s.push(n)
if n==f
t+=1
while(f=[1+rand(l),1+rand(l)]).index(n)!=nil do end
else
s.shift
end
end
sleep 0.1
end

Language Ranking
RankLangUserSizeBoard SizeDate
1SysRPL329827864*648/17/2014 6:59:16 PM
2TI-83+ BASICJWinslow2330121*218/11/2014 9:55:09 AM
3TI-84+CSE BASICJWinslow23305165*1658/12/2014 4:02:45 PM
4Nspire LuaAdriweb54823*238/16/2014 4:57:21 PM
5RubyJuju611(height-1)*(height-1)8/18/2014 11:40:15 AM
6Javaben_g1610(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.

Deadline
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
RankUserSizeDateCode
1Runer1121398/7/2014 11:54:17 PM
Spoiler For Spoiler:
Ans->Str1
DelVar BFor(A,1,length(Str1
inString("876543210ABCDEFGHIJKLMNOPQRSTUVWXYZ",sub(Str1,A,1
B+Ans-9+64(Ans>9->B
End
"     
If B<0
Disp Ans+Ans+Ans+"~
For(A,int(~log(abs(B)+not(B)+.1)),~1
Disp iPart(10fPart(abs(B10^(A
End
2JWinslow231418/4/2014 4:34:15 PM
Spoiler For Spoiler:
DelVar CInput Str1
For(X,1,length(Str1
64+inString("ABCDEFGHIJKLMNOPQRSTUVWXYZ",sub(Str1,X,1
If Ans=64
~expr(sub(Str1,X,1
C+Ans->C
End
"     
If C<0
Pause Ans+Ans+Ans+"~
For(X,~int(log(abs(C))),0
Pause int(abs(C10^(X
abs(C)-Ans10^(~X->C
End

Ruby2
RankUserSizeDateCode
1Juju988/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}

Haskell
RankUserSizeDateCode
1bb010g688/8/2014 12:54:03 PM
Spoiler For Spoiler:
mapM(putStrLn.(:[])).show.sum.map((\x->x+(48-2*x)*div 57x).fromEnum)
23298708/7/2014 6:55:04 AM
Spoiler For Spoiler:
g s=mapM(putStrLn.(:[]))$show$sum$map(n.fromEnum)s
n c|c<58=48-c|c>0=c

SysRPL
RankUserSizeDateCode
1329863.58/7/2014 9:07:43 AM
Spoiler For Spoiler:
::
  %0 OVERLEN$ #1+_ONE_DO
    OVERINDEX@ SUB$1#
    BINT58 OVER#> IT
    :: UNCOERCE %- BINT48 ;
    UNCOERCE %+
  LOOP
  xR>I DO>STR ONE MINUSONE
  FPTR2 ^StrCutNchr2_ DROPSWAPDROP
;

Java
RankUserSizeDateCode
1Runer112137 (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"));}}
232981568/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
RankUserSizeDateCode
132981258/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
RankUserSizeDateCode
1willrandship688/5/2014 7:50:40 PM
Spoiler For Spoiler:
for(split//,<>){$b+=ord($_)>64?ord($_):-$_;}$b=~s/(.)/$1\n/g;print$b

NSpire Lua
RankUserSizeDateCode
1LDStudios1058/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=""..n
for i=0,#s do print(s:sub(i,i))end end
2Adriweb107 (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
3Jens_K1158/9/2014 5:46:04 PM
Spoiler For Spoiler:
n=0
for c in clipboard.getText():gmatch"."do
n=n+(tonumber(c)and -c or c:byte())..""end
print((n:gsub(".","%1\n")))

Golfscript
RankUserSizeDateCode
1Runer112228/7/2014 11:54:17 PM
Spoiler For Spoiler:
0\{.65<\[.48\-]=+}/`n*

CJam
RankUserSizeDateCode
1Runer112228/7/2014 11:54:17 PM
Spoiler For Spoiler:
0q{i_'A<{48\}0?-+}/`N*

TI-83+ z80
RankUserSizeDateCode
1Runer112598/7/2014 11:54:17 PM
Spoiler For Spoiler:
;#SECTION "MAIN", CODE

   org   userMem - 2
   db   0BBh, 6Dh
Start:
   B_CALL   _RclAns
   rst   rFINDSYM
   B_CALL   _OP1Set0
   ex   de, hl
   ld   c, (hl)
   inc   hl
   ld   b, (hl)
   add   hl, bc
SumLoop:
   push   hl
   cp   10
   jq   nc, Letter
   B_CALL   _SetXXOP2
   B_CALL   _FPSub
   jq   Continue

Letter:
   add   a, '0'
   B_CALL   _SetXXOP2
   rst   rFPADD
Continue:
   pop   hl
   ld   a, (hl)
   dec   hl
   sub   '0'
   jq   nc, SumLoop
   B_CALL   _FormEReal
   ld   l, OP3 & 0FFh
DispLoop:
   ld   a, (hl)
   or   a
   ret   z
   inc   hl
   push   hl
   B_CALL   _PutC
   B_CALL   _NewLine
   pop   hl
   jq   DispLoop

C
RankUserSizeDateCode
132981548/9/2014 5:14:18 AM
Spoiler For Spoiler:
#include <stdio.h>
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

RankLangUserSizeDate
1CJamRuner112228/7/2014 11:54:17 PM
2GolfscriptRuner112228/7/2014 11:54:17 PM
3TI-83+ z80Runer112598/7/2014 11:54:17 PM
4SysRPL329863.58/7/2014 9:07:43 AM
5Perlwillrandship688/5/2014 7:50:40 PM
6Haskellbb010g688/8/2014 12:54:03 PM
7Ruby2Juju988/4/2014 8:02:43 PM
8NSpire LuaLDStudios1058/10/2014 1:27:16 PM
9XTend32981258/9/2014 5:14:28 AM
10JavaRuner112137 (requires Java 8 ) 8/10/2014 12:43:30 PM
11TI-83+ BASICRuner1121398/7/2014 11:54:17 PM
12C32981548/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 (-).

Deadline
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
RankUserSizeDateCode
1Runer112758/3/2014 2:17:19 PM
Spoiler For Spoiler:
For(A,Ans,2,~1
If not(fPart(Ans/A
A->P
End
"B
For(A,0,log(P)/log(2
sub("_-",iPart(2fPart(P/2/2^A))+1,1)+Ans
End
sub(Ans,1,A
2JWinslow23907/29/2014 11:43:19 AM
Spoiler For Spoiler:
Ans->X
X=1->A
While X>1
2->A
While fPart(X/A
IS>(A,X
End
X/A->X
End
"_
If A
"
Ans->Str1
While A
"_
If fPart(.5A
"-
Ans+Str1->Str1
int(.5A->A
End
Str1

Python2
RankUserSizeDateCode
1willrandship1477/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
RankUserSizeDateCode
1Juju1157/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
RankUserSizeDateCode
1Jens_K1328/1/2014 6:59:33 AM
Spoiler For Spoiler:
n=0+clipboard.getText()f=n
repeat f=(f>2 and f-1 or n)until n%f<1
b=""repeat b=(f%2>0 and"-"or"_")..b;f=(f-f%2)/2 until f<1
print(b)

SysRPL
RankUserSizeDateCode
1329859.57/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
RankUserSizeDateCode
1willrandship987/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
RankUserSizeDateCode
132981228/3/2014 6:16:11 PM
Spoiler For Spoiler:
import Numeric
g i=showIntAtBase 2c(f(i,2))""
f(1,j)=j
f(i,j)=if mod i j==0then f(quot i j,j)else f(i,j+1)
c 0='_'
c 1='-'
2bb010g2168/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],n`mod`x==0,elem x[n|n<-[2..x],not$elem n[j*k|j<-[2..n-1],k<-[2..n-1]]]])"")readLn>>=putStr

CJam
RankUserSizeDateCode
1Runer112168/3/2014 2:17:19 PM
Spoiler For Spoiler:
q~mfZ=2b{"_-"=}%

Golfscript
RankUserSizeDateCode
1Runer112338/3/2014 2:17:19 PM
Spoiler For Spoiler:
~.,2>-1%{].~%!=}/2base{"_-"=}%""+

Java
RankUserSizeDateCode
1Runer1121728/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','-'));}}
232981858/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<n)if(n%i==0)n/=i;else++i;System.out.print(Integer.toString(n,2).replace('0','_').replace('1','-'));}}

TI-83+ z80
RankUserSizeDateCode
1Runer112588/3/2014 2:17:19 PM
Spoiler For Spoiler:
;#SECTION "MAIN", CODE

   org   userMem - 2
   db   0BBh, 6Dh
Start:
   B_CALL   _RclAns
   B_CALL   _ConvOP1
   ld   h, d
   ld   l, e
TrialDivideLoop:
   push   de
   push   hl
   B_CALL   _DivHLByDE
   ld   a, h
   or   l
   pop   hl
   pop   de
   jq   nz, NotFactor
   ld   h, d
   ld   l, e
NotFactor:
   dec   de
   ld   a, e
   dec   a
   or   d
   jq   nz, TrialDivideLoop
   ld   b, h
   ld   c, l
   ld   hl, OP1 + 15
   ld   (hl), d
BitLoop:
   dec   hl
   srl   b
   rr   c
   ld   (hl), '_'
   jq   nc, BitUnset
   ld   (hl), '-'
   ld   d, h
   ld   e, l
BitUnset:
   jq   nz, BitLoop
   ex   de, hl
   B_CALL   _PutS
   B_CALL   _NewLine
   ret

XTend
RankUserSizeDateCode
132981798/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<n)if(n%i==0)n=n/i else i=i+1print(Integer.toString(n,2).replace('0','_').replace('1','-'))}}

Language Ranking

RankLangUserSizeDate
1CJamRuner112168/3/2014 2:17:19 PM
2GolfscriptRuner112338/3/2014 2:17:19 PM
3TI-83+ z80Runer112588/3/2014 2:17:19 PM
4SysRPL329859.5 (don't ask me why; I'm going off of what he said)7/31/2014 5:18:48 PM
5TI-83+ BASICRuner112758/3/2014 2:17:19 PM
6RubyJuju987/30/2014 12:01:58 AM
7Perlwillrandship987/31/2014 2:15:31 PM
8Haskell32981228/3/2014 6:16:11 PM
9Nspire LuaJens_K1328/1/2014 6:59:33 AM
10Python2willrandship1477/29/2014 12:51:41 AM
11JavaRuner1121728/3/2014 2:17:19 PM
12XTend32981798/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
RankUserSizeDateCode
1Juju807/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
RankUserSizeDateCode
1Runer112327/27/2014 12:27:24 PM
Spoiler For Spoiler:
" "%-1%0\{.{|}*64<{~+}{" "@}if}/
2JWinslow23607/22/2014 1:02:09 PM
Spoiler For Spoiler:
" "%-1%0:a;{..{.47>\59<and},={~a+:a;}{}if}/]{.!{}{" "+}if}/a

Nspire Lua
RankUserSizeDateCode
1Jens_K113 (copy input to clipboard)7/23/2014 9:15:32 AM
Spoiler For Spoiler:
s,n="",0
for w in clipboard.getText():gmatch"%S+"do
if tonumber(w)then n=n+w else s=w.." "..s end
end
print(s..n)
2LDStudios1627/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
RankUserSizeDateCode
1willrandship837/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
RankUserSizeDateCode
1Runer1121747/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);}}
232981787/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);}}
3ben_g1987/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
RankUserSizeDateCode
1Runer112277/27/2014 12:27:24 PM
Spoiler For Spoiler:
qS%W%0\{_:i:|'A<{~+}{S@}?}/

XTend
RankUserSizeDateCode
132981597/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
RankUserSizeDateCode
132981387/27/2014 1:58:00 PM
Spoiler For Spoiler:
import Text.Read
g 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
RankUserSizeDateCode
13298797/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

RankLangUserSizeDate
1CJamRuner112277/27/2014 12:27:24 PM
2GolfscriptRuner112327/27/2014 12:27:24 PM
3SysRPL3298797/27/2014 1:58:00 PM
4Ruby 2Juju807/23/2014 12:39:40 PM
5Python3willrandship837/22/2014 3:08:29 PM
6Nspire LuaJens_K113 (copy input to clipboard)7/23/2014 9:15:32 AM
7Haskell32981387/27/2014 1:58:00 PM
8XTend32981597/27/2014 1:58:00 PM
9JavaRuner1121747/27/2014 1:58:00 PM

27
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 :P ). 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.

Please, ask any and all questions that you may have about the contest!

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.
Deadline
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
RankUserSizeDateCode
1willrandship947/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=z
print(b[(z==1)*2:7])
2Juju1487/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==1
print(("SAD","HAPPY")[h(input())])

Golfscript
RankUserSizeDateCode
1Runer112327/15/2014 5:17:50 PM
Spoiler For Spoiler:
~{`0\{48-.*+}/}9*("SAD""HAPPY"if

CJam
RankUserSizeDateCode
1Runer112307/15/2014 5:17:50 PM
Spoiler For Spoiler:
q~{Ab0\{_*+}/}9*("SAD""HAPPY"?

TI-83+ BASIC
RankUserSizeDateCode
1calc84maniac467/16/2014 5:03:49 PM
Spoiler For Spoiler:
Repeat Ans<5
sum(.5×√int(10fPart(Ans/10^(cumSum(binomcdf(98,0→A
End
"HAPPY
If log(A
"SAD
Ans
2Runer112467/16/2014 5:09:28 PM
Spoiler For Spoiler:
Repeat A≤4
iPart(10fPart(Ans10^(~cumSum(binomcdf(14,0
sum(Ans²→A
End
"HAPPY
If log(A
"SAD
Ans
3Hayleia717/16/2014 2:18:36 AM
Spoiler For Spoiler:
Prompt N
Repeat N=1 or N=4
sum(seq((10fPart(iPart(N10^(~I))/10))²,I,0,14→N
End
"HAPPY
If N=4
"SAD
Disp Ans

TI-83+ z80
RankUserSizeDateCode
1Runer112587/20/2014 9:32:08 PM
Spoiler For Spoiler:
;#SECTION "MAIN", CODE

   org   userMem - 2
   db   0BBh, 6Dh
Start:
   B_CALL   _RclAns
StepLoop:
   push   bc
   sbc   hl, hl
   ld   b, h
DigitPairLoop:
   dec   e
DigitLoop:
   ex   de, hl
   xor   a
   rrd
   ex   de, hl
   ld   c, a
SquareLoop:
   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   hl
Unhappy:
   B_CALL   _PutS
   ret

;#SECTION "StrData", DATA

UnhappyStr:
   db   "UNHAPPY", 0
2calc84maniac607/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,hl
HappyCalcLoop:
    xor a
    ld c,a
    ld d,a
    ld e,a
HappyByteLoop:
    ;Carry is reset, upper nibble of A is 0
    dec l
HappyNibbleLoop:
    rrd
    ld b,a
HappyMulLoop:
    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
RankUserSizeDateCode
1JWinslow231827/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
RankLangUserSizeDate
1CJamRuner112307/15/2014 5:17:50 PM
2GolfscriptRuner112327/15/2014 5:17:50 PM
3TI-83+ BASICcalc84maniac467/16/2014 5:03:49 PM
4TI-83+ z80Runer112587/20/2014 9:32:08 PM
5Pythonwillrandship947/19/2014 11:16:56 PM
6BatchJWinslow231827/19/2014 7:26:37 PM

28
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
After many long days of work, I am finally done. O.O

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]
A
Bi
Tri
Four
Fifth
Sextet
Seventh
TwoCubed
Composite
Triangular
LucasNumber
ZodiacNumber
UnluckyNumber
EInHexadecimal
PentatopeNumber
FourthPowerOfTwo
TenPlusSixPlusOne
FiftyEightModForty
PrimeAfterSeventeen
PositionOfTheLetterT
ATwoWrittenNextToAOne
SecondMultipleOfEleven
SmallestPrimeOverTwenty
SeventeenPlusTwoPlusFive
AreaOfSquareWithWidthFive
HalfOfAStandardDeckOfCards
SquareRootOfSevenTwentyNine
TheOnlyTwoDigitPerfectNumber
DaysInFebruaryIfItIsALeapYear
SmallerCoprimeNumbersArePrimes
BaskinRobbinsHasThisManyFlavors
PowerOfTwoInWhichDigitsArePrimes
ElvisPresleyIsCastInThisManyFilms
NinthIntegerInTheFibonacciSequence
TheSumOfTheCubesOfTheFirstTwoPrimes
NumberOfPianoKeysThatAreASharpOrFlat
TheNumberOfFederalReserveBanksInTheUS
ItsFormInBinaryIsOneZeroZeroOneOneZero
WriteTheFirstOddPrimeNextToItsOwnSquare
AtomicNumberOfTheElementKnownAsZirconium
ForMexicansThisNumberIsConsideredAGaySlur
ItsTheAnswerToLifeTheUniverseAndEverything
SmallestPrimeThatIsntTheSumOfTwoPalindromes
RetiredMLBNumberForHankAaronAndReggieJackson
TheTelephoneDialingCodeForTheCountryOfDenmark
ItIsTheValueInDecimalForTheASCIICodeForAPeriod
ThisNumberAppearsInAlmostAllTheStarTrekEpisodes
InternationalDirectDialCodeForPhoneCallsToPoland
NumberOfStringsOnTheHarpAndNumberOfKeysOnACelesta
TheNumberOfStatesThatAreInTheUnitedStatesOfAmerica
TheTopSecretAircraftTestingFacilityInSouthernNevada
TheNumberOfWeeksThatAreInAYearInTheGregorianCalendar
ItsTheThirdNumberNWhichDividesTheSumOfTheFirstNPrimes
NumberOfColoredStickersOnEachOfTheSquaresOnARubiksCube
LargestNumberInTheFibonacciSeriesThatsATriangularNumber
AsHardToBelieveAsItSoundsItsATownNameInTheStateOfMontana
TheModelNameOfACarMadeByTheGermanAutomobileCompanyMaybach
ItIsTheSmallestSmithNumberForWhichTheSumOfItsDigitsIsPrime
TheNASCARDriverMarcosAmbroseRacesWithThisNumberOnHisRacecar
TheNumberOfSecondsInAMinuteAndAlsoTheNumberOfMinutesInAnHour
TheSmallestPrimeForWhichItsReversalIsAlsoAPerfectSquareNumber
TheOnlyNumberWhoseCubeIsMadeOfThreeDigitsThatEachOccurTwoTimes
TheAlphanumericalValueOfThisNumbersRomanNumeralIsThisSameNumber
ThisIsTheNumberOfSquaresThatAreOnTheChessBoardOrTheCheckersBoard
TheSmallestNumberThatBecomesSquareIfItsReverseIsAddedOrSubtracted
WellItGoesThroughStLouisJoplinMissouriAndOklahomaCityLooksSoPretty
TheSmallestPrimeWhichBecomesPandigitalWhenItIsRaisedToTheTenthPower
AsADecimalNumberThisNumberIsTheLastTwoDigitNumberToAppearInPisDigits
YouHaveADirtyMindIfYouThinkOfThisNumberHowIThinkYouAreThinkingOfItNow
ItsTheLargestNumberNSuchThatTheSumOfTheDigitsOfTwoToThePowerOfNEqualsN
TheNumberOfDifferentCharactersThatCanBeUsedWithAStandardEnglishKeyboard
TheSmallestNumberThatRaisedToTheFifthPowerIsTheSumOfFiveOtherFifthPowers
ItsTheTwentyFirstPrimeItsReverseIsTheTwelfthAndItsAlsoAPalindromeInBinary
OnePlusTwoPlusThreePlusSixPlusNinePlusTenPlusTwentyPlusFortyMinusSeventeen
TheSmallestNumberThatIsPandigitalInQuaternaryAsInItIsOneThousandTwentyThree
OnePlusOnePlusTwoPlusTwoPlusThreePlusThreePlusThreePlusTenPlusSixtyMinusNine
ThisisTheSmallestPositiveIntegerThatRequiresFiveSyllablesInTheEnglishLanguage
IfYouAddUpTheGiftsInTheSongTheTwelveDaysOfChristmasTheyWouldAddUpToThisInteger
TheSmallestNumberThatCannotBeRepresentedAsTheSumOfFewerThanNineteenPowersOfFour
TheAtomicNumberOfTheElementKnownAsMercuryAnElementWhichWasOnceUsedInThermometers
ThisNumberIsTheOnlyPositiveRealNumberBesidesOneThatIsTheSquareOfTheSumOfItsDigits
TheInternationalStandardBookNumberGroupIdentifierForBooksThatWerePublishedInNorway
TheSmallestPrimeNumberWhichIsTheSumOfAPrimeNumberOfPrimeNumbersInAPrimeNumberOfWays
TheSmallestNumberThatIsAlsoTheSumOfThreeDistinctPrimesRaisedToDistinctPrimeExponents
TheSmallestNumberWhichCanAlsoBeExpressedAsTheSumOfTwoDistinctSquaresInTwoDistinctWays
TheLargestNumberNSuchThatTwoToThePowerOfNDoesNotContainAZeroDigitInItsDecimalExpansion
TheNumberOfYearsBetweenTheSigningOfTheDeclarationOfIndependenceAndTheBattleOfGettysburg
TheNumberOfConstellationsUpInTheSkyAsCurrentlyDefinedByTheInternationalAstronomicalUnion
TheSmallestPrimeWhichIsAConcatenationOfPToThePowerOfQAndQToThePowerOfPWherePAndQArePrimes
IfAnAngleInEuclideanGeometryHasAMeasurementOfThisManyDegreesThatMeansTheAngleIsARightAngle
InUSCentsThisIsTheSumOfTheValuesOfOneEachOfAllTheCoinsOfDenominationsThatAreLessThanADollar
TheNumberOfWaysThatEightQueensCanBePlacedOnAnEightByEightChessboardSoNoTwoCanAttackEachOther
OnePlusOnePlusTwoPlusTwoPlusThreePlusThreePlusThreePlusFourPlusFourPlusTenPlusTwentyPlusForty
ThisIsTheSmallestEvenNumberWithMoreThanOneDigitWhichHasNoRepresentationAsTheSumOfTwoTwinPrimes
TheRacingNumberThatWasOnRacecarLightningMcQueenTheMainCharacterInTheDisneyPixarAnimatedFilmCars
AlthoughThisMightBeHardToBelieveThisNumberIsActuallyTheNameOfASmallCityInTheStateOfSouthCarolina
TheLargestPrimeNumberUnderOneHundredAndAlsoTheLargestTwoDigitNumberWhereTheSumOfItsDigitsIsSquare
TheHighestJerseyNumberOneMayWearInTheNationalHockeyLeagueAsNinetyNineWasRetiredToHonorWayneGretzky
InTheUKAndIrelandThisIsTheNameOfAnIceCreamConeWithACadburyChocolateFlakePressedHalfwayInTheIceCream
OnTheCelsiusScaleThisNumberOfDegreesWhichIsTwoHundredTwelveDegreesFahrenheitIsTheBoilingPointOfWater
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! ;D
Click the gif image to jump to the latest version!

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. XD

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