refactored GameImpl into multiple files

This commit is contained in:
evanpelle
2024-09-17 19:49:16 -07:00
parent 44877b8e59
commit f3307300ef
35 changed files with 360 additions and 344 deletions
@@ -1,4 +1,4 @@
import {AllianceRequest, Execution, MutableGame, MutablePlayer, Player, PlayerID} from "../Game";
import {AllianceRequest, Execution, MutableGame, MutablePlayer, Player, PlayerID} from "../game/Game";
export class AllianceRequestExecution implements Execution {
private active = true
@@ -17,7 +17,7 @@ export class AllianceRequestExecution implements Execution {
tick(ticks: number): void {
alert('recied request')
this.active = false
}
+2 -2
View File
@@ -1,8 +1,8 @@
import {PriorityQueue} from "@datastructures-js/priority-queue";
import {Cell, Execution, MutableGame, MutablePlayer, PlayerID, TerrainType, TerraNullius, Tile} from "../Game";
import {Cell, Execution, MutableGame, MutablePlayer, PlayerID, TerrainType, TerraNullius, Tile} from "../game/Game";
import {PseudoRandom} from "../PseudoRandom";
import {manhattanDist} from "../Util";
import {Terrain} from "../TerrainMapLoader";
import {Terrain} from "../game/TerrainMapLoader";
export class AttackExecution implements Execution {
private active: boolean = true;
+1 -1
View File
@@ -1,5 +1,5 @@
import {PriorityQueue} from "@datastructures-js/priority-queue";
import {Boat, Cell, Execution, MutableBoat, MutableGame, MutablePlayer, Player, PlayerID, TerraNullius, Tile, TileEvent} from "../Game";
import {Boat, Cell, Execution, MutableBoat, MutableGame, MutablePlayer, Player, PlayerID, TerraNullius, Tile, TileEvent} from "../game/Game";
import {manhattanDist, manhattanDistWrapped} from "../Util";
import {AttackExecution} from "./AttackExecution";
import {Config} from "../configuration/Config";
+1 -1
View File
@@ -1,4 +1,4 @@
import {Cell, Execution, MutableGame, MutablePlayer, Player, PlayerID, PlayerInfo, PlayerType, TerraNullius} from "../Game"
import {Cell, Execution, MutableGame, MutablePlayer, Player, PlayerID, PlayerInfo, PlayerType, TerraNullius} from "../game/Game"
import {PseudoRandom} from "../PseudoRandom"
import {simpleHash} from "../Util";
import {AttackExecution} from "./AttackExecution";
+1 -1
View File
@@ -1,4 +1,4 @@
import {Cell, Game, PlayerType, Tile, TileEvent} from "../Game";
import {Cell, Game, PlayerType, Tile, TileEvent} from "../game/Game";
import {PseudoRandom} from "../PseudoRandom";
import {SpawnIntent} from "../Schemas";
import {bfs, dist as dist, manhattanDist} from "../Util";
+1 -1
View File
@@ -1,4 +1,4 @@
import {Cell, Execution, MutableGame, Game, MutablePlayer, PlayerInfo, TerraNullius, Tile, PlayerType, Alliance} from "../Game";
import {Cell, Execution, MutableGame, Game, MutablePlayer, PlayerInfo, TerraNullius, Tile, PlayerType, Alliance} from "../game/Game";
import {AttackIntent, BoatAttackIntentSchema, GameID, Intent, Turn} from "../Schemas";
import {AttackExecution} from "./AttackExecution";
import {SpawnExecution} from "./SpawnExecution";
+1 -1
View File
@@ -1,4 +1,4 @@
import {Cell, Execution, MutableGame, MutablePlayer, Player, PlayerID, PlayerInfo, PlayerType, TerrainType, TerraNullius, Tile} from "../Game"
import {Cell, Execution, MutableGame, MutablePlayer, Player, PlayerID, PlayerInfo, PlayerType, TerrainType, TerraNullius, Tile} from "../game/Game"
import {PseudoRandom} from "../PseudoRandom"
import {and, bfs, dist, simpleHash} from "../Util";
import {AttackExecution} from "./AttackExecution";
+2 -2
View File
@@ -1,7 +1,7 @@
import {Config} from "../configuration/Config"
import {Execution, MutableGame, MutablePlayer, Player, PlayerID, TerraNullius, Tile} from "../Game"
import {Execution, MutableGame, MutablePlayer, Player, PlayerID, TerraNullius, Tile} from "../game/Game"
import {bfs, calculateBoundingBox, getMode, inscribed, simpleHash} from "../Util"
import {GameImpl} from "../GameImpl"
import {GameImpl} from "../game/GameImpl"
export class PlayerExecution implements Execution {
+1 -1
View File
@@ -1,4 +1,4 @@
import {Cell, Execution, MutableGame, MutablePlayer, PlayerInfo, PlayerType} from "../Game"
import {Cell, Execution, MutableGame, MutablePlayer, PlayerInfo, PlayerType} from "../game/Game"
import {BotExecution} from "./BotExecution"
import {PlayerExecution} from "./PlayerExecution"
import {getSpawnCells} from "./Util"
+1 -1
View File
@@ -1,4 +1,4 @@
import {Execution, MutableGame, MutablePlayer, PlayerID} from "../Game"
import {Execution, MutableGame, MutablePlayer, PlayerID} from "../game/Game"
import {ClientID} from "../Schemas"
export class UpdateNameExecution implements Execution {
+1 -1
View File
@@ -1,4 +1,4 @@
import {Game, Cell} from "../Game";
import {Game, Cell} from "../game/Game";
export function getSpawnCells(gs: Game, cell: Cell): Cell[] {
+1 -1
View File
@@ -1,5 +1,5 @@
import {EventBus, GameEvent} from "../EventBus"
import {Execution, MutableGame, MutablePlayer, Player, PlayerID} from "../Game"
import {Execution, MutableGame, MutablePlayer, Player, PlayerID} from "../game/Game"
export class WinEvent implements GameEvent {
constructor(public readonly winner: Player) { }