Skip to content

Commit 1c51dfe

Browse files
committed
removed comments
1 parent abdddae commit 1c51dfe

File tree

5 files changed

+37
-27
lines changed

5 files changed

+37
-27
lines changed

CHANGELOG.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,22 @@ All notable changes to this project will be documented in this file.
66

77
### Added
88

9-
- Added mouse drag support to change the tile type.
10-
- Icons for each tile type.
11-
- Added Mage creation timer.
12-
- Added Mage solving by Ai timer. Meaning how long it takes for the Ai to reach the goal graphically.
13-
- Added counter for each tile type.
9+
- Mouse drag support for tile type changes.
10+
- Unique icons for each tile type.
11+
- Counter for each tile type. (Shows the number of tiles of each type)
12+
- Timer 1 - Time took for the user to create mage.
13+
- Timer 2 - Time took for the AI to solve the Mage solution (duration for AI to **graphically** reach the goal).
1414

15-
### Changed
15+
### Changed
1616

17+
- "No Path Found" message now centrally aligned on screen.
18+
- Optimized initial rendering speed for the ant image.
1719
- Button placement from right column to top row.
20+
- Adjusted ant's speed consistency across different tile type.
21+
22+
### Fixed
23+
24+
- Crash issue when "Search" button is clicked a second time without resetting.
1825

1926
### removed
2027

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,6 @@ In all cases, once the commands are followed, the Java application packaged insi
189189
```
190190
3. Enter your password when prompted.
191191

192+
## Team
193+
- Tahsin Ridwan Pulok (@tahsinpulok)[https://github.com/tahsinpulok] - collaboration, providing assets and new feature/UI ideas.
194+
- Saif Mahmud (@vmsaif)[https://github.com/vmsaif]

src/AStarSearch.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ public LinkedList<Tile> reconstructPath(Tile current) {
176176
LinkedList<Tile> path = new LinkedList<>();
177177
while (current != null) {
178178
path.add(current);
179-
System.out.println(current);
180-
179+
181180
// move to the previous node
182181
current = current.getCameFrom();
183182
}

src/Game.java

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ public Game(JFrame frame) {
132132
searchButton(); // returning the button to enable the button after search
133133
resetButton(); // it will enable the search button after reseting the game
134134

135-
// load food image
136-
// loadFoodImg();
137-
138135
// Add the button panel
139136
add(buttonPanel, BorderLayout.NORTH);
140137
setPreferredSize(new Dimension(getPreferredSize().width + 200, getPreferredSize().height));
@@ -383,7 +380,6 @@ private void handleStartLocationSelection(Tile clickedTile) {
383380
grasslandCount = 0;
384381
openTerrainCount = 0;
385382

386-
387383
// Set the clicked tile as the start location
388384
clickedTile.setStart();
389385
startTile = clickedTile;
@@ -557,8 +553,7 @@ public void animateAnt() {
557553
ant.setX(path.get(path.size() - 1).getXpixel());
558554
ant.setY(path.get(path.size() - 1).getYpixel());
559555

560-
561-
556+
// start the timer
562557
Timer timer = new Timer(delay, new ActionListener() {
563558
int i;
564559
double speed;
@@ -614,9 +609,9 @@ private double setSpeed(Tile nextTile) {
614609
double output = Tile.COST_SWAMPLAND; // highest cost 4 for open terrain
615610

616611
if(nextTile.isSwampland()){
617-
output = (output/Tile.COST_SWAMPLAND) + 0.25; // 1.25
612+
output = (output/Tile.COST_SWAMPLAND) + 0.5; // 1.25
618613
} else if(nextTile.isGrassland()){
619-
output = output*2/Tile.COST_GRASSLAND + 0.5; // 3.16
614+
output = output*2/Tile.COST_GRASSLAND + 0.5; // 2.5
620615
}
621616

622617
return output;
@@ -643,20 +638,21 @@ protected void paintComponent(Graphics g) {
643638

644639
printIfNoPath(g);
645640

646-
647641
// Draw the elapsed time
648642
g.setColor(Color.RED); // Sets the color to red.
649643
g.setFont(new Font("Courier New", Font.PLAIN, 20));
650-
g.drawString("Mage Create: "+elapsedTimeStringBeforeSearch, timerX, timerY);
651-
g.drawString("Solved Time: "+elapsedTimeStringAfterAnimation, timerX, timerY + 20);
644+
g.drawString("Mage Create: " + elapsedTimeStringBeforeSearch, timerX, timerY);
645+
g.drawString("Solved Time: " + elapsedTimeStringAfterAnimation, timerX, timerY + 20);
652646

653647
// draw the counts of each terrain
654648
g.setColor(Color.BLACK);
655649
g.setFont(new Font("Courier New", Font.PLAIN, 20));
656-
g.drawString("Obstacle: "+obstacleCount, terrainCountX, terrainCountY);
657-
g.drawString("Swampland: "+swamplandCount, terrainCountX, terrainCountY + 20);
658-
g.drawString("Grassland: "+grasslandCount, terrainCountX, terrainCountY + 40);
659-
g.drawString("Open Terrain: "+openTerrainCount, terrainCountX, terrainCountY + 60);
650+
g.drawString("Grid Settings: " + NUM_ROWS + " x " + NUM_COLS, terrainCountX, terrainCountY-20);
651+
g.drawString("Open Terrain: " + openTerrainCount, terrainCountX, terrainCountY + 0);
652+
g.drawString("Obstacle: "+ obstacleCount, terrainCountX, terrainCountY + 20);
653+
g.drawString("Swampland: " + swamplandCount, terrainCountX, terrainCountY + 40);
654+
g.drawString("Grassland: " + grasslandCount, terrainCountX, terrainCountY + 60);
655+
660656

661657

662658
} // end paintComponent
@@ -704,6 +700,15 @@ private void printBoardAndCount(Graphics g) {
704700
}
705701
}
706702
}
703+
704+
if(startTile != null){
705+
openTerrain--;
706+
}
707+
708+
if(goalTile != null){
709+
openTerrain--;
710+
}
711+
707712
obstacleCount = obstacle;
708713
swamplandCount = swampland;
709714
grasslandCount = grassland;

src/Tile.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55

66
import java.awt.Color;
77
import java.awt.Graphics;
8-
import java.awt.Image;
9-
import java.io.IOException;
10-
11-
import javax.imageio.ImageIO;
128

139
public class Tile implements Comparable<Tile> {
1410
public static final double COST_OPEN_TERRAIN = 1;

0 commit comments

Comments
 (0)