09 Enhance
Now that you have a working basic program, here are modifications you can make:
-
World 3 refuses to change its color.
-
Pick one world (by id number) to be the “random world” (R-world). The R-world changes its color randomly when asked to change. That is, no matter what message is sent to the R-world, it changes to a random color. This is most interesting with 3 or more worlds.
-
Add “spam” functionality (also called “broadcast”), so that one world can set the colors of all other worlds at once. Here is one way to do this:
- Hitting the “spam” key (“s”) sends a message to world number negative one (-1). That means pick a world number like $-1$ that no world will actually have, and use it for a special purpose.
- Receiving a message to world number $-1$ affects every word. A conditional in your receive handler can do this.
-
Add an “all randomize” key (“t”). Send a special message that causes every world to randomize its color.