Skip to content

Commit

Permalink
Comment Console.log so user pc don't overload on background (#1624)
Browse files Browse the repository at this point in the history
Comment console.log so user pc don't overload

while fixing #1568 I saw that some games use loop console.log causing 10k consoles per min making user's pc work slowly, this would happen on the webpage + anytime someone tries to play games

this comment out so the developer can still uncomment and test locally
  • Loading branch information
DevIos01 authored Apr 27, 2024
1 parent 2e6a309 commit c62563b
Show file tree
Hide file tree
Showing 81 changed files with 221 additions and 221 deletions.
8 changes: 4 additions & 4 deletions games/15_puzzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ if (!solvable) {


puzzle.push(16);
console.log(puzzle)
// console.log(puzzle)

let puzzleIdx = 0;
let mapStr = ""
Expand All @@ -350,7 +350,7 @@ for (let i = 0; i < 4; i++) {
}
mapStr += "\n";
}
console.log(mapStr);
// console.log(mapStr);

setMap(map`${mapStr}`);

Expand Down Expand Up @@ -401,8 +401,8 @@ afterInput(async () => {
for (let x = 0; x < 4; x++) {
const t = getTile(x, y);
if (t.length && t[0].type != tiles[tileIdx]) {
console.log("got type", t[0].type)
console.log('expected', tiles[tileIdx])
// console.log("got type", t[0].type)
// console.log('expected', tiles[tileIdx])
return
}
tileIdx++;
Expand Down
2 changes: 1 addition & 1 deletion games/256.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function moveAll(dx, dy) {
blocks.forEach(block => getAll(block).forEach(sprite => {
// check if neighbour is of same type
const neighbourTiles = getTile(sprite.x + dx, sprite.y + dy).map(t => t.type);
console.log(neighbourTiles);
// console.log(neighbourTiles);
if (neighbourTiles.includes(block) || neighbourTiles.length === 0) {
sprite.x += dx;
sprite.y += dy;
Expand Down
20 changes: 10 additions & 10 deletions games/3D_wire_frame_rendererV1.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,32 +207,32 @@ let focal_length = 30;
// i
onInput("i", () => {
translationy += 1;
console.log("translationy: ", translationy)
// console.log("translationy: ", translationy)
})
// k
onInput("k", () => {
translationy += -1;
console.log("translationy: ", translationy)
// console.log("translationy: ", translationy)
})
// a
onInput("a", () => {
translationx += -1;
console.log("translationx: ", translationx)
// console.log("translationx: ", translationx)
})
// d
onInput("d", () => {
translationx += 1;
console.log("translationx: ", translationx)
// console.log("translationx: ", translationx)
})
// s
onInput("s", () => {
translationz += -1;
console.log("translationz: ", translationz)
// console.log("translationz: ", translationz)
})
// w
onInput("w", () => {
translationz += 1;
console.log("translationz: ", translationz)
// console.log("translationz: ", translationz)
})
// j to stop
onInput("j", () => {
Expand Down Expand Up @@ -260,7 +260,7 @@ function draw_line(x1, y1, x2, y2) { // Iterators, counters required by algor
addSprite(Math.round(x), (y), blue_pixel); // Draw first pixel // Rasterize the line
}
catch (error) {
console.log("outside of screen")
// console.log("outside of screen")
}
for (i = 0; x < xe; i++) {
x = x + 1; // Deal with octants...
Expand All @@ -279,7 +279,7 @@ function draw_line(x1, y1, x2, y2) { // Iterators, counters required by algor
addSprite(Math.round(x), Math.round(y), blue_pixel);
}
catch (error) {
console.log("outside of screen")
// console.log("outside of screen")
}
} } else { // The line is Y-axis dominant // Line is drawn bottom to top
if (dy >= 0) {
Expand All @@ -291,7 +291,7 @@ function draw_line(x1, y1, x2, y2) { // Iterators, counters required by algor
addSprite(Math.round(x), Math.round(y), blue_pixel); // Draw first pixel // Rasterize the line
}
catch (error) {
console.log("outside of screen")
// console.log("outside of screen")
}
for (i = 0; y < ye; i++) {
y = y + 1; // Deal with octants...
Expand All @@ -310,7 +310,7 @@ function draw_line(x1, y1, x2, y2) { // Iterators, counters required by algor
addSprite(Math.round(x), Math.round(y), blue_pixel);
}
catch (error) {
console.log("outside of screen")
// console.log("outside of screen")
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions games/5-in-1-Carnival-Game-Pack!.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class WhackOrpheus {
o.y = Math.floor(Math.random() * 3)

if (i[0]) {
console.log(i)
// console.log(i)
if (i[0]._type == "s") {
addText("You caught him!", {color: color`H`})
setTimeout(()=> {
Expand Down Expand Up @@ -181,7 +181,7 @@ class Piano {
let s = getFirst(selector2)
let i = getTile(s.x, s.y)

console.log(i)
// console.log(i)

if (i[0]._type == "3") {
playTune(a)
Expand Down Expand Up @@ -982,9 +982,9 @@ p..........

setMap(levels[level]);

console.log("hoi1")
// console.log("hoi1")
if (game == "none") {
console.log("menu setup")
// console.log("menu setup")
setBackground(bg);
mapNat = getMapV2();
setMapV2(trimMapV2(px-5, py-4, 10, 8, mapNat));
Expand Down
2 changes: 1 addition & 1 deletion games/9_puzzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ onInput("k", _ => {
})

afterInput(_ => {
console.log(tilesWith(red,target));
// console.log(tilesWith(red,target));
})

const moveTileTo = (x,y) => {
Expand Down
2 changes: 1 addition & 1 deletion games/Amoeba.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ function getSequenceOfMarks(initialX, initialY, xStepDirection, yStepDirection,

function checkForWin() {
const marks = marksPlaced.filter(mark => mark.type === currentTurn);
console.log("M", marks);
// console.log("M", marks);

const sequenceChecks = [[-1, 1], /*[1, -1],*/ [1, 1], /*[-1, -1],*/ [0, 1], /*[0, -1],*/ [-1, 0], /*[1, 0]*/];

Expand Down
2 changes: 1 addition & 1 deletion games/AmongTheStars.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ setPushables({
addSprite(PlayerX + 1, PlayerY, FlyLazerRight);
break;
default:
console.log("I don't know what fruit that is.");
// console.log("I don't know what fruit that is.");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion games/Amongus_flight.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ getAll(blocker).forEach((w) => {

function lost() {
death = true;
console.log("You lost");
// console.log("You lost");
setMap(map`
........
........
Expand Down
2 changes: 1 addition & 1 deletion games/Avoid_The_Tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function gameLoop() {

function lost() {
gameOver = true;
console.log("You lost");
// console.log("You lost");
setMap(map`
ssssss
ssssss
Expand Down
6 changes: 3 additions & 3 deletions games/Bert_Blaster.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ addSprite(6, 6, obstacle);


function stop() {
console.log('game stopped');
// console.log('game stopped');
running = false;
intervals.forEach((interval) => clearInterval(interval));
}
Expand Down Expand Up @@ -400,7 +400,7 @@ function setupGamescoreInterval(){
const interval = setInterval(()=> {

gameScore*= gameScoreMultipliciator;
console.log(gameScore.toFixed(0));
// console.log(gameScore.toFixed(0));


},500);
Expand All @@ -425,7 +425,7 @@ if(getFirst(obstacle)!=undefined){
getFirst(obstacle).x -= 1;
}

console.log("running");
// console.log("running");



Expand Down
6 changes: 3 additions & 3 deletions games/Binary_Eater.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ function generateBinaryMap() {


let binaryMap = generateBinaryMap();
console.log(binaryMap);
// console.log(binaryMap);

onInput("w", () => { code(0); });
onInput("a", () => { code(1); });
Expand All @@ -302,7 +302,7 @@ function restart_game() {

// l is also used to reset
onInput("l", () => {
console.log("yep");
// console.log("yep");
if (!game_running) {
restart_game();
return;
Expand Down Expand Up @@ -336,7 +336,7 @@ function code(digit) {

return;
}
console.log("Binary value: " + ch);
// console.log("Binary value: " + ch);

letters += ch;
bin = "";
Expand Down
6 changes: 3 additions & 3 deletions games/Blob_Runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ function isDead(){
}else{
setMap(levels[loseindex])
stop = 1;
console.log('STOP')
// console.log('STOP')
level = 0
clearText()
}
Expand Down Expand Up @@ -486,7 +486,7 @@ onInput("d", ()=>{

afterInput(() => {

console.log(getFirst(player).x)
// console.log(getFirst(player).x)
if(level==6){
if(getTile(21, 15).length == 2){
clearTile(47, 0)
Expand Down Expand Up @@ -518,7 +518,7 @@ afterInput(() => {
}
if(getFirst(player).x == widths[level]){

console.log(widths[level])
// console.log(widths[level])
level ++
setMap(levels[level])
}
Expand Down
8 changes: 4 additions & 4 deletions games/Cheese-Hunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ onInput("k", () => {
const decoyTiles = tilesWith(decoy);
const decoyTile = decoyTiles[0];

console.log(decoyTile[0].x);
// console.log(decoyTile[0].x);
decoyTiles.forEach(checkDecoy);

function checkDecoy(decoy) {
Expand All @@ -366,7 +366,7 @@ function checkNext() {
boxPositionX = boxPosition[0].x;
boxPositionY = boxPosition[0].y;

console.log(boxPosition[0].x);
// console.log(boxPosition[0].x);

if ((getFirst(player).x === boxPositionX) && (getFirst(player).y === boxPositionY)) {
return true;
Expand All @@ -390,7 +390,7 @@ function checkCheese() {

function checkTrap() {
const traps = tilesWith(trap);
console.log(traps);
// console.log(traps);


traps.forEach(trapLoop);
Expand Down Expand Up @@ -428,7 +428,7 @@ function checkTunnel() {

function bigTrapCheck() {
const traps = tilesWith(bigTrap);
console.log(traps);
// console.log(traps);


traps.forEach(trapLoop);
Expand Down
2 changes: 1 addition & 1 deletion games/ConnectX.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ function drawBoard() {
function placeChip(col) {
const numRows = board.length;
for (let row = board.length; row > 0; row --) {
console.log(board[row-1][col]);
// console.log(board[row-1][col]);
if (board[row-1][col] == '_') {
board[row-1][col] = turn;
if (turn == 'y') {
Expand Down
4 changes: 2 additions & 2 deletions games/Desine_Mini.js
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,7 @@ function Boss1() {
Boss1attack = Math.floor(Math.random() * 51);
// 0 dash
if (Boss1attack > 25 && canAttack) {
console.log("dash")
// console.log("dash")
canAttack = false
if (getFirst(boss1p1).x == 1) {
let plat1x = Math.floor(Math.random() * 3);
Expand Down Expand Up @@ -1920,7 +1920,7 @@ function Boss1() {
}
// 1 stars
if (Boss1attack < 25 && canAttack) {
console.log("stars")
// console.log("stars")
canAttack = false
if (getFirst(boss1p1).x == 1) {
let interval = 0
Expand Down
4 changes: 2 additions & 2 deletions games/Disco.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ function startGame() {
game = true;
updateScore(score, lives);
function gameInterval () {
console.log(lives)
// console.log(lives)
if (lives <= 0) {
clearText()
playTune(music.gameOver)
Expand All @@ -350,7 +350,7 @@ function startGame() {
if (speed >= 350) {
speed -= 5;
}
console.log(speed)
// console.log(speed)
setTimeout(gameInterval, speed)
}
}
Expand Down
2 changes: 1 addition & 1 deletion games/Dodge_The_Rock.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function gameLoop() {
}
function lost() {
isGameOver = true;
console.log("You lost");
// console.log("You lost");
setMap(map`
........
........
Expand Down
2 changes: 1 addition & 1 deletion games/Mario_Kart.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function gameScore() {

function lost() {
GameOver = true;
console.log("You lost");
// console.log("You lost");
setMap(map`
llllll
llllll
Expand Down
4 changes: 2 additions & 2 deletions games/MicroBot_Adventure.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ setInterval(function () {

getAll(laserEast).forEach((laserEastObj) => {
getTile(laserEastObj.x, laserEastObj.y).forEach((sprite) => {
console.log(sprite.type);
// console.log(sprite.type);
if (
sprite.type === enemyEast ||
sprite.type === enemySouth ||
Expand All @@ -562,7 +562,7 @@ setInterval(function () {
});
getAll(laserWest).forEach((laserWestObj) => {
getTile(laserWestObj.x, laserWestObj.y).forEach((sprite) => {
console.log(sprite.type);
// console.log(sprite.type);
if (
sprite.type === enemyEast ||
sprite.type === enemySouth ||
Expand Down
2 changes: 1 addition & 1 deletion games/Mining_Simulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ onInput("d", () => {
});

afterInput(() => {
console.log("yes");
// console.log("yes");
});

// movement
Expand Down
Loading

0 comments on commit c62563b

Please sign in to comment.