diff --git a/package-lock.json b/package-lock.json index 677acb3..e1f35df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,9 +11,6 @@ "mini-game": "file:../pkg", "phaser": "^3.86.0" }, - "bin": { - "create-wasm-app": ".bin/create-wasm-app.js" - }, "devDependencies": { "typescript": "^5.6.3", "vite": "^5.4.9" diff --git a/src/scenes/game.ts b/src/scenes/game.ts new file mode 100644 index 0000000..81f20ea --- /dev/null +++ b/src/scenes/game.ts @@ -0,0 +1,42 @@ + + +export default class SilverFangMiniGame { + cards: Number[] = [] + rows: Number = 0 + cols: Number = 0 + + + constructor() { + + + } + + recalculateBoardSize() { + const numCards = this.cards.length + + let solutions = [] + + for (let x = 1; x < numCards; x++) { + for (let y = 1; y < numCards; y++) { + if (x*y === numCards) { + solutions.push([x, y, Math.abs(x-y)]) + } + } + } + solutions.sort((a, b) => a[2] - b[2]) + solutions.forEach(s => console.log(s)) + } + + addCards(cards: Number) { + for(let i = 0; i < cards; i++) { + this.cards.push(i); + } + this.recalculateBoardSize() + } + + addPair(card: Number) { + + + } + +} \ No newline at end of file diff --git a/src/scenes/main-menu.ts b/src/scenes/main-menu.ts index 3c291d2..0b5f6e0 100644 --- a/src/scenes/main-menu.ts +++ b/src/scenes/main-menu.ts @@ -1,6 +1,7 @@ import * as Phaser from "phaser"; import Card from "../objects/card"; import GameButton from "../objects/button"; +import SilverFangMiniGame from "./game"; class MainMenuScene extends Phaser.Scene { constructor() { @@ -8,6 +9,11 @@ class MainMenuScene extends Phaser.Scene { } preload() { + for(let n = 0; n < 40; n++) { + console.log('TEST ' + n) + const g = new SilverFangMiniGame() + g.addCards(n) + } } create() {