Skip to content

Commit 1401734

Browse files
cleanup & remove console log
1 parent 77432a8 commit 1401734

File tree

3 files changed

+1
-24
lines changed

3 files changed

+1
-24
lines changed

src/commandDetails/games/connectFour.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { container } from '@sapphire/framework';
2-
import { User } from 'discord.js';
32
import {
43
CodeyCommandDetails,
54
CodeyCommandOptionType,
@@ -8,22 +7,18 @@ import {
87
SapphireMessageExecuteType,
98
SapphireMessageResponseWithMetadata,
109
} from '../../codeyCommand';
11-
import { getCoinBalanceByUserId } from '../../components/coin';
12-
import { getCoinEmoji } from '../../components/emojis';
1310
import { connectFourGameTracker } from '../../components/games/connectFour';
1411

1512
const connectFourExecuteCommand: SapphireMessageExecuteType = async (
1613
_client,
1714
messageFromUser,
18-
args,
15+
_args,
1916
): Promise<SapphireMessageResponseWithMetadata> => {
2017
/*
2118
executeCommand sends the initial connectFour embed;
2219
the subsequent interactionHandlers handle the rest of the logic
2320
*/
2421

25-
const challenger = args['challenger'] as User;
26-
2722
const game = await connectFourGameTracker.startGame(
2823
messageFromUser.channelId,
2924
getUserFromMessage(messageFromUser),

src/components/games/connectFour.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,8 @@ export class ConnectFourGame {
130130
verticalIndex: number,
131131
sign: ConnectFourGameSign,
132132
): boolean {
133-
console.log(`CHECKING FOR VERTICAL WIN // index: ${verticalIndex}`);
134133
if (verticalIndex >= 3) {
135134
for (let i = verticalIndex - 1; i > verticalIndex - 4; i--) {
136-
console.log(`CHECKING FOR VERTICAL WIN // token @ ${i}: ${column.tokens[i]}`);
137135
if (column.tokens[i] != sign) {
138136
return false;
139137
}
@@ -174,7 +172,6 @@ export class ConnectFourGame {
174172
verticalIndex: number,
175173
sign: ConnectFourGameSign,
176174
): boolean {
177-
console.log(`CHECKING FOR DIAGONAL WIN: ${horizontalIndex} ${verticalIndex} ${sign}`);
178175
let left_pointer_x = horizontalIndex;
179176
let left_pointer_y = verticalIndex;
180177
let right_pointer_x = horizontalIndex;
@@ -199,10 +196,6 @@ export class ConnectFourGame {
199196

200197
if (right_pointer_x - left_pointer_x + 1 >= 4) {
201198
return true;
202-
} else {
203-
console.log(
204-
`LEFT BOTTOM TOP RIGHT right_pointer_x: ${right_pointer_x} left_pointer_x ${left_pointer_x}`,
205-
);
206199
}
207200

208201
return false;
@@ -238,10 +231,6 @@ export class ConnectFourGame {
238231

239232
if (right_pointer_x - left_pointer_x + 1 >= 4) {
240233
return true;
241-
} else {
242-
console.log(
243-
`LEFT TOP RIGHT BOTTOM: right_pointer_x: ${right_pointer_x} left_pointer_x ${left_pointer_x}`,
244-
);
245234
}
246235

247236
return false;
@@ -255,7 +244,6 @@ export class ConnectFourGame {
255244
// as of this point the user hasn't won yet, so we just need to check if the token that was just placed
256245
// is part of a winning combination
257246
// newly placed token
258-
console.log('-------!!!!!!!--!!!!!!--------');
259247
const horizontalIndex = columnIndex;
260248
const verticalIndex = state.columns[columnIndex].fill - 1;
261249
const column = state.columns[columnIndex];
@@ -456,7 +444,6 @@ export const getCodeyConnectFourSign = (): ConnectFourGameSign => {
456444
};
457445

458446
export const updateColumn = (column: ConnectFourColumn, sign: ConnectFourGameSign): boolean => {
459-
console.log('%%%%% UPDATE COLUMN %%%%%');
460447
const fill: number = column.fill;
461448
if (fill < CONNECT_FOUR_ROW_COUNT) {
462449
column.tokens[fill] = sign;

src/interaction-handlers/games/connectFour.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ export class ConnectFourHandler extends InteractionHandler {
3333
const sign = parseInt(parsedCustomId[1]);
3434
const gameId = parseInt(parsedCustomId[2]);
3535

36-
console.log('sign: ---' + parsedCustomId[1]);
37-
3836
return this.some({
3937
gameId: gameId,
4038
sign: sign,
@@ -63,10 +61,7 @@ export class ConnectFourHandler extends InteractionHandler {
6361
} else {
6462
await interaction.deferUpdate();
6563
const status = await game.setStatus(game.state, result.sign - 1);
66-
console.log(`!!!!!! status: ${status}`);
6764
if (status == ConnectFourGameStatus.Pending) {
68-
console.log("game isn't over yet");
69-
7065
if (!game.state.player2Id) {
7166
let codeySign = getCodeyConnectFourSign();
7267
while (!updateColumn(game.state.columns[codeySign - 1], game.state.player2Sign)) {

0 commit comments

Comments
 (0)