Skip to content

Commit f0e3725

Browse files
committed
updated TurtleTree w/Hashmap
1 parent eff8b19 commit f0e3725

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/org/teachingkidsprogramming/section05recursion/TurtleTree.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package org.teachingkidsprogramming.section05recursion;
22

3+
import java.awt.Color;
4+
import java.util.HashMap;
5+
36
public class TurtleTree
47
{
58
public static void main(String[] args)
@@ -12,13 +15,14 @@ public static void main(String[] args)
1215
// ------------- Recipe for drawBranch --#2.2
1316
// If the current branch length is greater than zero, do the rest of this recipe --#5
1417
// adjustColor (recipe below)--#15.1
15-
// ------------- Recipe for adjustColor --#15.2
18+
// ------------- Recipe for adjustColor --#15.2 (this recipe uses the HashMap)
19+
HashMap<Integer, Color> colors = new HashMap<Integer, Color>();
1620
// A 10 pixel long branch is lime --#20
1721
// A 20 pixel long branch is forest green --#19
1822
// A 30 pixel long branch is dark green --#18
1923
// A 40 pixel long branch is olive --#17
2024
// A 50 pixel long branch is sienna --#14
21-
// A 60 pixel long branch is saddle brown --#13
25+
// A 60 pixel long branch is saddle brown --#13 (TIP: put the values into the HashMap)
2226
// ------------- End of adjustColor --#15.3
2327
//
2428
// Move the tortoise the length of the current branch --#1.1

0 commit comments

Comments
 (0)