diff --git a/public/games/battleships_v2/game.js b/public/games/battleships_v2/game.js index c1048062545793680a56a42cc41ae83a1f9a1932..c1e919117d0b234480d892779bb0f3e105dc2cbf 100644 --- a/public/games/battleships_v2/game.js +++ b/public/games/battleships_v2/game.js @@ -314,7 +314,7 @@ class attack extends base { this.shots.push(...shot); }), this.socket.on("sunk", (ships) => { - console.log("sunk"); + // console.log("sunk"); this.placed_ships.push(...ships); }); } diff --git a/public/games/battleships_v2/game.ts b/public/games/battleships_v2/game.ts index 93cf751b6b8e5915c2a0b5a5b89c372e9f919764..15227a93a75c41667d73839715a025b0fcc6343c 100644 --- a/public/games/battleships_v2/game.ts +++ b/public/games/battleships_v2/game.ts @@ -388,7 +388,7 @@ class attack extends base { this.shots.push(...shot); }), this.socket.on("sunk", (ships: ship[]) => { - console.log("sunk"); + // console.log("sunk"); this.placed_ships.push(...ships); }) } diff --git a/src/games/battleships_v2.ts b/src/games/battleships_v2.ts index 7ad2e0c4c8b104c32544a114d0e31d372ed24040..bddc7a75db7b858c27114d5cbd1e06100be4bb62 100644 --- a/src/games/battleships_v2.ts +++ b/src/games/battleships_v2.ts @@ -241,14 +241,14 @@ const battleships_v2: GameConstructor = class battleships_v2 implements Game { if (game_data.data.turn != player.player_no) return false; let opponent_ships: ship[] = game_data.json[(player.player_no + 1) % 2 + 1]; if (!opponent_ships) return false; - console.log("MARK 1") + // console.log("MARK 1") //check not duplicate let shots: shot[] = game_data.json[player.player_no + 3]; if (shots.reduce((dup: boolean, s) => dup || (s.x == shot.x && s.y == shot.y), false)) { player.socket.emit("fire"); return false; } - console.log("MARK 2"); + // console.log("MARK 2"); game_data.data.turn++; game_data.data.turn %= 2; this.db.query("UPDATE game_data SET data_value=? WHERE game_id=? AND data_key=0;", [JSON.stringify(game_data.data), game_data.id]); @@ -287,12 +287,12 @@ const battleships_v2: GameConstructor = class battleships_v2 implements Game { if (shot.hit && shot.x == X && shot.y == Y) hits--; } } - console.log({ - hits, - shot, - hit, - ship - }); + // console.log({ + // hits, + // shot, + // hit, + // ship + // }); if (hits == 0 && hit == ship) { console.log("SUNK"); player.socket.emit("sunk", [ship]); @@ -306,7 +306,7 @@ const battleships_v2: GameConstructor = class battleships_v2 implements Game { opp.socket.emit("shot", [shot]); opp.socket.emit("fire"); } - console.log("MARK 3") + // console.log("MARK 3") if (shot.hit) { let hits = shots.reduce((count: number, shot) => count + (shot.hit ? 1 : 0), 0); if (hits >= 19) {