<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="et">
	<id>http://www.lambda.ee/w/index.php?action=history&amp;feed=atom&amp;title=BinaryTrees.txt</id>
	<title>BinaryTrees.txt - Redigeerimiste ajalugu</title>
	<link rel="self" type="application/atom+xml" href="http://www.lambda.ee/w/index.php?action=history&amp;feed=atom&amp;title=BinaryTrees.txt"/>
	<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=BinaryTrees.txt&amp;action=history"/>
	<updated>2026-11-07T01:31:55Z</updated>
	<subtitle>Selle lehekülje redigeerimiste ajalugu</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=BinaryTrees.txt&amp;diff=11085&amp;oldid=prev</id>
		<title>Tammet: Uus lehekülg: &#039;&lt;pre&gt;  { This program defines several subroutines.   It does not produce any picture when it   is run.  After it is run, use the   command &quot;testTree&quot; in the xTurtle applet&#039;s   te...&#039;</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=BinaryTrees.txt&amp;diff=11085&amp;oldid=prev"/>
		<updated>2013-11-22T11:11:37Z</updated>

		<summary type="html">&lt;p&gt;Uus lehekülg: &amp;#039;&amp;lt;pre&amp;gt;  { This program defines several subroutines.   It does not produce any picture when it   is run.  After it is run, use the   command &amp;quot;testTree&amp;quot; in the xTurtle applet&amp;#039;s   te...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Uus lehekülg&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{ This program defines several subroutines.&lt;br /&gt;
  It does not produce any picture when it&lt;br /&gt;
  is run.  After it is run, use the&lt;br /&gt;
  command &amp;quot;testTree&amp;quot; in the xTurtle applet&amp;#039;s&lt;br /&gt;
  text-input box. }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SUB Tree(size, complexity)&lt;br /&gt;
&lt;br /&gt;
 { This recursive subroutine (from Figure 7.8&lt;br /&gt;
   of &amp;quot;The Most Complex Machine&amp;quot;) draws a &lt;br /&gt;
   binary tree.  The height of the tree&lt;br /&gt;
   is given, approximately, by the parameter&lt;br /&gt;
   &amp;quot;size&amp;quot;; the number of levels of branching&lt;br /&gt;
   is given by the parameter &amp;quot;complexity.&amp;quot;&lt;br /&gt;
   After the tree is drawn, the turtle is left&lt;br /&gt;
   at its original position and heading. }&lt;br /&gt;
&lt;br /&gt;
   IF complexity = 0 THEN&lt;br /&gt;
      forward(size)&lt;br /&gt;
      back(size)&lt;br /&gt;
   ELSE &lt;br /&gt;
      forward(size/2)&lt;br /&gt;
      turn(45)&lt;br /&gt;
      Tree(size/2, complexity - 1)&lt;br /&gt;
      turn(-90)&lt;br /&gt;
      Tree(size/2, complexity - 1)&lt;br /&gt;
      turn(45)&lt;br /&gt;
      back(size/2)&lt;br /&gt;
   END IF&lt;br /&gt;
&lt;br /&gt;
END SUB&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SUB TestTree&lt;br /&gt;
 &lt;br /&gt;
 { This subroutine can be called to draw&lt;br /&gt;
   sample trees.  The user is asked to&lt;br /&gt;
   specify the complexity. }&lt;br /&gt;
&lt;br /&gt;
   DECLARE complexity&lt;br /&gt;
&lt;br /&gt;
   AskUser(&amp;quot;What level of complexity do you want (0 to 12)?&amp;quot;, complexity)&lt;br /&gt;
&lt;br /&gt;
   { Adjust the complexity to a reasonable value. }&lt;br /&gt;
   complexity := trunc(complexity)&lt;br /&gt;
   IF complexity &amp;lt; 0 THEN&lt;br /&gt;
      complexity := 0&lt;br /&gt;
      TellUser(&amp;quot;Using complexity = 0.&amp;quot;)&lt;br /&gt;
   END IF&lt;br /&gt;
   IF complexity &amp;gt; 12 THEN&lt;br /&gt;
      complexity := 12&lt;br /&gt;
      TellUser(&amp;quot;Using complexity = 12.&amp;quot;)&lt;br /&gt;
   END IF&lt;br /&gt;
&lt;br /&gt;
   penUp        { Move to starting position. }&lt;br /&gt;
   MoveTo(0,-9)&lt;br /&gt;
   penDown&lt;br /&gt;
   face(90)&lt;br /&gt;
   clear&lt;br /&gt;
&lt;br /&gt;
   Tree(18,complexity)  { Draw the tree. }&lt;br /&gt;
&lt;br /&gt;
END SUB&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tammet</name></author>
	</entry>
</feed>