New games every week!
JSE - Reforming Blog
13th April 2021
I took a huge chunk out of the RPN code, yesterday, and sat rewriting it all.

-=-=-

As good as it was, there were still a number of flaws in my techniques.
Over in this SoCoder thread, Shroom_Monk guided me towards a couple of interesting points, most notably that .. once RPN'd, the line of code "probably" shouldn't contain brackets.
That set me off on a cleansing frenzy, and I just about managed to strip out most of the brackets, other than those necessary for function calls and the like.

The result is a much more stable set of functions, whereby I can now manage to trip it up a little less than I could before.
I still can, though. There are a couple of pitfalls where the code tries to do calls within calls...
Something like Text 100,200,Rand(Sin(Mills),Cos(Mills)) will trip it up, mostly because the bits inside the brackets end up resetting the "how many commas has I parsed" value, and everything gets confused as a result.
I need to add commas/parameters to a secondary stack, per line, I reckon.

Boy, this is complicated stuff, huh!!?

Today's task will be trying to figure that stuff out. Adding yet another set of stack values, and hoping I can keep the speed up.
Speaking of which, I should probably move the parameters into values instead of trying to read them all from strings all the time. That can't be good for the speed of things. But it'll require ever more arrays to store it all. Each line needs a line number, a parsed value, a stack value, and now another parameter value, too, before you even get to the actual value/command/etc that's on the line. Eeek!

Right then..
Get to it, Jay!

// String Tests // by Jayenkai // Created 2021/3/7 Graphics 640,480,2 Repeat CLS; SetCol(0,0,128); Rect 0,0,ScreenWidth(),ScreenHeight(); Print SetHue(60,1,1); Print 1+2*3+" <-- (BODMAS) Issue! .. Haven't even tackled this, today!" Print "1+2+3="+(1+2+3)+" <-- Bafflingly Broken!" Print "[[ "+123+" Hello World "+(1532*4)+" ]] <-- Given that this works.." Print Mills() % 1000 < 500+" <-- This ticks like it oughta" Text 320,200,ScreenWidth(),1 Text 320,240,ScreenHeight()+"<--Broken",1 // The number's up on the top left of the screen..!?! // The string is nowhere to be seen..!!!!!? Flip Forever



Views 115, Upvotes 20  
Daily Blog , Jse
New games every week!
Site credits : Jayenkai made this.
(c) Jayenkai 2023 and onwards, RSS feed 81

Blog - JSE - Reforming - AGameAWeek