feature/pathfinding-finetuning #11

Merged
lobo merged 3 commits from feature/pathfinding-finetuning into main 2026-02-05 09:25:41 +01:00
4 changed files with 22 additions and 32 deletions
Showing only changes of commit 38bf7edd53 - Show all commits

View File

@@ -66,7 +66,7 @@
</mat-card>
<mat-card class="experdience">
<h2>{{ 'ABOUT.SECTION.EXPERIENCE' | translate }}</h2>
<h2 style="margin-left: 0.5rem;">{{ 'ABOUT.SECTION.EXPERIENCE' | translate }}</h2>
<div class="xp-list">
@for (entry of xpKeys; track entry.key) {
<div class="xp-item">

View File

@@ -47,7 +47,6 @@
/* Skills block */
.skills {
padding: 5px;
h2 { margin-top: .25rem; margin-left: .25rem; }
.chip-groups {
margin-left: .25rem;
@@ -64,11 +63,7 @@
/* Experience block */
.experience {
padding: 5px;
h2 { margin-top: .25rem;margin-left: .25rem; }
.xp-list {
margin-left: .25rem;
display: grid; gap: .75rem;
}
h2 { margin-top: .25rem; margin-left: .25rem; }
.xp-item {
.xp-head {
display:flex; align-items:baseline; gap:.5rem;

View File

@@ -23,8 +23,8 @@
<div class="controls-container">
<div class="controls">
<button matButton="filled" (click)="visualizeDijkstra()">{{ 'PATHFINDING.DIJKSTRA' | translate }}</button>
<button matButton="filled" (click)="visualizeAStar()">{{ 'PATHFINDING.ASTAR' | translate }}</button>
<button matButton="filled" (click)="visualize('dijkstra')">{{ 'PATHFINDING.DIJKSTRA' | translate }}</button>
<button matButton="filled" (click)="visualize('astar')">{{ 'PATHFINDING.ASTAR' | translate }}</button>
</div>
<div class="controls">
<button matButton="filled" (click)="normalCase()">{{ 'PATHFINDING.NORMAL_CASE' | translate }}</button>

View File

@@ -136,7 +136,7 @@ export class PathfindingComponent implements AfterViewInit {
this.drawGrid();
}
visualizeDijkstra(): void {
visualize(algorithm: string): void {
if (!this.ensureStartAndEnd()) {
return;
}
@@ -145,33 +145,28 @@ export class PathfindingComponent implements AfterViewInit {
this.clearPath();
const startTime = performance.now();
const result = this.pathfindingService.dijkstra(
this.grid,
this.grid[this.startNode!.row][this.startNode!.col],
this.grid[this.endNode!.row][this.endNode!.col]
);
const endTime = performance.now();
let result;
this.pathLength = result.nodesInShortestPathOrder.length;
this.executionTime = endTime - startTime;
switch (algorithm) {
case 'dijkstra': result = this.pathfindingService.dijkstra(
this.grid,
this.grid[this.startNode!.row][this.startNode!.col],
this.grid[this.endNode!.row][this.endNode!.col]
);
break;
case 'astar': result = this.pathfindingService.aStar(
this.grid,
this.grid[this.startNode!.row][this.startNode!.col],
this.grid[this.endNode!.row][this.endNode!.col]
);
break;
}
this.animateAlgorithm(result.visitedNodesInOrder, result.nodesInShortestPathOrder);
}
visualizeAStar(): void {
if (!this.ensureStartAndEnd()) {
if (!result)
{
return;
}
this.stopAnimations();
this.clearPath();
const startTime = performance.now();
const result = this.pathfindingService.aStar(
this.grid,
this.grid[this.startNode!.row][this.startNode!.col],
this.grid[this.endNode!.row][this.endNode!.col]
);
const endTime = performance.now();
this.pathLength = result.nodesInShortestPathOrder.length;