@@ -2,15 +2,13 @@ import { Constants } from './hlt/Constants';
22import { Direction } from './hlt/Direction' ;
33import { Logging } from './hlt/Logging' ;
44import { Game } from './hlt/Game' ;
5- import { GameMap } from './hlt/GameMap' ;
6- import { Player } from "./hlt/Player" ;
75import { Random } from './hlt/Random' ;
86
97const firstArgument = process . argv [ 2 ] ;
108const random = new Random ( firstArgument ? Number ( firstArgument ) : 324231 ) ;
119
1210const game = new Game ( ) ;
13- game . initialize ( ) . then ( async ( ) => {
11+ game . initialize ( ) . then ( async ( [ gameMap , me ] ) => {
1412 // At this point "game" variable is populated with initial map data.
1513 // This is a good place to do computationally expensive start-up pre-processing.
1614 // As soon as you call "ready" function below, the 2 second per turn timer will start.
@@ -21,12 +19,6 @@ game.initialize().then(async () => {
2119 while ( true ) {
2220 await game . updateFrame ( ) ;
2321
24- const gameMap = game . gameMap ;
25- const me = game . me ;
26- if ( ! ( gameMap instanceof GameMap ) || ! ( me instanceof Player ) ) {
27- throw "Game not initialized properly!" ;
28- }
29-
3022 const commandQueue = [ ] ;
3123
3224 // Movement algorithm parameters
@@ -49,7 +41,9 @@ game.initialize().then(async () => {
4941 const safeMove = gameMap . naiveNavigate ( ship , destination ) ;
5042 commandQueue . push ( ship . move ( safeMove ) ) ;
5143 }
52- // Keep still and harvest in place
44+ else {
45+ // Keep still and harvest in place
46+ }
5347 }
5448
5549 if ( game . turnNumber < spawnNewShipsUntilGameTurnCoefficient * Constants . MAX_TURNS &&
0 commit comments