diff --git a/cra-hive/package-lock.json b/cra-hive/package-lock.json index 3c7c70a..6a7888c 100644 --- a/cra-hive/package-lock.json +++ b/cra-hive/package-lock.json @@ -7874,9 +7874,9 @@ } }, "node_modules/eventsource": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.1.0.tgz", - "integrity": "sha512-VSJjT5oCNrFvCS6igjzPAt5hBzQ2qPBFIbJ03zLI9SE0mxwZpMw6BfJrbFHm1a141AavMEB8JHmBhWAd66PfCg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.1.1.tgz", + "integrity": "sha512-qV5ZC0h7jYIAOhArFJgSfdyz6rALJyb270714o7ZtNnw2WSJ+eexhKtE0O8LYPRsHZHf2osHKZBxGPvm3kPkCA==", "dependencies": { "original": "^1.0.0" }, @@ -26150,9 +26150,9 @@ "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==" }, "eventsource": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.1.0.tgz", - "integrity": "sha512-VSJjT5oCNrFvCS6igjzPAt5hBzQ2qPBFIbJ03zLI9SE0mxwZpMw6BfJrbFHm1a141AavMEB8JHmBhWAd66PfCg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.1.1.tgz", + "integrity": "sha512-qV5ZC0h7jYIAOhArFJgSfdyz6rALJyb270714o7ZtNnw2WSJ+eexhKtE0O8LYPRsHZHf2osHKZBxGPvm3kPkCA==", "requires": { "original": "^1.0.0" } @@ -27517,8 +27517,7 @@ "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==" }, "immer": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/immer/-/immer-8.0.1.tgz", + "version": "https://registry.npmjs.org/immer/-/immer-8.0.1.tgz", "integrity": "sha512-aqXhGP7//Gui2+UrEtvxZxSquQVXTpZ7KDxfCcKAF3Vysvw0CViVaW9RZ1j1xlIYqaaaipBoqdqeibkc18PNvA==" }, "import-cwd": { diff --git a/cra-hive/src/client/components/WelcomeInsect.tsx b/cra-hive/src/client/components/WelcomeInsect.tsx index 1ee88b0..42150a4 100644 --- a/cra-hive/src/client/components/WelcomeInsect.tsx +++ b/cra-hive/src/client/components/WelcomeInsect.tsx @@ -10,9 +10,9 @@ export default function WelcomeInsect() { + hex={new HEX.Hex(0, 0)} + stone={{ "team": "white", "insect": "bee" }} + /> ) diff --git a/cra-hive/src/client/lab/BackgroundCanvas.tsx b/cra-hive/src/client/lab/BackgroundCanvas.tsx index b51a563..9bfa911 100644 --- a/cra-hive/src/client/lab/BackgroundCanvas.tsx +++ b/cra-hive/src/client/lab/BackgroundCanvas.tsx @@ -4,7 +4,7 @@ import { State } from '../../shared/model/state' const orientation = HEX.orientation_pointy; -const layout = HEX.Layout(orientation, HEX.Point(10, 10), HEX.Point(500, 250)) +const layout = HEX.Layout(orientation, new HEX.Point(10, 10), new HEX.Point(500, 250)) export default function BackgroundCanvas() { const state = new State(); @@ -17,7 +17,7 @@ export default function BackgroundCanvas() { ctx.beginPath() const corners = HEX.polygon_corners(layout, hex); ctx.moveTo(corners[5].x + 50, corners[5].y + 50); - corners.forEach( p => { + corners.forEach(p => { ctx.lineTo(p.x + 50, p.y + 50); }) ctx.fill(); diff --git a/cra-hive/src/client/pages/TutorialPage.tsx b/cra-hive/src/client/pages/TutorialPage.tsx index 0c27aaf..3d58c79 100644 --- a/cra-hive/src/client/pages/TutorialPage.tsx +++ b/cra-hive/src/client/pages/TutorialPage.tsx @@ -6,11 +6,11 @@ import Insect from '../../shared/model/insects' import Team from '../../shared/model/teams' import { Drop } from '../../shared/model/action' import TestGame from '../lab/TestGame'; -import {Hex} from '../../shared/hexlib' -import {DropInsectMenuTeam, iconMap} from '../components/DropInsectMenu' +import { Hex } from '../../shared/hexlib' +import { DropInsectMenuTeam, iconMap } from '../components/DropInsectMenu' import { Button } from 'semantic-ui-react' -export default function TutorialPage () { +export default function TutorialPage() { // Idea: define terms // Make chapers: click to next page // Boxes for emphasis @@ -41,70 +41,70 @@ export default function TutorialPage () { } -function TutorialLayout({left, right}) { +function TutorialLayout({ left, right }) { return
-
- {left} -
-
- {right} -
+
+ {left}
+
+ {right} +
+
} function Introduction() { const state = new State(); - state.apply(new Drop(new Stone(Insect.GRASSHOPPER, Team.WHITE), Hex(0, 0))); - state.apply(new Drop(new Stone(Insect.ANT, Team.BLACK), Hex(1, 0))); + state.apply(new Drop(new Stone(Insect.GRASSHOPPER, Team.WHITE), new Hex(0, 0))); + state.apply(new Drop(new Stone(Insect.ANT, Team.BLACK), new Hex(1, 0))); const left = <>

Introduction

- Hive is a strategic boardgame for two players (red and blue). - Each turn they can either place or move a stone on the board. We will refer to placing an insect as "dropping". - We will call the stones "insects" from now on. Each of the insects - has its own set of rules how to move. - In the beginning there is void and the starting player can select any of his insects to drop.; - const right = ; + Hive is a strategic boardgame for two players (red and blue). + Each turn they can either place or move a stone on the board. We will refer to placing an insect as "dropping". + We will call the stones "insects" from now on. Each of the insects + has its own set of rules how to move. + In the beginning there is void and the starting player can select any of his insects to drop.; + const right = ; return } function Dropping() { const state = new State(); - state.apply(new Drop(new Stone(Insect.GRASSHOPPER, Team.WHITE), Hex(0, 0))); - state.apply(new Drop(new Stone(Insect.ANT, Team.BLACK), Hex(1, 0))); + state.apply(new Drop(new Stone(Insect.GRASSHOPPER, Team.WHITE), new Hex(0, 0))); + state.apply(new Drop(new Stone(Insect.ANT, Team.BLACK), new Hex(1, 0))); const left = <> -

Dropping

- - You can select an insect from this menu to drop. Note the numbers denoting how many of each type you still have available. - ; +

Dropping

+ + You can select an insect from this menu to drop. Note the numbers denoting how many of each type you still have available. + ; const right = [h, 0])} - canvasHeight="200px" interactive={false} cameraOpts={ {position: [0, -3, 4]} } />; + team={state.team} + highlighted={state.generateDrops().map(h => [h, 0])} + canvasHeight="200px" interactive={false} cameraOpts={{ position: [0, -3, 4] }} />; return } function GoalOfGame() { const hive = new HiveModel(); - hive.addStone(Hex(0, 0), new Stone(Insect.GRASSHOPPER, Team.WHITE)); - hive.addStone(Hex(1, 0), new Stone(Insect.BEE, Team.BLACK)); - hive.addStone(Hex(0, 1), new Stone(Insect.BEE, Team.WHITE)); - hive.addStone(Hex(1, 1), new Stone(Insect.ANT, Team.BLACK)); - hive.addStone(Hex(1, -1), new Stone(Insect.SPIDER, Team.WHITE)); - hive.addStone(Hex(2, 0), new Stone(Insect.BEETLE, Team.BLACK)); - hive.addStone(Hex(2, -1), new Stone(Insect.ANT, Team.WHITE)); + hive.addStone(new Hex(0, 0), new Stone(Insect.GRASSHOPPER, Team.WHITE)); + hive.addStone(new Hex(1, 0), new Stone(Insect.BEE, Team.BLACK)); + hive.addStone(new Hex(0, 1), new Stone(Insect.BEE, Team.WHITE)); + hive.addStone(new Hex(1, 1), new Stone(Insect.ANT, Team.BLACK)); + hive.addStone(new Hex(1, -1), new Stone(Insect.SPIDER, Team.WHITE)); + hive.addStone(new Hex(2, 0), new Stone(Insect.BEETLE, Team.BLACK)); + hive.addStone(new Hex(2, -1), new Stone(Insect.ANT, Team.WHITE)); const left = <> -

The Goal of the Game

-

The goal of the game is to surround the bee