Skip to content

Commit

Permalink
Remove GA
Browse files Browse the repository at this point in the history
  • Loading branch information
billmei committed Jan 25, 2024
1 parent 4a5f61c commit d9b148b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 34 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
battleboat
==========
# battleboat

A JavaScript AI that beats humans at battleship.

Play the game here: [https://billmei.github.io/battleboat](https://billmei.github.io/battleboat)

If you've forked a copy of this repo or are playing around with the code on the `https://billmei.github.io/battleboat` page, please be nice and don't hack the `Stats` object. I'm using Google Analytics to collect info about the AI's win/loss percentage in order to improve the bot, so if you do look around, I kindly ask that you don't give it bad data. Thanks :)

If you want to try stuff out, run `setDebug(true);` in the console before doing anything. You'll also get access to some cool features.
13 changes: 0 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,6 @@ <h2>Enemy Fleet</h2>

<a href="https://github.com/billmei/battleboat"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>

<script async src="https://www.googletagmanager.com/gtag/js?id=G-MDXLY4NGC1"></script>
<script>
// Don't change this variable.
var DEBUG_MODE = localStorage.getItem('DEBUG_MODE') === 'true';
// To turn DEBUG_MODE on, run `setDebug(true);` in the console.
if (!DEBUG_MODE) {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-MDXLY4NGC1');
}
</script>

<script src="js/battleboat.js"></script>
<span class="prefetch" id="prefetch1"></span>
<span class="prefetch" id="prefetch2"></span>
Expand Down
19 changes: 2 additions & 17 deletions js/battleboat.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@
// finished placing their ships, or she can cheat easily by placing her ships
// outside the regions with the highest probability.

console.log("%cHi! Thanks for checking out this game.%c Please be nice and don't " +
"hack the Stats object, I'm using Google Analytics to collect info about " +
"the AI's win/loss percentage in order to improve the bot, so if you do " +
"look around, I kindly ask that you don't give it bad data. Thanks :)",
"font-weight: bold; font-family: Tahoma, Helvetica, Arial, sans-serif;", "");
console.log("Also, if you want to try stuff out, run %csetDebug(true);%c in the " +
console.log("If you want to try stuff out, run %csetDebug(true);%c in the " +
"console before doing anything. You'll also get access to some cool features.",
"background: #000; color: #0f0; padding: 2px 5px; border-radius: 2px;", "");

Expand Down Expand Up @@ -75,18 +70,12 @@ Stats.prototype.hitShot = function() {
Stats.prototype.wonGame = function() {
this.gamesPlayed++;
this.gamesWon++;
if (!DEBUG_MODE) {
gtag('event', 'gameOver', {'win': this.uuid});
}
};
Stats.prototype.lostGame = function() {
this.gamesPlayed++;
if (!DEBUG_MODE) {
gtag('event', 'gameOver', {'lose': this.uuid});
}
};
// Saves the game statistics to localstorage, also uploads where the user placed
// their ships to Google Analytics so that in the future I'll be able to see
// their ships to GA so that in the future I'll be able to see
// which cells humans are disproportionately biased to place ships on.
Stats.prototype.syncStats = function() {
if(!this.skipCurrentGame) {
Expand All @@ -109,10 +98,6 @@ Stats.prototype.syncStats = function() {
stringifiedGrid += '(' + x + ',' + y + '):' + mainGame.humanGrid.cells[x][y] + ';\n';
}
}

if (!DEBUG_MODE) {
gtag('event', 'humanGrid', {stringifiedGrid: this.uuid});
}
};
// Updates the sidebar display with the current statistics
Stats.prototype.updateStatsSidebar = function() {
Expand Down

0 comments on commit d9b148b

Please sign in to comment.