Board Thread:Questions and Answers/@comment-24454571-20140517053531

My mind hasn't been on PTC lately, as much as I think I would like - maybe I should wait for the inspiration, but part of me wants to keep the interest in it alive. There are some things I keep saying that I should do, like go through the PTC Technic again to see what that explains, but for now I'm hoping that perhaps some of you can help me to better understand what is going on in Randomous' COLITEST code...

ACLS:CLEAR DIM MAP(32,24) RESTORE @MAP FOR I=0 TO 23 READ MAPLINE$ FOR J=0 TO 31 MAP(J,I)=0 IF MID$(MAPLINE$,J,1)=="1" NEXT NEXT FOR I=0 TO 23 FOR J =0 TO 31 IF MAP(J,I) THEN BGPUT 1,J,I,45,8,0,0 NEXT NEXT PLX=48 <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">PLY=32 <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">@LOOP <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">GCLS <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">PLXO=PLX <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">PLYO=PLY <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">B=BUTTON <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">IF B AND 8 THEN PLX=PLX+1 <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">IF B AND 4 THEN PLX=PLX-1 <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">IF B AND 2 THEN PLY=PLY+1 <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">IF B AND 1 THEN PLY=PLY-1 <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">IF MAP(FLOOR(PLX/8),FLOOR(PLY/8)) THEN PLX=PLXO:PLY=PLYO <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">IF MAP(FLOOR((PLX+5)/8),FLOOR(PLY/8)) THEN PLX=PLXO:PLY=PLYO <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">IF MAP(FLOOR(PLX/8),FLOOR((PLY+5)/8)) THEN PLX=PLXO:PLY=PLYO <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">IF MAP(FLOOR((PLX+5)/8),FLOOR((PLY+5)/8)) THEN PLX=PLXO:PLY=PLYO <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">GFILL PLX,PLY,PLX+5,PLY+5,6 <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">VSYNC1 <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">GOTO @LOOP <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">END <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">@MAP <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">DATA "~and for convenience, a 32 by 24 set of map data"

I took this very question to the Gamefaqs forum and received multiple answers by Trinitro, however, I still am having extreme difficulty in conceptualizing what is going on here and piecing it together to understand how/why it works.

In my initial research, I looked up RESTORE on Snailfacia's guide, and accurately judged that if I were to take out that line that the code would still function properly, which it did - however, Trinitro told me I should get an error, and looking back on it I don't quite understand why it didn't... In fact I'm kind of baffled as to how I came to that conclusion... It's as if I now have no idea what's going on there...

ANYHOW- more pressing matters, my first big question was, "How does READ MAPLINE$ know what to do / do anything at all?" - Trinitro's answer was that it<span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;"> tells Petit Computer to set the value of the DATA that the pointer is on to that variable but I have no clue how it knows what variable it's talking about - apparently this is more obvious to less dumb people; also, I figured that this was a statement that declared the existence of the variable in the first place.

Next was... DIM MAP(32,24) and the FOR I & J loops - I was left wondering, "How does the computer put these things together?" as an outsider to coding, I would expect that you would need to somehow relate these two functions together in a statement that would say something like, "In relation to the Dimension MAP, these loops, dadadadadada" - then the next question I had was, why is FOR I=0 TO 23 before READ MAPLINE$ while FOR J=0 TO 31 is after it? I assume that if I knew more about the processes going on here that I might be able to figure this out, however I lack the required Intelligence score to do so.

Those are basically the big questions that I have right now - other things I feel might fall into place more as I get to understand the processes better - some of the other inquiries that I came up with, though, were like... [in relation to <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">IF MAP(J,I) THEN BGPUT 1,J,I,45,8,0,0 ] "<span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;  display: inline !important; float: none;">I imagine it does I first, so it would BGPUT ~,0,0 to 23,~,~,~,~ and then BGPUT ~,0-31,0?(seems like that could mess it up),~,~,~,~. " as in, to me it seemed like the process of FOR TO loops could over-write the variables that it previously set - again, this could just be a visualization challenge on my part, as I know how FOR TO loops work relatively well, but putting them into a command like BGPUT is throwing me off.

Lastly, I'd like some help visualizing what is happening in the Movement & 'Back-tracking' department of the code, <span style="color: rgb(11, 12, 14); font-family: 'Helvetica Neue', HelveticaNeue, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">IF MAP(FLOOR(PLX/8),FLOOR(PLY/8)) THEN PLX=PLXO:PLY=PLYO , etc., let's see... it uses data from MAP (kind of vague so far, but I'm more interested in the Geometry here) to... Round the Known Position X by 8, and Known Position of Y by 8, then updates the Known Positions with the Hypothetical Positions...

If this were to be represented on a Graph, though, how would you explain what is happening here? Is it a good idea to use a Graph to understand these equations? I'm assuming that the computer builds a sort-of Graph to keep track of the Pixels, or the Background thingies, or whatever, but I don't know where there is evidence of this Graph being represented in the code - maybe I'm over-complicating things here, but these are serious questions I ask myself to better understand the beast within the computer.<ac_metadata title="[Try to] Help me to understand COLITEST by Randomous (some more)."> </ac_metadata>