Skip to content

Commit 60fa8f7

Browse files
committed
Removed the need for redundant typechecks.
Added an empty else to make block for eventual user code.
1 parent 812bf18 commit 60fa8f7

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

starter_kits/TypeScript/MyBot.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ import { Constants } from './hlt/Constants';
22
import { Direction } from './hlt/Direction';
33
import { Logging } from './hlt/Logging';
44
import { Game } from './hlt/Game';
5-
import { GameMap } from './hlt/GameMap';
6-
import { Player } from "./hlt/Player";
75
import { Random } from './hlt/Random';
86

97
const firstArgument = process.argv[2];
108
const random = new Random(firstArgument ? Number(firstArgument) : 324231);
119

1210
const 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

Comments
 (0)