Skip to content

Commit

Permalink
Update point system
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkiro committed Apr 6, 2024
1 parent 953d564 commit 215f4e0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/lib/settings.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
export const gameSize = 7;
export const alphabet: Set<string> = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""));
export const points: Record<number, number> = {
2: 2,
3: 2,
4: 5,
5: 10,
6: 20,
7: 30,
};
6 changes: 3 additions & 3 deletions src/views/GameView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<button v-if="!gameEnd" class="top-icon brutal-border bg-white" title="Give up" @click="giveUp = true">
🏁
</button>
<button v-else class="top-icon brutal-border bg-white" title="New game" @click="resetGame">⟳</button>
<button v-else-if="!game" class="top-icon brutal-border bg-white" title="New game" @click="resetGame">⟳</button>
<router-link :to="{ name: 'home' }" class="top-icon brutal-border bg-dark-peach">X</router-link>
</div>
</div>
Expand Down Expand Up @@ -39,7 +39,7 @@ import { animateShake, animateWiggle } from "@/lib/animations";
import { difference, isSuperset, randomChoice, shuffle } from "@/lib/utils";
import GameKeyboard from "@/components/GameKeyboard.vue";
import UserInput from "@/components/UserInput.vue";
import { alphabet, gameSize } from "@/lib/settings";
import { alphabet, gameSize, points } from "@/lib/settings";
export default defineComponent({
components: { UserInput, GameKeyboard, FoundWordList },
Expand Down Expand Up @@ -84,7 +84,7 @@ export default defineComponent({
score() {
let result = 0;
for (const word of this.foundWords) {
result += word.length;
result += points[word.length] ?? 0;
}
return result;
},
Expand Down
3 changes: 2 additions & 1 deletion src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ main {
}
dialog form {
flex-grow: 1;
display: flex;
flex-direction: column;
justify-content: center;
justify-content: space-between;
align-items: center;
gap: 2rem;
}
Expand Down

0 comments on commit 215f4e0

Please sign in to comment.