Brianna Rainey's Blog

Updated my Minecraft mod (Copper Lamp) to 1.19... seems the only change needed aside from bumping some numbers was changing an import statement across a bunch of files. (Minecraft uses its own version of Random now instead of normal Random.)

Tomorrow I'll do some more thorough testing for obscure bugs and if all's well then I'll upload a new jar file 😊

I wrote a Cypress (automated web browser) test for muffin-game to take pictures of the canvas and compare them for changes. I had to read the script from a Docker image to understand how to use the snapshot plugin I chose, but it works now!

(I should see if they're open to better documentation so people don't struggle like I did. I feel like they ommitted details that are probably common knowledge in that domain, but it would be good to include these details for newbs like me.)

PEP 690: Lazy imports in Python! Sounds like it will eliminate any reason to put import statements halfway through a file. Although it will be less explicitly obvious when something is imported at runtime, I think that might be a minor issue compared to the stylistic and performance benefit.

"This PEP proposes a feature to transparently defer the execution of imported modules until the moment when an imported object is used."

The lazy import behaviour would be opt-in globally and then you can selectively opt-out certain modules by 1) mentioning the name right after import, 2) importing within a try block, or 3) using a context manager called "eager_import" (which doesn't do much, it's just for readability).

Since it's opt-in and changes behaviour, maybe it will not be used outside of huge projects that really benefit from it... Non-default is an uphill battle for a new feature.

Funtimes is offline now because bat2web is not good enough. I designed it to work on the terminal first, and making it work on the web was an afterthought. Also, I knew less about Flask when I made it (which is why you can't save the game into a cookie yet).

When requesting input from the user, as a quick hack to make it work online, bat2web enters a while loop and continuously checks if user input is in a queue that gets filled by another thread. It's bad, but it works... kinda. I'll call it a proof of concept. 😛

There's two methods I've thought of to improve the program. One method would be a better system for separating these threads into different processes, keeping them alive as we do now, and managing them at a higher level. That sounds annoying, although it would be cool.

Another method (which I'm more inclined to do) would be to make's state serializable so that the Python process can be started fresh with each network connection.

I think I can re-enter an arbitrary part of a batchfile chain if I store the callstack with line-numbers and the currently defined variables. I think it would work? 🤔 Perhaps not for all batchfiles, but it should work for Funtimes.bat

The server would receive the callstack as a list of dictionaries, and the variables as a dictionary. Create a new Python process with, then define the variables and jump to the line-number belonging to the last member of the callstack list. If an exit must be performed, pop the last item from the callstack and go to the line-number above it. When the callstack is empty, exit the program.

Not sure if I'm going to program this or if it would actually work, but it's an idea.

older posts