<commit_before>var request = require('request');

function Bot(key, mode, url) {
  this.key = key;
  this.mode = mode || 'training';
  this.serverURL = url === undefined ? 'http://vindinium.org' : url;
  this.URL = this.serverURL + '/api/' + this.mode;
}

Bot.prototype.run = function(cb) {
  request.post({url: this.URL, form: {key: this.key}}, function(err, res, body) {
    this.data = JSON.parse(body);
    this.playURL = this.data.playUrl;
    console.log('first run');
    cb(this.data);
  });
  if(this.data.finished !== true) {
    setInterval(function() {
      request.post({url: this.playURL, form: {key: this.key, dir: cb(this.data)}}, function(err, res, body) {
        console.log('run');
      });
    }, 500);
  }
};

var helpers = {
  pathfinder: function() {
    // pathfinder code
  }
};

module.Bot = Bot;
module.helpers = helpers;
<commit_msg>Worked on parsing the map so that users can access it via the map array.  map[x][y].<commit_after>var request = require('request');

function Bot(key, mode, url) {
  this.key = key;
  this.mode = mode || 'training';
  this.serverURL = url === undefined ? 'http://vindinium.org' : url;
  this.URL = this.serverURL + '/api/' + this.mode;
}

Bot.prototype.run = function(cb) {
  request.post({url: this.URL, form: {key: this.key}}, function(err, res, body) {
    this.data = JSON.parse(body);
    this.playURL = this.data.playUrl;
    console.log('first run');
    cb(this.data);
  });
  if(this.data.finished !== true) {
    setInterval(function() {
      request.post({url: this.playURL, form: {key: this.key, dir: cb(this.data)}}, function(err, res, body) {
        console.log('run');
      });
    }, 500);
  }

  /* @DescRepackaging the bot.data so that it is more useful for the students.
   *
   * Bot.data currently holds the information from the JSON file in an object.
   *
   * botN will be an object with the botN's position and health
   *
   * map will be an array with the data for the map.
   *  0 = Walkable
   *  1 = wall
   *  @ = your hero
   *  A = hero 1
   *  B = hero 2
   *  C = hero 3
   *  T = Tavern
   *  M = Mine
   */
  var tempMap = Bot.data.game.board;
  var tempMapSize = Bot.data.game.board.size;
  this.map = [];
  for(var i = 0; i < tempMapSize; i++){
   map.push([]);
  }
  for(var i = 0; i < tempMapSize; i++){
      for(var j = 0; j < tempMapSize; j++){
          map[i].push([]);
      }
  }

  var counter = 0;
  var xPos = 0;
  var yPos = 0;
  for(var i = 0; i < (tempMapSize * tempMapSize * 2); i+=2){
       yPos = counter;
       console.log(tempMap[i]);
       switch(tempMap[i]){
           case "#": map[xPos][yPos] = 1;
             break;
           case " ": map[xPos][yPos] = 0;
             break;
           case "[": map[xPos][yPos] = "T";
             break;
           case "$":
               if(tempMap[i+1] === "-"){
                 map[xPos][yPos] = "M";
               }
               else{
                 map[xPos][yPos] = "P";
               }
             break;
           case "@": map[xPos][yPos] = "@";
             break;
       }
     counter++;
     if(counter === tempMapSize){
         counter = 0;
         xPos++;
     }
  }
  //botA.health and botA.xPos and botA.yPos




};

var helpers = {
  pathfinder: function() {
    // pathfinder code
    // initializes the EasyStar pathfinding module
    var easystar = new EasyStar.js();

  }
};

module.Bot = Bot;
module.helpers = helpers;

{'fraction_non_alphanumeric': 0.16831971995332556, 'fraction_numerical': 0.007001166861143524, 'mean_word_length': 2.186802973977695, 'pattern_counts': {'":': 5, '<': 7, '<?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': '4707078', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1191, 'n_words': 297}