Skip to content

Commit

Permalink
Merge branch 'main' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurich84 committed Feb 8, 2024
2 parents 0ac2e9f + be02c22 commit ba54c44
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 25 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# word-search-game
# Word-search game

This template should help get you started developing with Vue 3 in Vite.
This project is made entirely in Vue 3 (composition API).

### Main advantages:
- **Lightweight**: minimal libraries, just vue3 and sass
- **Responsive**: without using canvas

Try it: https://yurich84.github.io/word-search-game/

## Recommended IDE Setup

Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
<title>Word-search game</title>
</head>
<body>
<div id="app"></div>
Expand Down
1 change: 0 additions & 1 deletion src/assets/logo.svg

This file was deleted.

10 changes: 5 additions & 5 deletions src/components/CoreGame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ function wordSelectStop(event) {
return
}
let word = props.words.find(item => item.value === selected.join(''));
let word = props.words.find(item => item === selected.join(''));
let x_start = selectedCells.value[0]?.x
let y_start = selectedCells.value[0]?.y
let x_end = selectedCells.value[selectedCells.value.length - 1].x
let y_end = selectedCells.value[selectedCells.value.length - 1].y
if (!word) {
const selected_word = selected.reverse().join('')
word = props.words.find(item => item.value === selected_word)
word = props.words.find(item => item === selected_word)
x_end = selectedCells.value[0]?.x
y_end = selectedCells.value[0]?.y
x_start = selectedCells.value[selectedCells.value.length - 1].x
Expand All @@ -180,7 +180,7 @@ function wordSelectStop(event) {
if (word) {
let exists = false;
foundWords.value.forEach(w => {
if (w.value === word.value) {
if (w.value === word) {
exists = true
}
})
Expand All @@ -191,11 +191,11 @@ function wordSelectStop(event) {
})
foundWords.value.push({
value: word.value,
value: word,
x_start: x_start,
y_start: y_start,
direction: wordDirection(x_start, y_start, x_end, y_end),
length: word.value.length
length: word.length
})
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/WordList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<div class="words-list">
<div
v-for="word in words"
:key="word.value"
:key="word"
class="words-list__item"
>
<span
class="words-list__value"
:class="{found: isFound(word.value)}"
:class="{found: isFound(word)}"
>
{{ word.value }}
{{ word }}
</span>
</div>
</div>
Expand All @@ -27,7 +27,7 @@ const props = defineProps({
}
})
const isFound = word => props.foundWords.find(w => w.value === word)
const isFound = word => props.foundWords.find(w => w === word)
</script>
<style lang="scss" scoped>
.words-list {
Expand Down
24 changes: 12 additions & 12 deletions src/components/WrapperGame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ const matrix = [
]
const words = [
{value: 'BARS'},
{value: 'CANDY'},
{value: 'CARROT'},
{value: 'CHEESE'},
{value: 'CHIPS'},
{value: 'COOKIES'},
{value: 'CRACKERS'},
{value: 'FRUIT'},
{value: 'GRANOLA'},
{value: 'NUTS'},
{value: 'PRETZEL'},
{value: 'YOGURT'},
'BARS',
'CANDY',
'CARROT',
'CHEESE',
'CHIPS',
'COOKIES',
'CRACKERS',
'FRUIT',
'GRANOLA',
'NUTS',
'PRETZEL',
'YOGURT',
]
</script>

0 comments on commit ba54c44

Please sign in to comment.