Memories VII - Local Memories
You're building a casino, with several games of chance. Each one of which uses a memory to keep track of what's happening in the game. Elsewhere you have a lift and you would like to use a memory to code which floor your guest has taken the lift to so that you can make sure that when they leave the lift they end up on the right floor. That's another memory, or a memory part at least.
That could be a lot of memories used. Not necessarily. In each case, you only want to remember something locally, in a limited area. In the case of the casino games you only need to remember what's happening while the game is actually underway. Once your guest leaves the table the game is over and this can all be forgotten. In the case of the lift you'll use the memory while actually in the lift (and perhaps in the rooms which the lift visits), but away from the lift they can be forgotten. This is in contradistinction to global memory use, that you want to remember permanently, for example if your Place has its own internal currency.
In general, you've got several things in your Place that you want to keep track of, but that you only need to remember locally. So use the same memory for all of them. Have one memory, called Local say, which you can use in all of these situations and more if you so wish.
The important thing to remember is to keep each separate use of your Local memory isolated from all the others. Set the memory as your guest enters these areas, as it could be anything otherwise, depending on what they've been up to previously. Have each of your casino games in its own separate room, and have one Set Memory contraption in the casino itself to set your Local memory to zero. In each room that the lift visits set Local to the code for that floor. It should be set on entering, as opposed to leaving, although the two will mostly tend to be the same. There are two reasons for this. Firstly, if you make a mistake somewhere1), then it will be a lot easier to find and correct if the mistake's going to show up in the same place as the program is. Secondly, what happens if a guest decides to suddenly leave your Place and go straight to the map? They'll probably bypass all your careful Memory Isolation programs.
In future pages of tutorials and guides we may refer to this concept, and specify whether a particular use of memory is local or global.
That's the end of the introduction to memories. To go further now we need to consider some advanced techniques. In particular, programs with several different outcomes, and using the Run Program Contraption.
See next memories tutorial.
Return to the previous memories tutorial.
Return to Places overview.