diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3d90887 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Server starten", + "program": "${workspaceFolder}/dist/app.js", + "preLaunchTask": "tsc: build - tsconfig.json", + "outFiles": [ + "${workspaceFolder}/dist/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3d90887 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Server starten", + "program": "${workspaceFolder}/dist/app.js", + "preLaunchTask": "tsc: build - tsconfig.json", + "outFiles": [ + "${workspaceFolder}/dist/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..e647dc2 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,22 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "problemMatcher": [ + "$tsc" + ] + }, + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "option": "watch", + "problemMatcher": [ + "$tsc-watch" + ] + } + ] +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3d90887 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Server starten", + "program": "${workspaceFolder}/dist/app.js", + "preLaunchTask": "tsc: build - tsconfig.json", + "outFiles": [ + "${workspaceFolder}/dist/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..e647dc2 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,22 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "problemMatcher": [ + "$tsc" + ] + }, + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "option": "watch", + "problemMatcher": [ + "$tsc-watch" + ] + } + ] +} \ No newline at end of file diff --git a/Labyrinth.code-workspace b/Labyrinth.code-workspace new file mode 100644 index 0000000..362d7c2 --- /dev/null +++ b/Labyrinth.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "." + } + ] +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3d90887 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Server starten", + "program": "${workspaceFolder}/dist/app.js", + "preLaunchTask": "tsc: build - tsconfig.json", + "outFiles": [ + "${workspaceFolder}/dist/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..e647dc2 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,22 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "problemMatcher": [ + "$tsc" + ] + }, + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "option": "watch", + "problemMatcher": [ + "$tsc-watch" + ] + } + ] +} \ No newline at end of file diff --git a/Labyrinth.code-workspace b/Labyrinth.code-workspace new file mode 100644 index 0000000..362d7c2 --- /dev/null +++ b/Labyrinth.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "." + } + ] +} \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..3110d0c --- /dev/null +++ b/README.MD @@ -0,0 +1,29 @@ +Labyrinth +========= + + +## Install + +Install typescript and tslint globally, if you haven't aready. +```bash +npm install -g typescript tslint +``` + +Local dependencies: +```bash +npm install +``` + +## Build + +Compile TypeScript to JavaScript. +```bash +tsc +``` + +## Run + +Run the application. +```bash +node dist/app.js +``` \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3d90887 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Server starten", + "program": "${workspaceFolder}/dist/app.js", + "preLaunchTask": "tsc: build - tsconfig.json", + "outFiles": [ + "${workspaceFolder}/dist/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..e647dc2 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,22 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "problemMatcher": [ + "$tsc" + ] + }, + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "option": "watch", + "problemMatcher": [ + "$tsc-watch" + ] + } + ] +} \ No newline at end of file diff --git a/Labyrinth.code-workspace b/Labyrinth.code-workspace new file mode 100644 index 0000000..362d7c2 --- /dev/null +++ b/Labyrinth.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "." + } + ] +} \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..3110d0c --- /dev/null +++ b/README.MD @@ -0,0 +1,29 @@ +Labyrinth +========= + + +## Install + +Install typescript and tslint globally, if you haven't aready. +```bash +npm install -g typescript tslint +``` + +Local dependencies: +```bash +npm install +``` + +## Build + +Compile TypeScript to JavaScript. +```bash +tsc +``` + +## Run + +Run the application. +```bash +node dist/app.js +``` \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..11bfc83 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "labyrinth", + "version": "0.1.0", + "lockfileVersion": 1 +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3d90887 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Server starten", + "program": "${workspaceFolder}/dist/app.js", + "preLaunchTask": "tsc: build - tsconfig.json", + "outFiles": [ + "${workspaceFolder}/dist/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..e647dc2 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,22 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "problemMatcher": [ + "$tsc" + ] + }, + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "option": "watch", + "problemMatcher": [ + "$tsc-watch" + ] + } + ] +} \ No newline at end of file diff --git a/Labyrinth.code-workspace b/Labyrinth.code-workspace new file mode 100644 index 0000000..362d7c2 --- /dev/null +++ b/Labyrinth.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "." + } + ] +} \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..3110d0c --- /dev/null +++ b/README.MD @@ -0,0 +1,29 @@ +Labyrinth +========= + + +## Install + +Install typescript and tslint globally, if you haven't aready. +```bash +npm install -g typescript tslint +``` + +Local dependencies: +```bash +npm install +``` + +## Build + +Compile TypeScript to JavaScript. +```bash +tsc +``` + +## Run + +Run the application. +```bash +node dist/app.js +``` \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..11bfc83 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "labyrinth", + "version": "0.1.0", + "lockfileVersion": 1 +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..18ea9f2 --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "labyrinth", + "version": "0.1.0", + "description": "", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Peter Zilz", + "license": "ISC", + "dependencies": {} +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3d90887 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Server starten", + "program": "${workspaceFolder}/dist/app.js", + "preLaunchTask": "tsc: build - tsconfig.json", + "outFiles": [ + "${workspaceFolder}/dist/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..e647dc2 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,22 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "problemMatcher": [ + "$tsc" + ] + }, + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "option": "watch", + "problemMatcher": [ + "$tsc-watch" + ] + } + ] +} \ No newline at end of file diff --git a/Labyrinth.code-workspace b/Labyrinth.code-workspace new file mode 100644 index 0000000..362d7c2 --- /dev/null +++ b/Labyrinth.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "." + } + ] +} \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..3110d0c --- /dev/null +++ b/README.MD @@ -0,0 +1,29 @@ +Labyrinth +========= + + +## Install + +Install typescript and tslint globally, if you haven't aready. +```bash +npm install -g typescript tslint +``` + +Local dependencies: +```bash +npm install +``` + +## Build + +Compile TypeScript to JavaScript. +```bash +tsc +``` + +## Run + +Run the application. +```bash +node dist/app.js +``` \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..11bfc83 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "labyrinth", + "version": "0.1.0", + "lockfileVersion": 1 +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..18ea9f2 --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "labyrinth", + "version": "0.1.0", + "description": "", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Peter Zilz", + "license": "ISC", + "dependencies": {} +} diff --git a/src/MazeMap.ts b/src/MazeMap.ts new file mode 100644 index 0000000..706e86b --- /dev/null +++ b/src/MazeMap.ts @@ -0,0 +1,58 @@ +export enum Direction +{ + none = 0, + top = 1 << 0, + left = 1 << 1, + bottom = 1 << 2, + right = 1 << 3, +} + +export class MazeTile +{ + public paths:Direction[]; + public id:string; + public neighbors:Map; + + constructor(id:string) + { + this.id = id; + this.paths = []; + this.neighbors = new Map(); + } + + public getRepresentation(): number + { + let output = Direction.none; + for (const dir of this.paths) { + output |= dir; + } + return output; + } +} + +export class MazeMap +{ + public id:string; + public allTiles:Map; + public cart:MazeTile[][]; + + constructor(id:string) + { + this.id = id; + this.allTiles = new Map(); + this.cart = []; + } + + public getRepresentation(): number[][] + { + const output:number[][] = []; + for (const row of this.cart) { + const newRow:number[] = []; + for (const cell of row) { + newRow.push(cell.getRepresentation()); + } + output.push(newRow); + } + return output; + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3d90887 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Server starten", + "program": "${workspaceFolder}/dist/app.js", + "preLaunchTask": "tsc: build - tsconfig.json", + "outFiles": [ + "${workspaceFolder}/dist/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..e647dc2 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,22 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "problemMatcher": [ + "$tsc" + ] + }, + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "option": "watch", + "problemMatcher": [ + "$tsc-watch" + ] + } + ] +} \ No newline at end of file diff --git a/Labyrinth.code-workspace b/Labyrinth.code-workspace new file mode 100644 index 0000000..362d7c2 --- /dev/null +++ b/Labyrinth.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "." + } + ] +} \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..3110d0c --- /dev/null +++ b/README.MD @@ -0,0 +1,29 @@ +Labyrinth +========= + + +## Install + +Install typescript and tslint globally, if you haven't aready. +```bash +npm install -g typescript tslint +``` + +Local dependencies: +```bash +npm install +``` + +## Build + +Compile TypeScript to JavaScript. +```bash +tsc +``` + +## Run + +Run the application. +```bash +node dist/app.js +``` \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..11bfc83 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "labyrinth", + "version": "0.1.0", + "lockfileVersion": 1 +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..18ea9f2 --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "labyrinth", + "version": "0.1.0", + "description": "", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Peter Zilz", + "license": "ISC", + "dependencies": {} +} diff --git a/src/MazeMap.ts b/src/MazeMap.ts new file mode 100644 index 0000000..706e86b --- /dev/null +++ b/src/MazeMap.ts @@ -0,0 +1,58 @@ +export enum Direction +{ + none = 0, + top = 1 << 0, + left = 1 << 1, + bottom = 1 << 2, + right = 1 << 3, +} + +export class MazeTile +{ + public paths:Direction[]; + public id:string; + public neighbors:Map; + + constructor(id:string) + { + this.id = id; + this.paths = []; + this.neighbors = new Map(); + } + + public getRepresentation(): number + { + let output = Direction.none; + for (const dir of this.paths) { + output |= dir; + } + return output; + } +} + +export class MazeMap +{ + public id:string; + public allTiles:Map; + public cart:MazeTile[][]; + + constructor(id:string) + { + this.id = id; + this.allTiles = new Map(); + this.cart = []; + } + + public getRepresentation(): number[][] + { + const output:number[][] = []; + for (const row of this.cart) { + const newRow:number[] = []; + for (const cell of row) { + newRow.push(cell.getRepresentation()); + } + output.push(newRow); + } + return output; + } +} diff --git a/src/app.ts b/src/app.ts new file mode 100644 index 0000000..70884ec --- /dev/null +++ b/src/app.ts @@ -0,0 +1,3 @@ +"use strict"; + +console.log("Hello world!"); diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3d90887 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Server starten", + "program": "${workspaceFolder}/dist/app.js", + "preLaunchTask": "tsc: build - tsconfig.json", + "outFiles": [ + "${workspaceFolder}/dist/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..e647dc2 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,22 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "problemMatcher": [ + "$tsc" + ] + }, + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "option": "watch", + "problemMatcher": [ + "$tsc-watch" + ] + } + ] +} \ No newline at end of file diff --git a/Labyrinth.code-workspace b/Labyrinth.code-workspace new file mode 100644 index 0000000..362d7c2 --- /dev/null +++ b/Labyrinth.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "." + } + ] +} \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..3110d0c --- /dev/null +++ b/README.MD @@ -0,0 +1,29 @@ +Labyrinth +========= + + +## Install + +Install typescript and tslint globally, if you haven't aready. +```bash +npm install -g typescript tslint +``` + +Local dependencies: +```bash +npm install +``` + +## Build + +Compile TypeScript to JavaScript. +```bash +tsc +``` + +## Run + +Run the application. +```bash +node dist/app.js +``` \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..11bfc83 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "labyrinth", + "version": "0.1.0", + "lockfileVersion": 1 +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..18ea9f2 --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "labyrinth", + "version": "0.1.0", + "description": "", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Peter Zilz", + "license": "ISC", + "dependencies": {} +} diff --git a/src/MazeMap.ts b/src/MazeMap.ts new file mode 100644 index 0000000..706e86b --- /dev/null +++ b/src/MazeMap.ts @@ -0,0 +1,58 @@ +export enum Direction +{ + none = 0, + top = 1 << 0, + left = 1 << 1, + bottom = 1 << 2, + right = 1 << 3, +} + +export class MazeTile +{ + public paths:Direction[]; + public id:string; + public neighbors:Map; + + constructor(id:string) + { + this.id = id; + this.paths = []; + this.neighbors = new Map(); + } + + public getRepresentation(): number + { + let output = Direction.none; + for (const dir of this.paths) { + output |= dir; + } + return output; + } +} + +export class MazeMap +{ + public id:string; + public allTiles:Map; + public cart:MazeTile[][]; + + constructor(id:string) + { + this.id = id; + this.allTiles = new Map(); + this.cart = []; + } + + public getRepresentation(): number[][] + { + const output:number[][] = []; + for (const row of this.cart) { + const newRow:number[] = []; + for (const cell of row) { + newRow.push(cell.getRepresentation()); + } + output.push(newRow); + } + return output; + } +} diff --git a/src/app.ts b/src/app.ts new file mode 100644 index 0000000..70884ec --- /dev/null +++ b/src/app.ts @@ -0,0 +1,3 @@ +"use strict"; + +console.log("Hello world!"); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..069b4c9 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "outDir": "dist", + "sourceMap": true + }, + "include": [ + "src/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3d90887 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Server starten", + "program": "${workspaceFolder}/dist/app.js", + "preLaunchTask": "tsc: build - tsconfig.json", + "outFiles": [ + "${workspaceFolder}/dist/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..e647dc2 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,22 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "problemMatcher": [ + "$tsc" + ] + }, + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "option": "watch", + "problemMatcher": [ + "$tsc-watch" + ] + } + ] +} \ No newline at end of file diff --git a/Labyrinth.code-workspace b/Labyrinth.code-workspace new file mode 100644 index 0000000..362d7c2 --- /dev/null +++ b/Labyrinth.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "." + } + ] +} \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..3110d0c --- /dev/null +++ b/README.MD @@ -0,0 +1,29 @@ +Labyrinth +========= + + +## Install + +Install typescript and tslint globally, if you haven't aready. +```bash +npm install -g typescript tslint +``` + +Local dependencies: +```bash +npm install +``` + +## Build + +Compile TypeScript to JavaScript. +```bash +tsc +``` + +## Run + +Run the application. +```bash +node dist/app.js +``` \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..11bfc83 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "labyrinth", + "version": "0.1.0", + "lockfileVersion": 1 +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..18ea9f2 --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "labyrinth", + "version": "0.1.0", + "description": "", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Peter Zilz", + "license": "ISC", + "dependencies": {} +} diff --git a/src/MazeMap.ts b/src/MazeMap.ts new file mode 100644 index 0000000..706e86b --- /dev/null +++ b/src/MazeMap.ts @@ -0,0 +1,58 @@ +export enum Direction +{ + none = 0, + top = 1 << 0, + left = 1 << 1, + bottom = 1 << 2, + right = 1 << 3, +} + +export class MazeTile +{ + public paths:Direction[]; + public id:string; + public neighbors:Map; + + constructor(id:string) + { + this.id = id; + this.paths = []; + this.neighbors = new Map(); + } + + public getRepresentation(): number + { + let output = Direction.none; + for (const dir of this.paths) { + output |= dir; + } + return output; + } +} + +export class MazeMap +{ + public id:string; + public allTiles:Map; + public cart:MazeTile[][]; + + constructor(id:string) + { + this.id = id; + this.allTiles = new Map(); + this.cart = []; + } + + public getRepresentation(): number[][] + { + const output:number[][] = []; + for (const row of this.cart) { + const newRow:number[] = []; + for (const cell of row) { + newRow.push(cell.getRepresentation()); + } + output.push(newRow); + } + return output; + } +} diff --git a/src/app.ts b/src/app.ts new file mode 100644 index 0000000..70884ec --- /dev/null +++ b/src/app.ts @@ -0,0 +1,3 @@ +"use strict"; + +console.log("Hello world!"); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..069b4c9 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "outDir": "dist", + "sourceMap": true + }, + "include": [ + "src/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000..58f9a35 --- /dev/null +++ b/tslint.json @@ -0,0 +1,21 @@ +{ + "defaultSeverity": "error", + "extends": [ + "tslint:recommended" + ], + "jsRules": {}, + "rules": { + "no-console": false, + "one-line":false, + "typedef-whitespace":false, + "whitespace": false, + "no-bitwise": false, + "max-classes-per-file":false + }, + "rulesDirectory": [], + "linterOptions": { + "exclude": [ + "node_modules" + ] + } +} \ No newline at end of file