Skip to content

Commit 8e246d9

Browse files
committed
update CoolMaze
1 parent b9e3fab commit 8e246d9

2 files changed

Lines changed: 10 additions & 26 deletions

File tree

src/main/java/org/teachingextensions/logo/utils/MazeUtils/CoolMaze.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public CoolMaze(int mazeComplexity)
2222
}
2323
public void drawWallsAndStartAndEndPoints()
2424
{
25-
Color colorOfStartAndEndPoints = StdDraw.RED;
25+
Color colorOfStartAndEndPoints = StdDraw.GREEN;
2626
StdDraw.setPenColor(colorOfStartAndEndPoints);
2727
createAndSizeStartPoint();
2828
createAndSizeEndPoint();
@@ -98,29 +98,29 @@ else if (r == 3 && !visited[x - 1][y])
9898
}
9999
private void renderCorrectSolveDots(int x, int y)
100100
{
101-
Color colorOfCorrectSolvePath = StdDraw.BLUE;
101+
Color colorOfCorrectSolvePath = StdDraw.BOOK_BLUE;
102102
StdDraw.setPenColor(colorOfCorrectSolvePath);
103-
drawAndSizeSolvePath(x, y);
103+
drawAndSizeSolvePathPoints(x, y);
104104
StdDraw.show(30);
105105
}
106106
private void renderIncorrectSolveDots(int x, int y)
107107
{
108-
Color colorOfIncorrectSolvePath = StdDraw.GRAY;
108+
Color colorOfIncorrectSolvePath = StdDraw.LIGHT_GRAY;
109109
StdDraw.setPenColor(colorOfIncorrectSolvePath);
110-
drawAndSizeSolvePath(x, y);
110+
drawAndSizeSolvePathPoints(x, y);
111111
StdDraw.show(30);
112112
}
113-
private void drawAndSizeSolvePath(int x, int y)
113+
private void drawAndSizeSolvePathPoints(int x, int y)
114114
{
115-
StdDraw.filledCircle(x + 0.5, y + 0.5, 0.25);
115+
StdDraw.filledCircle(x + 0.5, y + 0.5, 0.225);
116116
}
117117
private void createAndSizeEndPoint()
118118
{
119-
StdDraw.filledCircle(mazeComplexity / 2.0 + 0.5, mazeComplexity / 2.0 + 0.5, 0.375);
119+
StdDraw.filledCircle(mazeComplexity / 2.0 + 0.5, mazeComplexity / 2.0 + 0.5, 0.35);
120120
}
121121
private void createAndSizeStartPoint()
122122
{
123-
StdDraw.filledCircle(1.5, 1.5, 0.375);
123+
StdDraw.filledCircle(1.5, 1.5, 0.35);
124124
}
125125
private void drawAndColorMazeWalls()
126126
{

src/main/java/org/teachingextensions/logo/utils/MazeUtils/StdDraw.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ public final class StdDraw implements ActionListener, MouseListener, MouseMotion
437437
private static int width = DEFAULT_SIZE;
438438
private static int height = DEFAULT_SIZE;
439439
// default pen radius
440-
private static final double DEFAULT_PEN_RADIUS = 0.002;
440+
private static final double DEFAULT_PEN_RADIUS = 0.0175;
441441
// current pen radius
442442
private static double penRadius;
443443
// show we draw immediately or wait until next show?
@@ -453,18 +453,14 @@ public final class StdDraw implements ActionListener, MouseListener, MouseMotion
453453
// for synchronization
454454
private static Object mouseLock = new Object();
455455
private static Object keyLock = new Object();
456-
// default font
457456
private static final Font DEFAULT_FONT = new Font("SansSerif", Font.PLAIN, 16);
458-
// current font
459457
private static Font font;
460458
// double buffered graphics
461459
private static BufferedImage offscreenImage, onscreenImage;
462460
private static Graphics2D offscreen, onscreen;
463461
// singleton for callbacks: avoids generation of extra .class files
464462
private static StdDraw std = new StdDraw();
465-
// the frame for drawing to the screen
466463
private static JFrame frame;
467-
// mouse state
468464
private static boolean mousePressed = false;
469465
private static double mouseX = 0;
470466
private static double mouseY = 0;
@@ -1402,18 +1398,6 @@ public static void textRight(double x, double y, String text)
14021398
offscreen.drawString(text, (float) (xs - ws), (float) (ys + hs));
14031399
draw();
14041400
}
1405-
/**
1406-
* Display on screen, pause for t milliseconds, and turn on
1407-
* <em>animation mode</em>: subsequent calls to
1408-
* drawing methods such as {@code line()}, {@code circle()}, and {@code square()}
1409-
* will not be displayed on screen until the next call to {@code show()}.
1410-
* This is useful for producing animations (clearWindow the screen, draw a bunch of shapes,
1411-
* display on screen for a fixed amount of time, and repeat). It also speeds up
1412-
* drawing a huge number of shapes (call {@code show(0)} to defer drawing
1413-
* on screen, draw the shapes, and call {@code show(0)} to display them all
1414-
* on screen at once).
1415-
* @param t number of milliseconds
1416-
*/
14171401
public static void show(int t)
14181402
{
14191403
// sleep until the next time we're allowed to draw

0 commit comments

Comments
 (0)