From 44538e726a10513a8116bfa918d307b1d688a194 Mon Sep 17 00:00:00 2001 From: Dennis Date: Sun, 25 Jan 2026 19:15:26 +0100 Subject: [PATCH 1/4] Setup problem --- Problems/Reach-Exit/README.md | 31 ++++++++++++++++++++++++++ Problems/Reach-Exit/reach-exit.test.ts | 28 +++++++++++++++++++++++ Problems/Reach-Exit/solver.ts | 3 +++ 3 files changed, 62 insertions(+) create mode 100644 Problems/Reach-Exit/README.md create mode 100644 Problems/Reach-Exit/reach-exit.test.ts create mode 100644 Problems/Reach-Exit/solver.ts diff --git a/Problems/Reach-Exit/README.md b/Problems/Reach-Exit/README.md new file mode 100644 index 0000000..b38df9b --- /dev/null +++ b/Problems/Reach-Exit/README.md @@ -0,0 +1,31 @@ +# Reach Exit + +Your given a 2D maze and you need to check if it is possible to reach the exit. + +## Infos which are maybe needed + +Each cell is one of the following symbols: + +- `.` Empty space (Can walk here) +- `#` wall (Can not walk here) +- `@` start position +- `E` exit + +## Documentation + +### Solution Idea + +The Idea to solve this problem + +--- + +### [Implementation](./solver.ts) + +The implementation for solving this problem + +--- + +### Information's + +This problem comes from the newsletter [Sloth Bytes](https://slothbytes.beehiiv.com). +[Post](https://slothbytes.beehiiv.com/p/your-projects-probably-suck) from November 12, 2025. diff --git a/Problems/Reach-Exit/reach-exit.test.ts b/Problems/Reach-Exit/reach-exit.test.ts new file mode 100644 index 0000000..18c246b --- /dev/null +++ b/Problems/Reach-Exit/reach-exit.test.ts @@ -0,0 +1,28 @@ +import { describe, expect, it } from "vitest"; +import canReachExit from "./solver"; + +describe("The Maze can be exit", () => { + const mazeOne = ["@..", ".#E", "..."]; + + it("should return true for the first maze", () => { + expect(canReachExit(mazeOne)).toEqual(true); + }); + + const mazeTwo = ["@#E"]; + + it("should return false for the second maze", () => { + expect(canReachExit(mazeTwo)).toEqual(false); + }); + + const mazeThree = ["@.#.", "..#E", "####"]; + + it("should return false for the third maze", () => { + expect(canReachExit(mazeThree)).toEqual(false); + }); + + const mazeFour = ["@...", ".###", "...E"]; + + it("should return true for the fourth maze", () => { + expect(canReachExit(mazeFour)).toEqual(true); + }); +}); diff --git a/Problems/Reach-Exit/solver.ts b/Problems/Reach-Exit/solver.ts new file mode 100644 index 0000000..e8dbcc4 --- /dev/null +++ b/Problems/Reach-Exit/solver.ts @@ -0,0 +1,3 @@ +export default function canReachExit(_maze: string[]): boolean { + throw new Error("Solution yet not implemented!"); +} From 18c9f4e7443dd03b4037285a7d9532632a88858c Mon Sep 17 00:00:00 2001 From: Dennis Date: Mon, 9 Feb 2026 15:47:56 +0100 Subject: [PATCH 2/4] Start working on solution --- Problems/Reach-Exit/solver.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Problems/Reach-Exit/solver.ts b/Problems/Reach-Exit/solver.ts index e8dbcc4..f0108d9 100644 --- a/Problems/Reach-Exit/solver.ts +++ b/Problems/Reach-Exit/solver.ts @@ -1,3 +1,10 @@ -export default function canReachExit(_maze: string[]): boolean { - throw new Error("Solution yet not implemented!"); +const symbole = [".", "#", "@", "E"]; + +export default function canReachExit(givenMaze: string[]): boolean { + const maze: string[][] = givenMaze.map((val) => val.split("")); + + // Input checking + if (maze.reduce((pre, cur) => (!pre ? false : cur.length !== maze[0].length), true)) return false; + + return false; } From e6ddeb0a821d113839344c20187a0351e1718b29 Mon Sep 17 00:00:00 2001 From: Dennis Date: Mon, 9 Feb 2026 15:51:10 +0100 Subject: [PATCH 3/4] Added new Workflow for updating the Package version --- .github/workflows/update-version.yml | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/update-version.yml diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml new file mode 100644 index 0000000..874226f --- /dev/null +++ b/.github/workflows/update-version.yml @@ -0,0 +1,43 @@ +name: Update Package Version + +on: + push: + branches: + - main + - master + +permissions: + contents: write + +jobs: + update-version: + if: github.actor != 'github-actions[bot]' + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Sync version to problem count + run: | + COUNT=$(find Problems -mindepth 1 -maxdepth 1 -type d | wc -l | tr -d ' ') + NEW_VERSION="CP-${COUNT}" + CURRENT_VERSION=$(jq -r '.version' package.json) + + echo "Current version: ${CURRENT_VERSION}" + echo "New version: ${NEW_VERSION}" + + if [ "$CURRENT_VERSION" = "$NEW_VERSION" ]; then + echo "Version already up to date." + exit 0 + fi + + jq --arg v "$NEW_VERSION" '.version=$v' package.json > package.json.tmp + mv package.json.tmp package.json + + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + git add package.json + git commit -m "chore: sync version to problem count [skip ci]" + git push From 9fbe18c355a534d73e5aac67decf8a2e014e2a7f Mon Sep 17 00:00:00 2001 From: Dennis Date: Mon, 9 Feb 2026 15:52:38 +0100 Subject: [PATCH 4/4] Removed Problem form different branch --- Problems/Reach-Exit/README.md | 31 -------------------------- Problems/Reach-Exit/reach-exit.test.ts | 28 ----------------------- Problems/Reach-Exit/solver.ts | 10 --------- 3 files changed, 69 deletions(-) delete mode 100644 Problems/Reach-Exit/README.md delete mode 100644 Problems/Reach-Exit/reach-exit.test.ts delete mode 100644 Problems/Reach-Exit/solver.ts diff --git a/Problems/Reach-Exit/README.md b/Problems/Reach-Exit/README.md deleted file mode 100644 index b38df9b..0000000 --- a/Problems/Reach-Exit/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Reach Exit - -Your given a 2D maze and you need to check if it is possible to reach the exit. - -## Infos which are maybe needed - -Each cell is one of the following symbols: - -- `.` Empty space (Can walk here) -- `#` wall (Can not walk here) -- `@` start position -- `E` exit - -## Documentation - -### Solution Idea - -The Idea to solve this problem - ---- - -### [Implementation](./solver.ts) - -The implementation for solving this problem - ---- - -### Information's - -This problem comes from the newsletter [Sloth Bytes](https://slothbytes.beehiiv.com). -[Post](https://slothbytes.beehiiv.com/p/your-projects-probably-suck) from November 12, 2025. diff --git a/Problems/Reach-Exit/reach-exit.test.ts b/Problems/Reach-Exit/reach-exit.test.ts deleted file mode 100644 index 18c246b..0000000 --- a/Problems/Reach-Exit/reach-exit.test.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { describe, expect, it } from "vitest"; -import canReachExit from "./solver"; - -describe("The Maze can be exit", () => { - const mazeOne = ["@..", ".#E", "..."]; - - it("should return true for the first maze", () => { - expect(canReachExit(mazeOne)).toEqual(true); - }); - - const mazeTwo = ["@#E"]; - - it("should return false for the second maze", () => { - expect(canReachExit(mazeTwo)).toEqual(false); - }); - - const mazeThree = ["@.#.", "..#E", "####"]; - - it("should return false for the third maze", () => { - expect(canReachExit(mazeThree)).toEqual(false); - }); - - const mazeFour = ["@...", ".###", "...E"]; - - it("should return true for the fourth maze", () => { - expect(canReachExit(mazeFour)).toEqual(true); - }); -}); diff --git a/Problems/Reach-Exit/solver.ts b/Problems/Reach-Exit/solver.ts deleted file mode 100644 index f0108d9..0000000 --- a/Problems/Reach-Exit/solver.ts +++ /dev/null @@ -1,10 +0,0 @@ -const symbole = [".", "#", "@", "E"]; - -export default function canReachExit(givenMaze: string[]): boolean { - const maze: string[][] = givenMaze.map((val) => val.split("")); - - // Input checking - if (maze.reduce((pre, cur) => (!pre ? false : cur.length !== maze[0].length), true)) return false; - - return false; -}