#1✎ 24DevinF06Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthVideo GamesI like to play video games!HobbiesIs there any way to simplify code to easily be read by a program?
for _=.to 1
nextTo:FOR _=0 TO 1
#2✎ 102niconiiVideo GamesI like to play video games!HobbiesExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthDrawingI like to draw!HobbiesYou'd have to write a program that can read the original code and simplify it... at which point you don't need to simplify it, because you just wrote a program that can already read it.
#3✎ 24DevinF06Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthVideo GamesI like to play video games!HobbiesI wanted it to be simplified so that some code can easily read it.
Like so something can detect CONTROLLER 0 and prevent it. (It crashes SB.)
#4✎ 162612Me21Head AdminThird YearMy account is over 3 years oldWebsiteSyntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express YourselfJust complain to smileboom until they fix it lol
#5✎ 940Y_ackIt's not like there aren't ways to:
You can use newlines instead of statement separator (:), only the single-line IF syntax, not use functions, use whitespace consistently, consistently indent nested blocks...
...but you'd still have to write a parser, it would just be a parser that recognizes 85% of the SmileBASIC syntax instead of 99%.
#6✎ 24DevinF06Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthVideo GamesI like to play video games!HobbiesWell, I just wanted to know so a program could read and replace code so it could be run line by line
FOR I=0 TO 2
#7✎ 940Y_ackSure; what you're describing is called a compiler.
#8✎ 24DevinF06Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthVideo GamesI like to play video games!HobbiesHuh.
#9✎ 87seggiepantsYou aren't explaining what you really want here. It sounds like you want two things.
The first is a code formatter that would take exiting source code and reformat it. It would take things like ? and change it to PRINT, change . used as a number to 0 (why do people do this, they are both a single character), and add consistent padding and indentation levels. This would make other peoples code easier to read. The problem of course is that you can't do this with a bunch of simple search/replace calls. After all what happens if you use PRINT "How are you today?" and the formatter changes it to PRINT "How are you todayPRINT". In order to do it right you need to tokenize and parse the code then print it back out again in a standard form. The problem with that is of course that you are basically writing half of a compiler or interpreter. You are half way to writing SmileBasic in SmileBasic so you can SmileBasic while you are SmileBasic-ing (sorry couldn't resist the old meme). It would be sure nice to have that but probably no one wants to spend the time to write it.
The second thing you post almost looks like loop unrolling which again heads off into compiler/interpreter territory. But, I don't think that is what you really want. Instead, what you really want is a nice debugger. Then you could put breakpoints on things, single step through code, and inspect variables, or add watches. That would be even nicer than the code formatter. Unfortunately, SmileBasic doesn't give you the hooks to write one. Instead we have two commands. In old school basic there were two more TRON and TROFF for trace on and off to trace variables in the program, and yes that is what the movie TRON is named after. Unfortunately, it doesn't look like SmileBasic gave us those. So we only have STOP and CONT/CONTINUE. Stop will halt execution of your code. Then you can try to print out variables manually in direct mode. Then when you are ready you can type CONT or CONTINUE to resume execution.
FOR I = 1 TO 3
PRINT I * I
Then in direct mode you can RUN or hit the start button.
It will say Break on 0:8
You can type in PRINT I to get a 1
then type CONT to have it continue.
Repeat that three times and the program finishes. Unfortunately, that is all the tools we have to work with in SmileBasic. Well that and having a bunch of PRINT statements scattered throughout your code to write out status as things run.It is messy and primitive. If you have a terrible thing to debug you could try sending it over to your computer with PetitModem and then try to get it running under QB64. I think that one has a reasonable debugger, and is probably the closest computer equivalent of SmileBasic except it isn't really very close at all. The graphics and sound and such are all very much different between the two.
I guess you have one more tool. Generate a key for the code, post a thread here, tell people what kind of problem you are having and where in the code. If you are lucky, the nice folks here may be able to help you fix the problem, or explain what is going on. Just don't abuse the help people provide, be thankful and patient, it can take a while.
#10✎ 24DevinF06Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthVideo GamesI like to play video games!HobbiesIt was just a very complicated mess for me
but if someone were to make this,
any code editing/inserting via program is possible! (And with that, true multitasking is possible)