<commit_before>var fs = require('fs');
var path = require('path');
var low = require('lowdb');
var FileSync = require('lowdb/adapters/FileSync');
var adapter = new FileSync('db.json');
var db = low(adapter);

/**
 * Setup Game globals.
 */
global.games = {};
global.gameCount = 0;
global.lastSave = 0;

gameCount = db.get('gameCount').value() || 0;
gameCountSaveDifference = 1; //how many games must elapse before updating .txt w/ gameCount
lastSave = gameCount;

//add starter decks to variable
fs.readdir("./starter decks", function(err, files) {
	for (var i in files) {
		var deckString = fs.readFileSync("./starter decks/" + files[i]) + '';
		Game.prototype.starterDecks.push(deckString);
	}
});

/**
 * A Yu-Gi-Oh! Game.
 *
 * @param {Socket Object} p1
 * @param {Socket Object} p2
 * @param {String} tier
 * @param {Boolean} rated
 * @param {Object} p1Deck
 * @param {Object} p2Deck
 */

function Game(p1, p2, tier, rated, p1Deck, p2Deck) {
	//static variables
	this.id = ++gameCount;
	this.p1 = new Side(this, "p1", p1, p1Deck);
	this.p2 = new Side(this, "p2", p2, p2Deck);
	this.tier = tier;
	this.rated = rated;
	this.spectators = {};<commit_msg>fix starter decks not showing up for random battles<commit_after>var fs = require('fs');
var path = require('path');
var low = require('lowdb');
var FileSync = require('lowdb/adapters/FileSync');
var adapter = new FileSync('db.json');
var db = low(adapter);

/**
 * Setup Game globals.
 */
global.games = {};
global.gameCount = 0;
global.lastSave = 0;

gameCount = db.get('gameCount').value() || 0;
gameCountSaveDifference = 1; //how many games must elapse before updating .txt w/ gameCount
lastSave = gameCount;

//add starter decks to variable
fs.readdir("./lib/starter decks", function(err, files) {
	for (var i in files) {
		var file = files[i];
		if (!file.endsWith('.dek')) continue;
		var deckString = fs.readFileSync("./lib/starter decks/" + file) + '';
		Game.prototype.starterDecks.push(deckString);
	}
});


/**
 * A Yu-Gi-Oh! Game.
 *
 * @param {Socket Object} p1
 * @param {Socket Object} p2
 * @param {String} tier
 * @param {Boolean} rated
 * @param {Object} p1Deck
 * @param {Object} p2Deck
 */

function Game(p1, p2, tier, rated, p1Deck, p2Deck) {
	//static variables
	this.id = ++gameCount;
	this.p1 = new Side(this, "p1", p1, p1Deck);
	this.p2 = new Side(this, "p2", p2, p2Deck);
	this.tier = tier;
	this.rated = rated;
	this.spectators = {};
{'fraction_non_alphanumeric': 0.17218543046357615, 'fraction_numerical': 0.016556291390728478, 'mean_word_length': 4.067085953878407, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2424685', 'n_tokens_mistral': 907, 'n_tokens_neox': 867, 'n_words': 244}