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 ... 13 14 [15] 16 17 ... 40
211
Community Contests / Re: Code Golf Contest #5
« on: August 11, 2014, 02:57:37 pm »
Just so you know, someone made a 256-bytes Snake on Cemetech using z80 ASM, and it does all you said (although it uses a 16*16 grid).
Notify that someone! He can change it, and submit it!

And this challenge is more oriented towards computer languages and stuff, as a quick Google search will bring up an already made answer for TI-BASIC (which I will not allow anyone to submit but the author, whom I do not know).

212
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

213
Community Contests / Re: Code Golf Contest #4
« on: August 11, 2014, 12:28:01 pm »
OK, so unless we have any objections, the next challenge is to make a game of Snake. If anyone objects to this challenge, speak now or forever hold your peace.

214
Community Contests / Re: Code Golf Contest #4
« on: August 11, 2014, 12:11:51 pm »
While not eligible for judging, it is an impressively small solution!

Oh, and Jens_K, the deadline is always midnight (Central Standard Time) on a Monday.

215
Community Contests / Re: Code Golf Contest #4
« on: August 10, 2014, 07:27:13 pm »
Rule clarification: We measure by the amount of characters it takes. Link to character counter: http://mothereff.in/byte-counter

216
Community Contests / Re: Code Golf Contest #4
« on: August 10, 2014, 01:34:22 pm »
Jens_K has finally submitted, bringing the score on Nspire Lua from 122 to 115! Can LDStudios do any better?

217
Community Contests / Re: Code Golf Contest #4
« on: August 09, 2014, 05:58:43 pm »
Well, I could remove the _ in mapM_ if some garbage looking like [(),(),(),()] below the output is okay. But other than that, I ran out of ideas.
In other news, I reduced my Java program size by 4 bytes, so I claim the first place in that category again. :P The XTend entry is also reduced by 7 bytes. And finally there is a new C entry with 154 bytes.
That should be fine; I did so. That last byte is a killer, though.

* bb010g pokes JWinlow23 to remove the underscore from 3298's answer
I did. Did you see the size change? :P

218
Community Contests / Re: Code Golf Contest #4
« on: August 09, 2014, 03:22:33 pm »
IOCCC, anyone? :P
Well yes.

Also my output is surroundered by double quotes and JWin don't seem to care.
Well, it shouldn't matter as long as it is a correct output.

219
Community Contests / Re: The Omnimaga Obfuscated Code Contest (OOCC)
« on: August 09, 2014, 03:21:23 pm »
Another coding contest...wow, it's becoming a trend. :P

I'll start writing in Batch, and I have a bunch of tricks up my sleeve. ;) Just, is there any rules on what the code can do? Like, is this a Hello World, a Truth Machine, or whatever we want it to be?

220
Community Contests / Re: Code Golf Contest #4
« on: August 09, 2014, 02:10:32 pm »
IOCCC, anyone? :P

221
Community Contests / Re: Code Golf Contest #4
« on: August 08, 2014, 02:13:38 pm »
Oh dang. XD

3298, care to rebut?

222
Community Contests / Re: Code Golf Contest #4
« on: August 08, 2014, 11:24:57 am »
3 days left! Anyone wanna take a stab at the first ever Axe entry?

223
TI Z80 / Re: [Axe] Source Seekers Battle (TI-83+ & up)
« on: August 08, 2014, 12:59:16 am »
Hopefully it stays true to the original. We'll see.

224
Community Contests / Re: Code Golf Contest #4
« on: August 07, 2014, 01:49:51 pm »
How the heck did you compress the Haskell code like that :crazy: ... nevermind, got 71 bytes now, assuming Unix-style line endings (with DOS-style 2-byte line endings it's 72). Take that!
Edit: Also cut down the SysRPL program size to 63.5. I don't expect to be able to compete with CJam and Golfscript, but at least SysRPL is useful for real problems. ;)
By the way, the compactness of that language comes from the fact that programs are usually stored in compiled form. Judging from the prime tester example in the post from the first round, TI-Basic does something similar, though (it seems commands take 1 byte each, instead of 1 byte per character in their names), so I don't feel bad for telling you the compiled size instead of the much larger source size. I know Casio-Basic does those 1-byte commands as well, but because string manipulation is not present in the Casio-Basic version on my calcs, I cannot submit a Casio-Basic entry. (String manipulation was introduced in OS 2.00 for the 9860 series.)
Actually, there are 2-byte tokens in TI-BASIC, and lots of them. That is part of the reason why we don't like lowercase letters. :P

Looks like things are getting pretty heated in the Haskell category! 3298 and bb010g are slashing bytes like crazy! Only thing to wonder now is, when will they stop? (And will it be before the competition's over?)

225
Community Contests / Re: Code Golf Contest #4
« on: August 06, 2014, 04:56:59 pm »
Woo! Now we have a new record to beat! 68 bytes, anyone?

Pages: 1 ... 13 14 [15] 16 17 ... 40