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.


Messages - JWinslow23

Pages: 1 ... 11 12 [13] 14 15 ... 40
181
Community Contests / Re: Code Golf Contest #7
« on: August 25, 2014, 08:26:02 pm »
Nice for a first submission, pimath. :)

182
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]

183
Community Contests / Re: Code Golf Contest #6
« on: August 25, 2014, 04:25:27 pm »
Contest over.

184
Community Contests / Re: Code Golf Contest #6
« on: August 19, 2014, 01:12:51 pm »
Well the thing would be, you can't really use a console if the other environment doesn't provide one :P
I'll accept it if anyone with an Nspire can run it with as few external utilities as possible. The tester I use is http://bwns.be/jim/WEBspire/editor.html

185
Community Contests / Re: Code Golf Contest #6
« on: August 19, 2014, 01:02:41 pm »
I can accept that. Just don't use any environment-specific features, if possible (i.e. make it so others can also run it in a different environment).

186
TI Z80 / Re: [Axe] Flappy Bird clone
« on: August 19, 2014, 10:09:02 am »
That whole thing was a joke. (except for "It runs pretty well on 6MHz" :P) I tried to make it sound a bit more hardcore than it really was. Stupid idea, I know.

187
Community Contests / Re: Code Golf Contest #6
« on: August 19, 2014, 10:05:41 am »
I have a question. I made a TI-Nspire Lua console some time ago that basically gives you a Lua command line where you can enter scripts (and it has io, etc). Am I allowed to enter scripts that run in it (and depend on it)?


(Basically it's a bit like a shell)
If it works in a normal Nspire Lua script editor (like LDStudios has), it shall be acceptable.

Also, I have a smaller version of the TI-BASIC entry, a 60-byte Python entry, and the first Axe entry, all completed! Updating in a bit.

188
TI Z80 / Re: [Axe] Flappy Bird clone
« on: August 19, 2014, 12:53:14 am »
My Flappy remake was 3 level grayscale, had parallax, highscore saving, real-ish-like acceleration physics, and a darn nice 8x8 bird sprite if I do say so myself. :P

It runs fast enough on 6MHz.

189
Community Contests / Re: Code Golf Contest #5
« on: August 18, 2014, 06:28:17 pm »
So we have to pre-plan all possible games for the contest :P
Yeah but if JWinslow23 decides to do like 4 game-related Code Golf contests within a single month span, then that's a massive amount of stuff to plan and it would be easy to get lost in it and mix rules up.
I'll NEVER do a game again, don't worry. :P

190
Community Contests / Re: Code Golf Contest #6
« on: August 18, 2014, 02:28:13 pm »
I'm eager to see how you guys made words out of numbers ( without any builin libs, that is), in such a low number of bytes.
... or maybe I'm just missing something :P

Edit : ok, I did - it's much better now that I read the post carefully :D
It's kinda like, in TI-BASIC:
Code: [Select]
Disp "SEVENExcept you have to add the input handling I mentioned earlier. :P

191
Community Contests / Re: Code Golf Contest #6
« on: August 18, 2014, 01:20:54 pm »
They must be newline-separated.


I have a 26-byte Golfscript already. And a 34-byte TI-BASIC.

192
Community Contests / Re: Code Golf Contest #6
« on: August 18, 2014, 12:54:54 pm »
I've got a 41 byte python solution. I might have a chance this time.
For the updated challenge? Then the first thing it must output after input is "FORTY-ONE".

EDIT: I see now that you actually did the quine challenge. :P Sorry, no more changes this time.

193
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

194
Community Contests / Re: Code Golf Contest #5
« on: August 18, 2014, 12:04:32 pm »
I. AM. NEVER. DOING. THIS. CHALLENGE. AGAIN. O.O

Don't expect to see any more game challenges before Contest #9001. :P

195
TI Z80 / Re: [Axe] Flappy Bird clone
« on: August 15, 2014, 01:47:25 pm »
The speed of this version... O.O And I thought MINE was hard! :P

Good job, but make it a bit slower. ;)

Pages: 1 ... 11 12 [13] 14 15 ... 40