A Recipe for Playing the Game of AnimalDid you ever play the game of Animal, where one person thinks of an animal and another person has to guess it? This Recipe simulates the game with a State Machine. Though it only understands a very limited number of guesses (just one - the right answer), it never gets bored. And it's an interesting example of a State Machine in action. Each time you enter a guess, the State Machine checks to see if it is the right answer. If it is, it congratulates you. If it isn't, it tells you that as well. The State Machine has two visible terminals - a "guess" terminal for inputting your guesses, and an "output" termininal where it gives you its answers. Click on the "guess" terminal to input a guess. Note that all your guesses should be enclosed in quotes. Once you get the answer, trying editing the State Machine table file ("animal_game_table.yaml") and changing it so the correct guess is a different animal. You can find the Animal game Script and table files in the Scripts "examples" area. The Script is called "animal_game.script". Just click on its "Run" action to start it running. Then start playing it by navigating to the Device Explorer page. The Animal Game ScriptThe Script for the Animal game is as follows (for reference only):
|