-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee68f7c
commit 42ce09a
Showing
7 changed files
with
112 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,7 @@ | ||
<template> | ||
<div id="app"> | ||
<div id="nav"> | ||
<router-link to="/">Home</router-link> | | ||
<router-link to="/about">About</router-link> | ||
</div> | ||
<router-view/> | ||
<router-view /> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss"> | ||
#app { | ||
font-family: Avenir, Helvetica, Arial, sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
text-align: center; | ||
color: #2c3e50; | ||
} | ||
#nav { | ||
padding: 30px; | ||
a { | ||
font-weight: bold; | ||
color: #2c3e50; | ||
&.router-link-exact-active { | ||
color: #42b983; | ||
} | ||
} | ||
} | ||
</style> | ||
<style lang="scss"></style> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<template> | ||
<div | ||
class="node" | ||
:class="[ | ||
node.isFinish ? 'finish-node' : '', | ||
node.isStart ? 'start-node' : '', | ||
]" | ||
></div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: ["node"], | ||
}; | ||
</script> | ||
|
||
<style> | ||
.node { | ||
height: 25px; | ||
width: 25px; | ||
outline: 1px solid rgb(192, 191, 191); | ||
display: inline-block; | ||
} | ||
.finish-node { | ||
background: red; | ||
} | ||
.start-node { | ||
background: green; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,19 @@ | ||
import Vue from 'vue' | ||
import VueRouter from 'vue-router' | ||
import Home from '../views/Home.vue' | ||
import Vue from "vue"; | ||
import VueRouter from "vue-router"; | ||
import PathfindingVisualizer from "../views/PathfindingVisualizer"; | ||
|
||
Vue.use(VueRouter) | ||
Vue.use(VueRouter); | ||
|
||
const routes = [ | ||
{ | ||
path: '/', | ||
name: 'Home', | ||
component: Home | ||
name: "Pathfinding Visializer", | ||
path: "/", | ||
component: PathfindingVisualizer, | ||
}, | ||
{ | ||
path: '/about', | ||
name: 'About', | ||
// route level code-splitting | ||
// this generates a separate chunk (about.[hash].js) for this route | ||
// which is lazy-loaded when the route is visited. | ||
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue') | ||
} | ||
] | ||
]; | ||
|
||
const router = new VueRouter({ | ||
routes | ||
}) | ||
routes, | ||
}); | ||
|
||
export default router | ||
export default router; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<template> | ||
<div class="container"> | ||
<div class="grid" v-for="(row, rowIndex) in grid" :key="rowIndex"> | ||
<Node v-for="(col, colIndex) in row" :key="colIndex" :node="col"></Node> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import Node from "../components/Node.vue"; | ||
export default { | ||
components: { Node }, | ||
data() { | ||
return { | ||
START_NODE_ROW: 10, | ||
START_NODE_COL: 10, | ||
FINISH_NODE_ROW: 15, | ||
FINISH_NODE_COL: 15, | ||
grid: [], | ||
}; | ||
}, | ||
methods: { | ||
getInitialGrid() { | ||
const grid = []; | ||
for (let row = 0; row < 30; row++) { | ||
const currentRow = []; | ||
for (let col = 0; col < 30; col++) { | ||
currentRow.push(this.createNode(col, row)); | ||
} | ||
grid.push(currentRow); | ||
} | ||
return grid; | ||
}, | ||
createNode(col, row) { | ||
return { | ||
col, | ||
row, | ||
isStart: row === this.START_NODE_ROW && col === this.START_NODE_COL, | ||
isFinish: row === this.FINISH_NODE_ROW && col === this.FINISH_NODE_COL, | ||
isVisited: false, | ||
isWall: false, | ||
previousNode: null, | ||
}; | ||
}, | ||
}, | ||
mounted() { | ||
this.grid = this.getInitialGrid(); | ||
}, | ||
}; | ||
</script> | ||
|
||
<style> | ||
.grid { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
.container { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
align-items: center; | ||
margin-top: 200px; | ||
} | ||
</style> |