<commit_before>// Game: Steal from merchants and become the most infamous pirate.

const Class = require("classe");
const log = require(`${__basedir}/gameplay/log`);
const TwoPlayerGame = require(`${__basedir}/gameplay/shared/twoPlayerGame`);
const TurnBasedGame = require(`${__basedir}/gameplay/shared/turnBasedGame`);
const TiledGame = require(`${__basedir}/gameplay/shared/tiledGame`);

//<<-- Creer-Merge: requires -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.

// any additional requires you want can be required here safely between Creer re-runs

//<<-- /Creer-Merge: requires -->>

// @class Game: Steal from merchants and become the most infamous pirate.
let Game = Class(TwoPlayerGame, TurnBasedGame, TiledGame, {
    /**
     * Initializes Games.
     *
     * @param {Object} data - a simple mapping passed in to the constructor with whatever you sent with it. GameSettings are in here by key/value as well.
     */
    init: function(data) {
        TiledGame.init.apply(this, arguments);
        TurnBasedGame.init.apply(this, arguments);
        TwoPlayerGame.init.apply(this, arguments);

        /**
         * The rate buried gold increases each turn.
         *
         * @type {number}
         */
        this.buryInterestRate = this.buryInterestRate || 0;

        /**
         * How much gold it costs to construct a single crew.
         *
         * @type {number}
         */
        this.crewCost = this.crewCost || 0;

        /**
         * How much damage crew deal to each other.
         *
         * @type {number}
         */
        this.crewDamage = this.crewDamage || 0;

        /**
         * The maximum amount of health a crew member can have.
         *
         * @type {number}
         */
        this.crewHealth = this.crewHealth || 0;

        /**
         * The number of moves Units with only crew are given each turn.
         *
         * @type {number}
         */
        this.crewMoves = this.crewMoves || 0;

        /**
         * A crew's attack range. Range is circular.
         *
         * @type {number}
         */
        this.crewRange = this.crewRange || 0;

        /**
         * The player whose turn it is currently. That player can send commands. Other players cannot.
         *
         * @type {Player}
         */
        this.currentPlayer = this.currentPlayer || null;

        /**
         * The current turn number, starting at 0 for the first player's turn.
         *
         * @type {number}
         */
        this.currentTurn = this.currentTurn || 0;

        /**
         * A mapping of every game object's ID to the actual game object. Primarily used by the server and client to easily refer to the game objects via ID.
         *
         * @type {Object.<string, GameObject>}
         */
        this.gameObjects = this.gameObjects || {};

        /**
         * How much health a Unit recovers when they rest.
         *
         * @type {number}
         */
        this.healFactor = this.healFactor || 0;

        /**
         * The number of Tiles in the map along the y (vertical) axis.
         *
         * @type {number}
         */
        this.mapHeight = this.mapHeight || 0;

        /**
         * The number of Tiles in the map along the x (horizontal) axis.
         *
         * @type {number}
         */
        this.mapWidth = this.mapWidth || 0;

        /**
         * The maximum number of turns before the game will automatically end.
         *
         * @type {number}
         */
        this.maxTurns = this.maxTurns || 0;

        /**
         * How much gold merchant Ports get each turn.
         *
         * @type {number}
         */
        this.merchantGoldRate = this.merchantGoldRate || 0;

        /**
         * When a merchant ship spawns, the amount of additional gold it has relative to the Port's investment.
         *
         * @type {number}
         */
        this.merchantInterestRate = this.merchantInterestRate || 0;

        /**
         * The Euclidean distance buried gold must be from the Player's Port to accumulate interest.
         *
         * @type {number}
         */
        this.minInterestDistance = this.minInterestDistance || 0;

        /**
         * List of all the players in the game.
         *
         * @type {Array.<Player>}
         */
        this.players = this.players || [];

        /**
         * Every Port in the game. Merchant ports have owner set to null.
         *
         * @type {Array.<Port>}
         */
        this.ports = this.ports || [];

        /**
         * How far a Unit can be from a Port to rest. Range is circular.
         *
         * @type {number}
         */
        this.restRange = this.restRange || 0;

        /**
         * A unique identifier for the game instance that is being played.
         *
         * @type {string}
         */
        this.session = this.session || "";

        /**
         * How much gold it costs to construct a ship.
         *
         * @type {number}
         */
        this.shipCost = this.shipCost || 0;

        /**
         * How much damage ships deal to ships and ports.
         *
         * @type {number}
         */
        this.shipDamage = this.shipDamage || 0;

        /**
         * The maximum amount of health a ship can have.
         *
         * @type {number}
         */
        this.shipHealth = this.shipHealth || 0;

        /**
         * The number of moves Units with ships are given each turn.
         *
         * @type {number}
         */
        this.shipMoves = this.shipMoves || 0;

        /**
         * A ship's attack range. Range is circular.
         *
         * @type {number}
         */
        this.shipRange = this.shipRange || 0;

        /**
         * All the tiles in the map, stored in Row-major order. Use `x + y * mapWidth` to access the correct index.
         *
         * @type {Array.<Tile>}
         */
        this.tiles = this.tiles || [];

        /**
         * Every Unit in the game. Merchant units have targetPort set to a port.
         *
         * @type {Array.<Unit>}
         */
        this.units = this.units || [];


        //<<-- Creer-Merge: init -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.

        this.maxTurns = data.maxTurns || 720;
        this.mapWidth = data.mapWidth || 40;
        this.mapHeight = data.mapHeight || 28;

        this.crewCost = data.crewCost || 200;
        this.shipCost = data.shipCost || 600;
        this.crewDamage = data.crewDamage || 1;
        this.shipDamage = data.shipDamage || 2;
        this.crewHealth = data.crewHealth || 4;
        this.shipHealth = data.shipHealth || 20;
        this.crewRange = data.crewRange || 1;
        this.shipRange = data.shipRange || 3;
        this.crewMoves = data.crewMoves || 2;
        this.shipMoves = data.shipMoves || 3;

        this.restRange = data.restRange || 1.5;
        this.healFactor = data.healFactor || 0.25;

        this.merchantGoldRate = data.merchantGoldRate || 100;
        this.buryInterestRate = data.buryInterestRate || 1.1;
        this.merchantInvestmentRate = data.merchantStartingInvestment || 1.1;
        this.minInterestDistance = data.minInterestDistance || 10;

        // Not visible to players
        this.merchantGold = this.shipCost;
        this.merchantBaseCrew = 3;
        this.merchantCost = this.shipCost * 4;
        this.startingGold = data.startingGold || 3 * this.crewCost + 3 * this.shipCost;
        this.maxTileGold = 10000;

        // For units and structures created during a turn
        this.newUnits = [];

        //<<-- /Creer-Merge: init -->>
    },

    name: "Pirates",

    aliases: [
        //<<-- Creer-Merge: aliases -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
        "MegaMinerAI-21-Pirates",
        //<<-- /Creer-Merge: aliases -->>
    ],



    /**
     * This is called when the game begins, once players are connected and ready to play, and game objects have been initialized. Anything in init() may not have the appropriate game objects created yet..
     */
    begin: function() {<commit_msg>adjusted starting buryInterestRate to 1.025<commit_after>// Game: Steal from merchants and become the most infamous pirate.

const Class = require("classe");
const log = require(`${__basedir}/gameplay/log`);
const TwoPlayerGame = require(`${__basedir}/gameplay/shared/twoPlayerGame`);
const TurnBasedGame = require(`${__basedir}/gameplay/shared/turnBasedGame`);
const TiledGame = require(`${__basedir}/gameplay/shared/tiledGame`);

//<<-- Creer-Merge: requires -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.

// any additional requires you want can be required here safely between Creer re-runs

//<<-- /Creer-Merge: requires -->>

// @class Game: Steal from merchants and become the most infamous pirate.
let Game = Class(TwoPlayerGame, TurnBasedGame, TiledGame, {
    /**
     * Initializes Games.
     *
     * @param {Object} data - a simple mapping passed in to the constructor with whatever you sent with it. GameSettings are in here by key/value as well.
     */
    init: function(data) {
        TiledGame.init.apply(this, arguments);
        TurnBasedGame.init.apply(this, arguments);
        TwoPlayerGame.init.apply(this, arguments);

        /**
         * The rate buried gold increases each turn.
         *
         * @type {number}
         */
        this.buryInterestRate = this.buryInterestRate || 0;

        /**
         * How much gold it costs to construct a single crew.
         *
         * @type {number}
         */
        this.crewCost = this.crewCost || 0;

        /**
         * How much damage crew deal to each other.
         *
         * @type {number}
         */
        this.crewDamage = this.crewDamage || 0;

        /**
         * The maximum amount of health a crew member can have.
         *
         * @type {number}
         */
        this.crewHealth = this.crewHealth || 0;

        /**
         * The number of moves Units with only crew are given each turn.
         *
         * @type {number}
         */
        this.crewMoves = this.crewMoves || 0;

        /**
         * A crew's attack range. Range is circular.
         *
         * @type {number}
         */
        this.crewRange = this.crewRange || 0;

        /**
         * The player whose turn it is currently. That player can send commands. Other players cannot.
         *
         * @type {Player}
         */
        this.currentPlayer = this.currentPlayer || null;

        /**
         * The current turn number, starting at 0 for the first player's turn.
         *
         * @type {number}
         */
        this.currentTurn = this.currentTurn || 0;

        /**
         * A mapping of every game object's ID to the actual game object. Primarily used by the server and client to easily refer to the game objects via ID.
         *
         * @type {Object.<string, GameObject>}
         */
        this.gameObjects = this.gameObjects || {};

        /**
         * How much health a Unit recovers when they rest.
         *
         * @type {number}
         */
        this.healFactor = this.healFactor || 0;

        /**
         * The number of Tiles in the map along the y (vertical) axis.
         *
         * @type {number}
         */
        this.mapHeight = this.mapHeight || 0;

        /**
         * The number of Tiles in the map along the x (horizontal) axis.
         *
         * @type {number}
         */
        this.mapWidth = this.mapWidth || 0;

        /**
         * The maximum number of turns before the game will automatically end.
         *
         * @type {number}
         */
        this.maxTurns = this.maxTurns || 0;

        /**
         * How much gold merchant Ports get each turn.
         *
         * @type {number}
         */
        this.merchantGoldRate = this.merchantGoldRate || 0;

        /**
         * When a merchant ship spawns, the amount of additional gold it has relative to the Port's investment.
         *
         * @type {number}
         */
        this.merchantInterestRate = this.merchantInterestRate || 0;

        /**
         * The Euclidean distance buried gold must be from the Player's Port to accumulate interest.
         *
         * @type {number}
         */
        this.minInterestDistance = this.minInterestDistance || 0;

        /**
         * List of all the players in the game.
         *
         * @type {Array.<Player>}
         */
        this.players = this.players || [];

        /**
         * Every Port in the game. Merchant ports have owner set to null.
         *
         * @type {Array.<Port>}
         */
        this.ports = this.ports || [];

        /**
         * How far a Unit can be from a Port to rest. Range is circular.
         *
         * @type {number}
         */
        this.restRange = this.restRange || 0;

        /**
         * A unique identifier for the game instance that is being played.
         *
         * @type {string}
         */
        this.session = this.session || "";

        /**
         * How much gold it costs to construct a ship.
         *
         * @type {number}
         */
        this.shipCost = this.shipCost || 0;

        /**
         * How much damage ships deal to ships and ports.
         *
         * @type {number}
         */
        this.shipDamage = this.shipDamage || 0;

        /**
         * The maximum amount of health a ship can have.
         *
         * @type {number}
         */
        this.shipHealth = this.shipHealth || 0;

        /**
         * The number of moves Units with ships are given each turn.
         *
         * @type {number}
         */
        this.shipMoves = this.shipMoves || 0;

        /**
         * A ship's attack range. Range is circular.
         *
         * @type {number}
         */
        this.shipRange = this.shipRange || 0;

        /**
         * All the tiles in the map, stored in Row-major order. Use `x + y * mapWidth` to access the correct index.
         *
         * @type {Array.<Tile>}
         */
        this.tiles = this.tiles || [];

        /**
         * Every Unit in the game. Merchant units have targetPort set to a port.
         *
         * @type {Array.<Unit>}
         */
        this.units = this.units || [];


        //<<-- Creer-Merge: init -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.

        this.maxTurns = data.maxTurns || 720;
        this.mapWidth = data.mapWidth || 40;
        this.mapHeight = data.mapHeight || 28;

        this.crewCost = data.crewCost || 200;
        this.shipCost = data.shipCost || 600;
        this.crewDamage = data.crewDamage || 1;
        this.shipDamage = data.shipDamage || 2;
        this.crewHealth = data.crewHealth || 4;
        this.shipHealth = data.shipHealth || 20;
        this.crewRange = data.crewRange || 1;
        this.shipRange = data.shipRange || 3;
        this.crewMoves = data.crewMoves || 2;
        this.shipMoves = data.shipMoves || 3;

        this.restRange = data.restRange || 1.5;
        this.healFactor = data.healFactor || 0.25;

        this.merchantGoldRate = data.merchantGoldRate || 100;
        this.buryInterestRate = data.buryInterestRate || 1.025;
        this.merchantInvestmentRate = data.merchantStartingInvestment || 1.1;
        this.minInterestDistance = data.minInterestDistance || 10;

        // Not visible to players
        this.merchantGold = this.shipCost;
        this.merchantBaseCrew = 3;
        this.merchantCost = this.shipCost * 4;
        this.startingGold = data.startingGold || 3 * this.crewCost + 3 * this.shipCost;
        this.maxTileGold = 10000;

        // For units and structures created during a turn
        this.newUnits = [];

        //<<-- /Creer-Merge: init -->>
    },

    name: "Pirates",

    aliases: [
        //<<-- Creer-Merge: aliases -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
        "MegaMinerAI-21-Pirates",
        //<<-- /Creer-Merge: aliases -->>
    ],



    /**
     * This is called when the game begins, once players are connected and ready to play, and game objects have been initialized. Anything in init() may not have the appropriate game objects created yet..
     */
    begin: function() {
{'fraction_non_alphanumeric': 0.11169633127497276, 'fraction_numerical': 0.008596682407071074, 'mean_word_length': 1.6643548387096774, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, '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': '880700', 'n_tokens_mistral': 4827, 'n_tokens_neox': 4546, 'n_words': 1442}