File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/org/teachingkidsprogramming/section05recursion Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11package org .teachingkidsprogramming .section05recursion ;
22
3+ import java .awt .Color ;
4+ import java .util .HashMap ;
5+
36public 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
You can’t perform that action at this time.
0 commit comments