Skip to content

Commit f9b637e

Browse files
committed
Add maze-generator project
1 parent 66ee43b commit f9b637e

File tree

5 files changed

+52
-1
lines changed

5 files changed

+52
-1
lines changed

src/lib/constants/books.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ export type Book = {
55
};
66

77
export const books: Book[] = [
8+
{
9+
name: 'Fear and Trembling',
10+
author: 'Søren Kierkegaard',
11+
rating: 3.75
12+
},
813
{
914
name: 'The Myth of Sisyphus',
1015
author: 'Albert Camus',

src/lib/constants/piano-pieces.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ export const pieces: Piece[] = [
6767
name: 'Mazurka Op. 7 No. 1',
6868
composer: Composer.Chopin
6969
},
70+
{
71+
name: 'Mazurka Op. 6 No. 1',
72+
composer: Composer.Chopin
73+
},
7074
{
7175
name: 'Nocturne Op. 72 No. 1',
7276
composer: Composer.Chopin
@@ -91,4 +95,6 @@ export const pieces: Piece[] = [
9195
name: 'Hungarian Sonata',
9296
composer: Composer.Clayderman
9397
}
94-
];
98+
].sort((a, b) => {
99+
return a.composer.localeCompare(b.composer) || a.name.localeCompare(b.name);
100+
});

src/lib/constants/projects.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ export const GAME_OF_LIFE = addProject({
102102
hasPage: true,
103103
notes: "An implementation of Conway's game of life"
104104
});
105+
export const MAZE_GENERATOR = addProject({
106+
label: 'Maze Generator',
107+
category: Category.Web,
108+
name: 'maze-generator',
109+
hasGithub: true,
110+
hasPage: true,
111+
notes: 'A program that generates mazes'
112+
});
105113
export const MORE_TNT = addProject({
106114
label: 'MoreTNT',
107115
category: Category.Other,
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<script lang="ts">
2+
import Project from '$lib/components/projects/Project.svelte';
3+
import Video from '$lib/components/shared/Video.svelte';
4+
import { MAZE_GENERATOR } from '$lib/constants/projects';
5+
</script>
6+
7+
<Project project={MAZE_GENERATOR}>
8+
<p>
9+
This program generates what are known as perfect mazes, meaning mazes that have one solution
10+
only. The mazes are generated using the
11+
<a
12+
target="_blank"
13+
class="text-blue-500"
14+
href="https://en.wikipedia.org/wiki/Maze_generation_algorithm#Randomized_depth-first_search"
15+
>Recursive Backtracker</a
16+
> algorithm, and the solution is drawn. You can configure the size of the maze to your liking. This
17+
program is actually very simple to replicate, and it's something that I did in a few hours because
18+
I felt like learning about maze generation. The algorithm itself is quite simple and intuitive once
19+
you understand how it works. There are different types of maze generating algorithms, but I chose
20+
this one because it is one of the simplest ones. Mazes generated with the recursive backtracker algorithm
21+
tend to have a low branching factor, which essentially means that there are not a lot of branches
22+
in the mazes, making the mazes somewhat easier to solve.
23+
</p>
24+
<p>
25+
You can try it out <a
26+
class="text-blue-500"
27+
target="_blank"
28+
href="https://discusser.is-a.dev/maze-generator/">here</a
29+
>.
30+
</p>
31+
<Video alt="A demonstration of the maze generator" src="/maze_generator.mp4" />
32+
</Project>

static/maze_generator.mp4

14 MB
Binary file not shown.

0 commit comments

Comments
 (0)