-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from aglgit/main
Merge main to deploy
- Loading branch information
Showing
13 changed files
with
431 additions
and
270 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Voltorb Flip | ||
|
||
This is a project for me to learn HTML, CSS and JavaScript/TypeScript. | ||
|
||
It is heavily based on Voltorb Flip by [Brandon Stein](https://voltorbflip.brandon-stein.com/) as well as the [original game](https://bulbapedia.bulbagarden.net/wiki/Voltorb_Flip). |
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
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,10 +1,12 @@ | ||
import BoardCalculator from "./board/boardCalculator"; | ||
import BoardContainer from "./board/boardContainer"; | ||
import BoardGenerator from "./board/boardGenerator"; | ||
import BoardListener from "./board/boardListener"; | ||
import BoardRenderer from "./board/boardRenderer"; | ||
import BoardState from "./board/boardState"; | ||
|
||
const generator = new BoardGenerator(); | ||
const calculator = new BoardCalculator(); | ||
const listener = new BoardListener(); | ||
const game = new BoardContainer(generator, calculator, listener); | ||
game.renderGame(); | ||
const state = new BoardState(generator, calculator); | ||
const listener = new BoardListener(state); | ||
const renderer = new BoardRenderer(listener, state); | ||
renderer.firstRenderGame(); |
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,33 @@ | ||
import { expect, test } from "vitest"; | ||
import BoardGenerator from "@src/board/boardGenerator"; | ||
import BoardCalculator from "../boardCalculator"; | ||
import BoardState from "../boardState"; | ||
|
||
const boardGenerator: BoardGenerator = new BoardGenerator(); | ||
const boardCalculator: BoardCalculator = new BoardCalculator(); | ||
const boardState: BoardState = new BoardState(boardGenerator, boardCalculator); | ||
|
||
test("Reset board ensures correct state", () => { | ||
boardState.gameOver = true; | ||
boardState.coinsThisLevel = 300; | ||
boardState.selectedTile = boardState.grid[1][1]; | ||
boardState.selectedRow = 1; | ||
boardState.selectedCol = 1; | ||
|
||
boardState.resetBoard(); | ||
|
||
expect(boardState.gameOver).toBe(false); | ||
expect(boardState.coinsThisLevel).toBe(0); | ||
expect(boardState.selectedTile).toBe(boardState.grid[0][0]); | ||
expect(boardState.selectedRow).toBe(0); | ||
expect(boardState.selectedCol).toBe(0); | ||
}); | ||
|
||
test("Toggle memo flips value", () => { | ||
boardState.memoMode = true; | ||
|
||
boardState.toggleMemoMode(); | ||
expect(boardState.memoMode).toBe(false); | ||
boardState.toggleMemoMode(); | ||
expect(boardState.memoMode).toBe(true); | ||
}); |
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
Oops, something went wrong.