home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 209 / 209.d81 / t.animals < prev    next >
Text File  |  2022-08-26  |  3KB  |  92 lines

  1. u
  2.             A N I M A L S
  3.  
  4.           by M. Poultonavage
  5.  
  6.  
  7.     If you've ever been curious about
  8. how computers can be used to grow
  9. trees, this program will help you
  10. understand. Not just any tree, mind
  11. you, but binary trees or, as they are
  12. commonly called, b-trees.
  13.  
  14.     You've probably played "Twenty
  15. Questions" where you can always guess
  16. the answer if you use effective
  17. questions that rule out half of the
  18. possible answers each time. That's
  19. what a b-tree does.
  20.  
  21.     This program will allow you to
  22. create a b-tree and save it to disk in
  23. a file called "animals.dat". You
  24. should save the file every time you
  25. play the game.
  26.  
  27.     ANIMALS has a menu of options. The
  28. first time you RUN the program you
  29. will be using the data that is found
  30. at line 9000. You may want to study
  31. these statements to further understand
  32. what is going on, but it isn't really
  33. necessary since you can add to the
  34. list of animals while playing the
  35. game. Since there isn't a file called
  36. "animals.dat" on the LOADSTAR disk,
  37. don't choose 1, "read the file of
  38. animals" unless you enjoy seeing your
  39. drive light blink.
  40.  
  41.     First, choose 5 and 6 from the
  42. menu to see the animals and questions
  43. already in the program.
  44.  
  45.     Then choose 2 to play the game. It
  46. will ask if the animal you are
  47. thinking of has wings. If you say
  48. "yes" by pressing <y> it will say, "is
  49. it a duck?".  To add to the data-base,
  50. press <n> for "no" and you'll be asked
  51. for your animal. Enter the name of an
  52. animal that has wings and then enter a
  53. question that will differentiate
  54. between a duck and the animal you
  55. chose. Then choose to play again and
  56. this time your animal will be in the
  57. b-tree at a later "node" than at the
  58. "wings" branch.
  59.  
  60.     This is how you add to the b-tree.
  61. Remember to save your entries before
  62. you quit the game so that next time
  63. you can load the file. If you make a
  64. mistake and say that a snake has short
  65. feathers you can delete an animal by
  66. pressing 3 from the menu.
  67.  
  68.     This game is fun, especially for
  69. youngsters, but it's instructive to
  70. see how a binary tree is constructed.
  71. The program is DIMensioned for up to
  72. 999 animals so you can get pretty deep
  73. into the b-tree before running out of
  74. memory. The hard part will be to
  75. decide how to differentiate between
  76. animals that are very similar.
  77.  
  78.     The b-tree strategy is used in all
  79. sorts of human applications,
  80. especially in trouble-shooting, where
  81. it is sometimes called "splitting the
  82. difference".
  83.  
  84.     Once you instinctively understand
  85. the b-tree strategy, you'll become a
  86. much more effective troubleshooter,
  87. and, in a very broad sense, isn't that
  88. what life is all about?
  89.  
  90.  MP
  91.  
  92.  
  93.