Skip to content

Commit 81d882f

Browse files
committed
small refactoring for new recipe TKPLogo w/@samanthalangit
1 parent d827256 commit 81d882f

2 files changed

Lines changed: 46 additions & 42 deletions

File tree

  • src/main/java/org

src/main/java/org/teachingextensions/logo/utils/TKPLogoUtils/TKPLogo.java

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
import org.teachingkidsprogramming.recipes.completed.section01forloops.MakeALogo;
77

88
/**
9-
* <img src="https://avatars0.githubusercontent.com/u/4691010?v=3&s=200" style="text-align: left" alt="The TKP logo" height="50"><br/>
10-
* The TKPLogo allows you to create a TKP logo
9+
* <img src="https://avatars0.githubusercontent.com/u/4691010?v=3&s=200" style="text-align: left" alt="The TKP logo" height="40">
10+
* The TKPLogo allows <b>you</b> to create a super cool TKP logo on your window
1111
*/
1212
public class TKPLogo
1313
{
1414
/**
15-
* Sets up the Colors on the Color Wheel
15+
* Sets up a particular set of Colors on the Color Wheel
1616
* <div><b>Example:</b> {@code TKPLogo.setupColorWheel();}</div>
1717
*/
1818
public static void setupColorWheel()
@@ -27,11 +27,15 @@ public static void setupColorWheel()
2727
ColorWheel.addColor(PenColors.Oranges.Orange);
2828
ColorWheel.addColor(PenColors.Reds.Red);
2929
ColorWheel.addColor(PenColors.Whites.White);
30+
setupBackgroundAndLines();
31+
}
32+
private static void setupBackgroundAndLines()
33+
{
3034
Tortoise.getBackgroundWindow().setBackground(ColorWheel.getRandomColorFromWheel());
3135
Tortoise.setPenWidth(4);
3236
}
3337
/**
34-
* Draws an TKP inner P
38+
* Draws an <i>amazing</> TKP inner P
3539
* <div><b>Example:</b> {@code TKPLogo.draw_inner_tkp_P();}</div>
3640
*/
3741
public static void draw_inner_tkp_P()
@@ -48,7 +52,7 @@ public static void draw_inner_tkp_P()
4852
Tortoise.turn(1);
4953
}
5054
/**
51-
* Draws an TKP outer P
55+
* Draws an <i>awesome</> TKP outer P
5256
* <div><b>Example:</b> {@code TKPLogo.draw_outer_tkp_P();}</div>
5357
*/
5458
public static void draw_outer_tkp_P()
@@ -80,7 +84,7 @@ public static void draw_outer_tkp_P()
8084
Tortoise.move(43);
8185
}
8286
/**
83-
* Draws an TKP right bracket
87+
* Draws an <i>outstanding</> TKP right bracket
8488
* <div><b>Example:</b> {@code TKPLogo.drawRightBracket();}</div>
8589
*/
8690
public static void drawRightBracket()
@@ -118,7 +122,7 @@ public static void drawRightBracket()
118122
Tortoise.move(11);
119123
}
120124
/**
121-
* Draws an TKP left bracket
125+
* Draws an <i>original</> TKP left bracket
122126
* <div><b>Example:</b> {@code TKPLogo.drawLeftBracket();}</div>
123127
*/
124128
public static void drawLeftBracket()
@@ -155,7 +159,7 @@ public static void drawLeftBracket()
155159
Tortoise.move(10);
156160
}
157161
/**
158-
* Draws an TKP T
162+
* Draws an <i>incredible</> TKP T
159163
* <div><b>Example:</b> {@code TKPLogo.draw_tkp_T();}</div>
160164
*/
161165
public static void draw_tkp_T()
@@ -194,6 +198,39 @@ public static void draw_tkp_T()
194198
Tortoise.turn(90);
195199
Tortoise.move(50);
196200
}
201+
/**
202+
* Draws an <i>impressive</> TKP K
203+
* <div><b>Example:</b> {@code TKPLogo.draw_tkp_K();}</div>
204+
*/
205+
public static void draw_tkp_K()
206+
{
207+
Tortoise.setAngle(180);
208+
Tortoise.setX(MakeALogo.XValue + 150);
209+
Tortoise.setY(MakeALogo.YValue + 15);
210+
Tortoise.turn(180);
211+
Tortoise.move(200);
212+
Tortoise.turn(90);
213+
Tortoise.move(30);
214+
Tortoise.turn(90);
215+
Tortoise.move(128);
216+
Tortoise.turn(-150);
217+
Tortoise.move(70);
218+
Tortoise.turn(90);
219+
Tortoise.move(30);
220+
Tortoise.turn(90);
221+
Tortoise.move(70);
222+
Tortoise.turn(-80);
223+
Tortoise.move(80);
224+
Tortoise.turn(140);
225+
Tortoise.move(40);
226+
Tortoise.turn(40);
227+
Tortoise.move(60);
228+
Tortoise.turn(-130);
229+
Tortoise.move(45);
230+
Tortoise.turn(90);
231+
Tortoise.move(30);
232+
Tortoise.turn(2);
233+
}
197234
private static void curve6()
198235
{
199236
for (int i = 0; i < 180; i++)
@@ -250,37 +287,4 @@ private static void curve3()
250287
Tortoise.move(size);
251288
}
252289
}
253-
/**
254-
* Draws an TKP K
255-
* <div><b>Example:</b> {@code TKPLogo.draw_tkp_K();}</div>
256-
*/
257-
public static void draw_tkp_K()
258-
{
259-
Tortoise.setAngle(180);
260-
Tortoise.setX(MakeALogo.XValue + 150);
261-
Tortoise.setY(MakeALogo.YValue + 15);
262-
Tortoise.turn(180);
263-
Tortoise.move(200);
264-
Tortoise.turn(90);
265-
Tortoise.move(30);
266-
Tortoise.turn(90);
267-
Tortoise.move(128);
268-
Tortoise.turn(-150);
269-
Tortoise.move(70);
270-
Tortoise.turn(90);
271-
Tortoise.move(30);
272-
Tortoise.turn(90);
273-
Tortoise.move(70);
274-
Tortoise.turn(-80);
275-
Tortoise.move(80);
276-
Tortoise.turn(140);
277-
Tortoise.move(40);
278-
Tortoise.turn(40);
279-
Tortoise.move(60);
280-
Tortoise.turn(-130);
281-
Tortoise.move(45);
282-
Tortoise.turn(90);
283-
Tortoise.move(30);
284-
Tortoise.turn(2);
285-
}
286290
}

src/main/java/org/teachingkidsprogramming/section01forloops/Spiral.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public static void main(String[] args)
88
{
99
// Show the tortoise --#1
1010
// Make the tortoise go as fast as possible --#4
11-
// Add Blue Violet to the Color Wheel --#7 HINT: Use the TKPLogo object
11+
// Add Blue Violet to the Color Wheel --#7 HINT: Use the ColorWheel object
1212
// Add Violet to the Color Wheel --#8
1313
// Add Purple to the Color Wheel --#9
1414
// Do the following 75 times --#3.1

0 commit comments

Comments
 (0)