Skip to content

Commit 0baf2f4

Browse files
committed
Merges
1 parent 89eafab commit 0baf2f4

File tree

98 files changed

+41
-4042
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+41
-4042
lines changed
Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
11
package org.teachingextensions.logo;
22

3-
import org.teachingextensions.approvals.lite.util.ObjectUtils;
3+
import java.awt.Dimension;
4+
import java.awt.Graphics2D;
5+
import java.awt.Image;
6+
import java.awt.Point;
47

5-
import java.awt.*;
8+
import org.teachingextensions.approvals.lite.util.ObjectUtils;
69

710
/**
811
* A tile is a square on the board with an image on it.
912
*/
10-
public class Tile {
11-
private static final String[] resources = {
12-
"Batgirl1a.png", "Batgirl2a.png", "Batgirl3a.png",
13-
"Batgirl1b.png", "Batgirl2b.png", "Batgirl3b.png",
14-
"Batgirl1c.png", "Batgirl2c.png", "Batgirl3c.png"
15-
};
16-
17-
private static final Point origin = new Point(35, 35);
18-
19-
private final Image image;
20-
private final Dimension dimension = new Dimension(122, 122);
21-
private Point position;
22-
private Point target;
23-
24-
public Tile(int cell, int image) {
13+
public class Tile
14+
{
15+
private static final String[] resources = {"Batgirl1a.png",
16+
"Batgirl2a.png",
17+
"Batgirl3a.png",
18+
"Batgirl1b.png",
19+
"Batgirl2b.png",
20+
"Batgirl3b.png",
21+
"Batgirl1c.png",
22+
"Batgirl2c.png",
23+
"Batgirl3c.png" };
24+
private static final Point origin = new Point(35, 35);
25+
private final Image image;
26+
private final Dimension dimension = new Dimension(122, 122);
27+
private Point position;
28+
private Point target;
29+
public Tile(int cell, int image)
30+
{
2531
this.position = getPosition(cell);
2632
this.image = getImage(image);
2733
}
28-
29-
public static Point getPosition(int cell) {
34+
public static Point getPosition(int cell)
35+
{
3036
Point offset = Puzzle.getPosition(cell);
3137
return new Point(origin.x + (127 * offset.x), origin.y + (127 * offset.y));
3238
}
33-
34-
private static Image getImage(int image) {
39+
private static Image getImage(int image)
40+
{
3541
return ObjectUtils.loadImage(Tile.class, resources[image]);
3642
}
37-
38-
private static int stepTowardGoal(int current, int goal) {
39-
if (current < goal) {
40-
return current + 1;
41-
}
42-
if (goal < current) {
43-
return current - 1;
44-
}
43+
private static int stepTowardGoal(int current, int goal)
44+
{
45+
if (current < goal) { return current + 1; }
46+
if (goal < current) { return current - 1; }
4547
return current;
4648
}
47-
48-
public void paint(Graphics2D g2d) {
49-
g2d.drawImage(this.image, this.position.x, this.position.y, this.dimension.width, this.dimension.height,
50-
null);
49+
public void paint(Graphics2D g2d)
50+
{
51+
g2d.drawImage(this.image, this.position.x, this.position.y, this.dimension.width, this.dimension.height, null);
5152
}
52-
53-
public boolean isAtTarget() {
54-
return target == null ||
55-
(target.x == position.x && target.y == position.y);
53+
public boolean isAtTarget()
54+
{
55+
return target == null || (target.x == position.x && target.y == position.y);
5656
}
57-
58-
public void step() {
57+
public void step()
58+
{
5959
int x = stepTowardGoal(position.x, target.x);
6060
int y = stepTowardGoal(position.y, target.y);
6161
this.position = new Point(x, y);
6262
}
63-
64-
public void moveTo(Point goal) {
63+
public void moveTo(Point goal)
64+
{
6565
target = goal;
6666
}
6767
}

src/org/teachingkidsprogramming/recipes/inDevelopment/SpiderWebQuiz.java renamed to src/main/java/org/teachingkidsprogramming/recipes/inDevelopment/SpiderWebQuiz.java

File renamed without changes.

src/main/java/org/teachingkidsprogramming/section08tdd/SimplePuzzle.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import javax.swing.UIManager;
88
import javax.swing.UnsupportedLookAndFeelException;
99

10-
import org.teachingextensions.approvals.lite.util.MySystem;
1110
import org.teachingextensions.logo.AStarPlayer;
1211
import org.teachingextensions.logo.Puzzle;
1312
import org.teachingextensions.logo.PuzzleAnimation;
@@ -44,7 +43,6 @@ public void run()
4443
// int[] cells = {0, 1, 2, 3, 4, 5, 6, 7, 8};
4544
// int[] shuffled = shuffled(cells);
4645
int[] shuffled = {5, 6, 2, 4, 1, 8, 7, 0, 3}; // known to be solvable
47-
MySystem.message(Arrays.toString(shuffled));
4846
Puzzle puzzle = new Puzzle(shuffled);
4947
PuzzlePlayer player = new AStarPlayer(puzzle);
5048
PuzzleState solution = player.solve();

src/org/teachingextensions/approvals/lite/ApprovalApprover.java

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/org/teachingextensions/approvals/lite/ApprovalFailureOverrider.java

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/org/teachingextensions/approvals/lite/ApprovalFailureReporter.java

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/org/teachingextensions/approvals/lite/ApprovalReporterWithCleanUp.java

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/org/teachingextensions/approvals/lite/ApprovalWriter.java

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/org/teachingextensions/approvals/lite/Approvals.java

Lines changed: 0 additions & 104 deletions
This file was deleted.

src/org/teachingextensions/approvals/lite/FileApprover.java

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)