KEWL! I love the way you use the pen to create the array. Maybe you could make a calculator (like FigureIt in toontownmiser's Scratch Soft OS) that uses this for a memory function - that would mean you could have a calculator with like 200 slots of memory. Ensure you put in "Store" and "Read" buttons though!
Nice use of pen to do arrays. It might be easier and faster to use 10 costumes and stamp a single pixel, though. I think this would also avoid the off-by-one error in the pen, eliminating the need for the "on website" variable.
Download this project!
Download the 4 sprites and 13 scripts of "digit array" and open it in Scratch
Project Notes
INSTRUCTIONS (to see what it can do) 1) Choose a width and height 2) Click the start flag 3) Choose an "index" and a value "to store" and click "store" (make sure your index is less than your width*height) 4) Choose as many other "indexes" and "to stores" as you want and click "store" for each one 5) Go back to your first index and click "retrieve" to see the digit you stored 6) Go back to as many other indexes that you want (of the ones that you stored) and click "retrieve" 7) try clicking "test all"
INSTRUCTIONS (to use it in your own project) 1) be aware of the "on website" variable, which must be set to 0 if in Scratch and 1 if on website 2) Export the "number array" sprite 3) Import the sprite into your project. 4) access the variables "index" and "to store" (for example by using the set blocks under the variable menu) and broadcast "store" to store each number you need to store for later. 5) Access the "index" variable and broadcast "retrieve" to get the numbers you stored back one at a time 6) Be careful not to let your other sprites cross the brown boundary around the array in the top right hand corner since that could corrupt your data while you're reading it.
ABOUT This is a digit array that holds the numbers 0 through 9. It can hold about 50 Kilobytes of information. You can resize it between 1 digit and 10,000 (or up to ~150,000) digits. It's meant to be used in other projects by importing the "digit array" sprite. It's also meant as a proof of concept and a fun thought experiment. It "remembers" the digits by drawing colors with the pen, and then later reading the colors back with a lookup table. Google "arrays" to find out more or check out http://www2.sas.com/proceedings/sugi30/242-30.pdf I hope this will make some projects more possible to make in Scratch which were previously very difficult. After making the program I found that Kevin Karplus had implemented a version of arrays for his Simon game as well as Roberth in <a href="/projects/Roberth/5184">(link to project)</a>. Mine is different in that it takes digits 0 through 9 and can hold many more bits of information. I've done things like this before in projects years ago such as Simulation of Life, <a href="/projects/jay/220">(link to project)</a> But this is the first reuseable implementation. I should mention too that it's about as compact as you can get without adding more colors.
FUTURE IDEAS I'd like to see some complex projects build on top and especially a char array, word processor, and other such things that need lots of memory.
Comments
You need to be logged in to post comments
Add a Comment
k..
haha! i can reply to my own comment!!
(view all replies)omg i havs no ideas hows u did it, but it koolio and awsum!!!
whoa to much for my lil brain... j/k, i like it! :D
KEEEEEEWWWL!
That's what I did <a href='(link to project)'
KEWL! I love the way you use the pen to create the array. Maybe you could make a calculator (like FigureIt in toontownmiser's Scratch Soft OS) that uses this for a memory function - that would mean you could have a calculator with like 200 slots of memory. Ensure you put in "Store" and "Read" buttons though!
I don't understand...but... This should be featured!
i will make something
Nice use of pen to do arrays. It might be easier and faster to use 10 costumes and stamp a single pixel, though. I think this would also avoid the off-by-one error in the pen, eliminating the need for the "on website" variable.