Microsoft MakeCode

Possibility to increase stack size?

Hello all,

I’m making a sandbox version of Sam Hogan’s Cell Machine. (See his youtube video at https://www.youtube.com/watch?v=N-BbgqOjIqk - I highly recommend watching it!)

It’s going pretty well, actually, except that I keep getting stack overflows. Is it possible to increase the stack size? Or can I store other stuff in the heap to make room in the stack? Or does the SO mean that I would’ve run out of memory on a physical device? (PyGamer, not RPi0)

As always, if you find any bugs, please report them here. This is still in beta and oh dang it, found a bug. Got to go fix that…

Here’s the game:


Allows enemies to push other enemies without destroying them
Previous versions

Sam Hogan’s Game of Cells v0.4 BETA

Instructions

A                  Place the selected cell
B                  Cycle through all cells
Joystick/D-pad     Move cursor around
Menu               Start/pause/resume simulation

Cells
image

1 - 4      Mover cells that move and push cells in the indicated direction
5          Pushable in all directions
6 & 7      Slides in the only indicated direction (= goes sideways and || goes up and down)
8 & 9      Rotate all 4 adjacent cells in indicated direction by 90 degrees each generation
10 - 13    Generator cells that clone the cell behind the arrow and push the cloned cell in the arrow's direction
14         Immobile cell that can not be pushed
15         Enemy cell that generates a point every time it is destroyed by pushing another cell into it
16         Used for removing cells while editing (Backspace basically)

And, as always, Github repository is here:

Seems to be @darzu’s move sprite by cols and rows. Any idea why? (I might just be calling it way too much because moveCell is a recursive function that can run up to 20 (I think) layers deep in a single move because it might need to move other cells too)


Oh, and if you need to make a stack overflow, here’s a simulation (shouldn’t be hard though):
image

Hey @UnsignedArduino, thanks for bringing this up. I’ve been swamped by a couple other things, but I’m planning on taking a look at this issue soon. Likely there’s some inefficiencies in the grid system that can be improved.

Oh, I fixed it. I just return from the moveCell function if I’m trying to move a cell off the grid

I think it’s my fault - I don’t know how to write recursive functions :man_facepalming: