The reason why I decided to do this is that when I switched from Scratch to Python, I thought "I wonder if I can change from Scratch to Python ..." and Python understood that, Unity and When doing C # "By the way, I wonder if there is a way to change from Scratch to Python ... Look for it." "No ..." "Say, I made it myself." I decided to make it.
First, you get the .sb3 file when you download the Scratch project file. If the sb3 file cannot be parsed, nothing can be done. So when I searched for "sb3 file analysis", I arrived at a site that displayed the names of variables used in the Scatch project. Change the extension to .zip and drag the site. So, I thought this might be the case, I changed the extension to .zip, and when I unzipped it, I found a json that looked suspicious. Looking at the contents of it, it clearly writes things such as blocks. For the time being, the file to be analyzed was found.
At that time, I wanted to distribute it, so I wanted to make it something that anyone could do. If you make it with PythonTkinter, only people who have python installed can execute it, so I made it into C # Form and made the GUI part.
I managed to use the ZipArchive (C #) class.
Even if I tried to parse Json in C #, I had to create a class dedicated to it, so I reluctantly decided to use the Json module of Python. After doing such a thing and such a thing, Json's analysis was completed safely. By the way, I decided to use System.Diagnostics.Process to execute Python in order to execute it automatically.
I thought I would write it in C #, but I decided to write it in python because I had done the Json parsing in python. However, I had to specify the location and name of the file to write to, so I decided to put an argument at runtime and read it with sys.argv. After that, open () and write () in the if hell at the time of Json analysis is OK.
Should this be distributed? I'm afraid I'll rely on this tool if I do. (Is there anyone who downloads it in the first place?) Not compatible with some blocks. This isn't a hassle, but if you want to do more than that, you can use Python.
The block definition of the json file is divided into one block. One operator is also one block. In other words, when calculating 5 + 5 + 5 + 5 + 5, I used a recursive function. But that's only close to 1000, so please let me know if you have a better idea.
I've been using .format () for a long time because I didn't know the f string until it was almost completed. I thought it would be nice if there was something like a C # \ $ string, and when I googled it, there was an f string and it was f awesome. Maybe the f string or the \ $ string is different.
After exiting the if or for block, I have to write else or the one below it, so I saved that else or the one below it in the list, and when I called it, it was the current layer -1. That guy
if True:
if True:
if True:
if True:
print("Hello")
print("World")#-2 has been. You can use and
Because there was something like that, I decided to save the hierarchy at the time of if together.
I don't know why, but thank you for watching so far.
~~ Published ~~. ~~https://www.axfc.net/u/4023085~~
Recommended Posts