Don't have an account? Register now to chat, post, use our tools, and much more.
Because snakes are cool.

:FnOff
:ClrHome
:ClrDraw
:GridOff
:AxesOff
:PlotsOff
:ZStandard
:84→Xmin
:-72→Ymin
:ZInteger
:30→nMin:30→PV
:46→nMax:44→FV
:26→I%
:Horizontal 0
:Vertical 0
:Vertical 94
:Horizontal Ymin
:Pxl-On(30,45
:For(n,0,E9
:2randInt(1,30→P/Y
:2randInt(1,46→C/Y
:0
:Repeat pxl-Test(nMin,nMax
:If Ans
:Then
:PV+2(pxl-Test(PV+1,FV)-pxl-Test(PV-1,FV→PMT
:FV+2(pxl-Test(PV,FV+1)-pxl-Test(PV,FV-1
:Pt-Off(FV,-PV,3
:Ans→FV
:PMT→PV
:End
:getKey
:If Ans
:Ans→I%
:(I%=34)-(I%=25→PMT
:(I%=26)-(I%=24
:Pxl-On(nMin+PMT,nMax+Ans
:Pxl-On(nMin,nMax
:Pxl-On(P/Y,C/Y
:nMax+2Ans→nMax
:nMin+2PMT→nMin
:End
:If nMin=P/Y and nMax=C/Y
:End
:Disp "Score:
:Output(1,7,n

Note: Optimizing was geared solely towards speed.
I was going to ask what you have against [code] boxes until I noticed what you were doing with the italics. If I recall, SourceCoder has symbols for those, but I'll have to double-check. I'm looking at this, and I'm not quite seeing how it would properly erase the end of its tail. Would you care to clarify how that works without a list of previous coordinates?
KermMartian wrote:
I'm looking at this, and I'm not quite seeing how it would properly erase the end of its tail. Would you care to clarify how that works without a list of previous coordinates?

(PV,FV) chases (nMin,nMax)'s breadcrumbs! The coordinate-step holds that the former won't be misdirected by the head brushing against the tail.

Thank you for having the forethought to keep the code as-is. I had originally planned to use SourceCoder, but it doesn't cooperate during export with those variables in there.
I figured it was something like that, but I'm unfamiliar with the term coordinate-step. Should I JFGI, or would you mind explaining?
I pulled the term out of thin air, but a glossary entry from an affiliate of the Department of Health and Human Services shares the intended significance and states it beautifully thus: "The interval spacing between two successive points." That is, the snake body moves two pixels at a time, drawing at the neck as well as the head once per iteration.

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» All times are GMT - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum