<commit_before>(function() {
// Battleboat
// <NAME>, 2014
// MIT License

// Thanks to <NAME> for the inspiration behind the AI
// http://www.datagenetics.com/blog/december32011/

// TODO: Use analytics to track stats against real human players (use an ajax request to get uuid's)
// TODO: Add a toggle that visualizes the probability grid via heatmap (scale a color via max and 0) [Don't track the win/loss if the heatmap is turned on]
// TODO: Use `Array.filter()` instead of for-loop checking each element
// TODO: Change the `alert()`s to CSS transition for a win screen
// TODO: Meta-game the user between playsessions
// TODO: Smaller responsive breakpoint;

// Global Constants
function CONST() {}
CONST.AVAILABLE_SHIPS = ['carrier', 'battleship', 'destroyer', 'submarine', 'patrolboat'];
// You are player 0 and the computer is player 1
// The virtual player is used for generating temporary ships
// for calculating the probability heatmap
CONST.HUMAN_PLAYER = 0;
CONST.COMPUTER_PLAYER = 1;
CONST.VIRTUAL_PLAYER = 2;
// Possible values for the parameter `type` (string)
CONST.CSS_TYPE_EMPTY = 'empty';
CONST.CSS_TYPE_SHIP = 'ship';
CONST.CSS_TYPE_MISS = 'miss';
CONST.CSS_TYPE_HIT = 'hit';
CONST.CSS_TYPE_SUNK = 'sunk';
// Grid code:
CONST.TYPE_EMPTY = 0; // 0 = water (empty)
CONST.TYPE_SHIP = 1; // 1 = undamaged ship
CONST.TYPE_MISS = 2; // 2 = water with a cannonball in it (missed shot)
CONST.TYPE_HIT = 3; // 3 = damaged ship (hit shot)
CONST.TYPE_SUNK = 4; // 4 = sunk ship

// Game Statistics
function Stats(){
	this.shotsTaken = 0;
	this.shotsHit = 0;
	if (localStorage.getItem('totalShots')) {
		this.totalShots = parseInt(localStorage.getItem('totalShots'));
	} else {
		this.totalShots = 0;
	}
	if (localStorage.getItem('totalHits')) {
		this.totalHits = parseInt(localStorage.getItem('totalHits'));
	} else {
		this.totalHits = 0;
	}
	if (localStorage.getItem('gamesPlayed')) {
		this.gamesPlayed = parseInt(localStorage.getItem('gamesPlayed'));
	} else {
		this.gamesPlayed = 0;
	}
	if (localStorage.getItem('gamesWon')) {
		this.gamesWon = parseInt(localStorage.getItem('gamesWon'));
	} else {
		this.gamesWon = 0;
	}<commit_msg>Change line endings to unix<commit_after>(function() {
// Battleboat
// <NAME>, 2014
// MIT License

// Thanks to <NAME> for the inspiration
// http://www.datagenetics.com/blog/december32011/

// TODO: Use analytics to track stats against real human players (use an ajax request to get uuid's)
// TODO: Add a toggle that visualizes the probability grid via heatmap (scale a color via max and 0) [Don't track the win/loss if the heatmap is turned on]
// TODO: Use `Array.filter()` instead of for-loop checking each element
// TODO: Change the `alert()`s to CSS transition for a win screen
// TODO: Meta-game the user between playsessions
// TODO: Smaller responsive breakpoint;

// Global Constants
function CONST() {}
CONST.AVAILABLE_SHIPS = ['carrier', 'battleship', 'destroyer', 'submarine', 'patrolboat'];
// You are player 0 and the computer is player 1
// The virtual player is used for generating temporary ships
// for calculating the probability heatmap
CONST.HUMAN_PLAYER = 0;
CONST.COMPUTER_PLAYER = 1;
CONST.VIRTUAL_PLAYER = 2;
// Possible values for the parameter `type` (string)
CONST.CSS_TYPE_EMPTY = 'empty';
CONST.CSS_TYPE_SHIP = 'ship';
CONST.CSS_TYPE_MISS = 'miss';
CONST.CSS_TYPE_HIT = 'hit';
CONST.CSS_TYPE_SUNK = 'sunk';
// Grid code:
CONST.TYPE_EMPTY = 0; // 0 = water (empty)
CONST.TYPE_SHIP = 1; // 1 = undamaged ship
CONST.TYPE_MISS = 2; // 2 = water with a cannonball in it (missed shot)
CONST.TYPE_HIT = 3; // 3 = damaged ship (hit shot)
CONST.TYPE_SUNK = 4; // 4 = sunk ship

// Game Statistics
function Stats(){
	this.shotsTaken = 0;
	this.shotsHit = 0;
	this.totalShots = 0 + parseInt(localStorage.getItem('totalShots'));
	this.totalHits = 0 + parseInt(localStorage.getItem('totalHits'));
	this.gamesPlayed = 0 + parseInt(localStorage.getItem('gamesPlayed'));
	this.gamesWon = 0 + parseInt(localStorage.getItem('gamesWon'));
{'fraction_non_alphanumeric': 0.12974051896207583, 'fraction_numerical': 0.015469061876247504, 'mean_word_length': 4.275, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3970384', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1305, 'n_words': 423}