Author Topic: Snake Game  (Read 2938 times)

0 Members and 1 Guest are viewing this topic.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Snake Game
« on: March 19, 2015, 06:53:26 pm »
Well...it has been quite a while since I posted here. Hey everyone.

Anyways, point of this. A few years ago I wrote a snake game. That snake game was probably one of the smallest snake games (if not the smallest), at least at the time. 361 bytes (or whatever the unit is...I don't remember).

I was planning on not only releasing the game to you guys, but was also going to write a complete tutorial on basic game writing because I had kept each stage of the game. It would have just been about one way of going about a game. Places to start, how to think about it, maybe some optimization. I don't remember all the details.

Unfortunately, I have not come bearing this tutorial. I do come though with the game...in text form. I've been planning on just posting it for a while now so you guys could play with it, but haven't had the time/motivation. So I figured why not today.

Code: [Select]
ClrHome
{8.4,7.4→L1
DelVar DDelVarS2→C
DelVar Y1→X //DelVar Y then 1→X
Repeat min(L1≠F
randInt(1,16)+.1randInt(1,8→F
End
Output(10fPart(F),iPart(F),"+
Repeat L>1
getKey→K
Output(10fPart(L1(1)),iPart(L1(1)),"*
If Y
Then
(K=26)-(K=24→X
If Ans
DelVar Y
Else
.1((K=34)-(K=25→Y
If Ans
DelVar X
End
Output(10fPart(L1(C)),iPart(L1(C)),"_ //_ = Space
X+L1(1
Ans-16((Ans>=17)-(Ans<1
Y+Ans
Ans-.8((fPart(Ans)=.9-not(fPart(Ans
augment({Ans},L1→L1
If F=L1(1
Then
S+1→S
Repeat min(L1≠F
randInt(1,16)+.1randInt(1,8→F
End
Output(10fPart(Ans),iPart(Ans),"+
C+1→C
End
C→dim(L1
sum(L1=L1(1→L
End
ClrHome
Output(1,1,"SCORE:_
Output(1,8,S

I'll be honest, I don't remember how exactly everything works. But I do know that it basically just refreshes the start of the snake, deletes the last, and ya. Hopefully some of you guys can answer the questions about what things are doing what :P

I remember I had Kerm look this over after I wrote it and I don't think he saw any other spots to make it smaller or faster. I'm curious if you guys see anything.
I also apologize for if there is a typo somewhere in there. I don't think there is one, but could be.
Enjoy.

SIDE NOTE:
If I ever am able to get the actual file off my calculator I'll try to attach that.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Snake Game
« Reply #1 on: March 19, 2015, 11:17:33 pm »
Hey there, it's been a while! Good to see you around!

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: Snake Game
« Reply #2 on: March 20, 2015, 12:12:57 am »
Yep, been a while, welcome back ^_^

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.