Skip to content

Commit

Permalink
Use constants for builtin board moves
Browse files Browse the repository at this point in the history
  • Loading branch information
simlmx committed Jul 18, 2024
1 parent b28e8a8 commit a68c629
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/game/src/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from "@lefun/core";

import {
ADD_PLAYER,
Agent,
AgentGetMoveRet,
AutoMoveInfo,
Expand All @@ -23,6 +24,7 @@ import {
GameStateBase,
GetPayloadOfPlayerMove,
INIT_MOVE,
KICK_PLAYER,
MATCH_WAS_ABORTED,
parseGame,
RewardPayload,
Expand Down Expand Up @@ -269,7 +271,7 @@ export class MatchTester<
this._sameBotCount = 0;

// Make the special initial move.
this._makeBoardMove("initMove");
this._makeBoardMove(INIT_MOVE);

this._botTrainingLog = [];
this._stats = [];
Expand Down Expand Up @@ -316,7 +318,7 @@ export class MatchTester<
}

// Trigger the game's logic.
this._makeBoardMove("addPlayer", { userId });
this._makeBoardMove(ADD_PLAYER, { userId });

this.users.byId[userId] = {
username,
Expand All @@ -334,7 +336,7 @@ export class MatchTester<
const { meta, playerboards } = this;

// Trigger the game's logic.
this._makeBoardMove("kickPlayer", { userId });
this._makeBoardMove(KICK_PLAYER, { userId });

metaRemoveUserFromMatch(meta, userId);

Expand All @@ -347,7 +349,7 @@ export class MatchTester<
*/
abortMatch(): void {
this._endMatch({});
this._makeBoardMove("matchWasAborted");
this._makeBoardMove(MATCH_WAS_ABORTED);
}

/*
Expand Down

0 comments on commit a68c629

Please sign in to comment.